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 = ` const validatorSetABI = `
[ [
{ {
"type": "receive", "type": "receive",
"stateMutability": "payable" "stateMutability": "payable"
}, },
{
"type": "function",
"name": "BC_FUSION_CHANNELID",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "BIND_CHANNELID", "name": "BIND_CHANNELID",
@ -1411,6 +1424,19 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "BLOCK_FEES_RATIO_SCALE",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "BURN_ADDRESS", "name": "BURN_ADDRESS",
@ -1424,19 +1450,6 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "BURN_RATIO_SCALE",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "CODE_OK", "name": "CODE_OK",
@ -1619,6 +1632,19 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "GOV_TOKEN_ADDR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "INCENTIVIZE_ADDR", "name": "INCENTIVIZE_ADDR",
@ -1814,6 +1840,19 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "STAKE_CREDIT_ADDR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "STAKE_HUB_ADDR", "name": "STAKE_HUB_ADDR",
@ -1868,13 +1907,13 @@ const validatorSetABI = `
}, },
{ {
"type": "function", "type": "function",
"name": "SYSTEM_REWARD_RATIO_SCALE", "name": "TIMELOCK_ADDR",
"inputs": [], "inputs": [],
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "uint256", "type": "address",
"internalType": "uint256" "internalType": "address"
} }
], ],
"stateMutability": "view" "stateMutability": "view"
@ -2431,19 +2470,6 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "jailValidator",
"inputs": [
{
"name": "consensusAddress",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{ {
"type": "function", "type": "function",
"name": "maintainSlashScale", "name": "maintainSlashScale",
@ -2593,6 +2619,19 @@ const validatorSetABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "removeTmpMigratedValidator",
"inputs": [
{
"name": "validator",
"type": "address",
"internalType": "address"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{ {
"type": "function", "type": "function",
"name": "systemRewardRatio", "name": "systemRewardRatio",
@ -3919,7 +3958,7 @@ const slashABI = `
] ]
` `
// TODO: update ABI // TODO: update ABI to the latest version
const stakeABI = ` const stakeABI = `
[ [
{ {
@ -3928,7 +3967,20 @@ const stakeABI = `
}, },
{ {
"type": "function", "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": [], "inputs": [],
"outputs": [ "outputs": [
{ {
@ -3954,7 +4006,7 @@ const stakeABI = `
}, },
{ {
"type": "function", "type": "function",
"name": "INIT_LOCK_AMOUNT", "name": "LOCK_AMOUNT",
"inputs": [], "inputs": [],
"outputs": [ "outputs": [
{ {
@ -3978,6 +4030,19 @@ const stakeABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "STAKING_CHANNELID",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "addToBlackList", "name": "addToBlackList",
@ -4059,6 +4124,44 @@ const stakeABI = `
"outputs": [], "outputs": [],
"stateMutability": "nonpayable" "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", "type": "function",
"name": "createValidator", "name": "createValidator",
@ -4319,44 +4422,6 @@ const stakeABI = `
], ],
"stateMutability": "view" "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", "type": "function",
"name": "getValidatorBasicInfo", "name": "getValidatorBasicInfo",
@ -4565,6 +4630,100 @@ const stakeABI = `
], ],
"stateMutability": "view" "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", "type": "function",
"name": "initialize", "name": "initialize",
@ -4590,7 +4749,7 @@ const stakeABI = `
"name": "maliciousVoteSlash", "name": "maliciousVoteSlash",
"inputs": [ "inputs": [
{ {
"name": "_voteAddr", "name": "voteAddress",
"type": "bytes", "type": "bytes",
"internalType": "bytes" "internalType": "bytes"
} }
@ -4611,6 +4770,19 @@ const stakeABI = `
], ],
"stateMutability": "view" "stateMutability": "view"
}, },
{
"type": "function",
"name": "maxFelonyBetweenBreatheBlock",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{ {
"type": "function", "type": "function",
"name": "minDelegationBNBChange", "name": "minDelegationBNBChange",
@ -4811,6 +4983,44 @@ const stakeABI = `
"outputs": [], "outputs": [],
"stateMutability": "nonpayable" "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", "type": "event",
"name": "Claimed", "name": "Claimed",
@ -4847,7 +5057,7 @@ const stakeABI = `
"internalType": "address" "internalType": "address"
}, },
{ {
"name": "commissionRate", "name": "newCommissionRate",
"type": "uint64", "type": "uint64",
"indexed": false, "indexed": false,
"internalType": "uint64" "internalType": "uint64"
@ -4931,6 +5141,68 @@ const stakeABI = `
], ],
"anonymous": false "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", "type": "event",
"name": "ParamChange", "name": "ParamChange",
@ -5194,11 +5466,35 @@ const stakeABI = `
], ],
"anonymous": false "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", "type": "error",
"name": "AlreadySlashed", "name": "AlreadySlashed",
"inputs": [] "inputs": []
}, },
{
"type": "error",
"name": "ConsensusAddressExpired",
"inputs": []
},
{ {
"type": "error", "type": "error",
"name": "DelegationAmountTooSmall", "name": "DelegationAmountTooSmall",
@ -5209,6 +5505,11 @@ const stakeABI = `
"name": "DuplicateConsensusAddress", "name": "DuplicateConsensusAddress",
"inputs": [] "inputs": []
}, },
{
"type": "error",
"name": "DuplicateMoniker",
"inputs": []
},
{ {
"type": "error", "type": "error",
"name": "DuplicateVoteAddress", "name": "DuplicateVoteAddress",
@ -5239,6 +5540,11 @@ const stakeABI = `
"name": "InvalidRequest", "name": "InvalidRequest",
"inputs": [] "inputs": []
}, },
{
"type": "error",
"name": "InvalidSynPackage",
"inputs": []
},
{ {
"type": "error", "type": "error",
"name": "InvalidValue", "name": "InvalidValue",
@ -5267,7 +5573,7 @@ const stakeABI = `
}, },
{ {
"type": "error", "type": "error",
"name": "NoMoreFelonyToday", "name": "NoMoreFelonyAllowed",
"inputs": [] "inputs": []
}, },
{ {
@ -5357,6 +5663,11 @@ const stakeABI = `
"name": "ValidatorNotJailed", "name": "ValidatorNotJailed",
"inputs": [] "inputs": []
}, },
{
"type": "error",
"name": "VoteAddressExpired",
"inputs": []
},
{ {
"type": "error", "type": "error",
"name": "ZeroShares", "name": "ZeroShares",

@ -18,11 +18,12 @@ import (
"github.com/ethereum/go-ethereum/rpc" "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 = 86400
const SecondsPerDay uint64 = 60 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 { func sameDayInUTC(first, second uint64) bool {
return first/SecondsPerDay == second/SecondsPerDay return first/SecondsPerDay == second/SecondsPerDay
} }

File diff suppressed because one or more lines are too long