Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core review PR: branch_btclst #56

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ef0a9d8
Support BtcLst staking
falcon2048 May 31, 2024
495bb50
migrate part of BitcoinLSTStake
charles2022wood Jul 8, 2024
30df79e
keep member fields in UserStakeInfo be consistent with core agent
charles2022wood Jul 12, 2024
83290c3
add delegator struct
charles2022wood Jul 12, 2024
12ee2c6
limit transfer or undelegate if the coin is delegated current round
charles2022wood Jul 12, 2024
dd213d6
fix genesis-template
charles2022wood Jul 15, 2024
636a7fc
modify BitcoinLSTStake
falcon2048 Jul 15, 2024
1eab06b
move claimReward into StakeHub
charles2022wood Jul 15, 2024
19eb286
modify returned
falcon2048 Jul 15, 2024
cd9d1a5
set fields public
charles2022wood Jul 15, 2024
a03e747
Fix delegator ref when claimReward
charles2022wood Jul 15, 2024
e388e18
Fix bugs in claimReward in PledgeAgent
charles2022wood Jul 15, 2024
c188189
fix bug
charles2022wood Jul 16, 2024
577c415
fix bug
charles2022wood Jul 16, 2024
45a7f49
fix bug
charles2022wood Jul 16, 2024
03557f6
fix bug
charles2022wood Jul 16, 2024
a52b428
change event
charles2022wood Jul 16, 2024
365f899
fix bug
charles2022wood Jul 17, 2024
19b9f0f
fix bug
charles2022wood Jul 17, 2024
de8e626
add a view function
charles2022wood Jul 17, 2024
923d572
add a view function
charles2022wood Jul 17, 2024
24452f3
fix bug
charles2022wood Jul 17, 2024
302461e
fix bug
charles2022wood Jul 17, 2024
2deb38f
fix bug
charles2022wood Jul 17, 2024
6185ecb
fix bug
charles2022wood Jul 17, 2024
9e9de51
fix bug
charles2022wood Jul 17, 2024
a78615b
fix bug
charles2022wood Jul 17, 2024
c860e8a
separate delegate btctx
charles2022wood Jul 18, 2024
3e0b728
fix bug when claim reward by a contract
charles2022wood Jul 18, 2024
3b91de8
fill btc fee for relayer
charles2022wood Jul 19, 2024
f9de563
regenerate abi
charles2022wood Jul 19, 2024
ee06f62
Add CoreAgent
charles2022wood Jul 19, 2024
c8d5640
update Redeem struct
charles2022wood Jul 19, 2024
a12ecc4
add move data logic from PledgeAgent to CoreAgent
charles2022wood Jul 22, 2024
2ceeaea
no need memory when abi.encodeWithSignature
charles2022wood Jul 22, 2024
5d9e9ce
fix bug
charles2022wood Jul 22, 2024
f23f492
fix bug
charles2022wood Jul 22, 2024
0f29779
fix bug
charles2022wood Jul 22, 2024
4e9c244
fix bug
charles2022wood Jul 23, 2024
5e7fcda
fix bug
charles2022wood Jul 23, 2024
073c3c8
generate abi
charles2022wood Jul 23, 2024
53910f8
fix bug
charles2022wood Jul 23, 2024
0eab1d6
fix bug
charles2022wood Jul 23, 2024
238f535
fix bug
charles2022wood Jul 24, 2024
741759d
optimize code
charles2022wood Jul 24, 2024
06c893a
optimize code
charles2022wood Jul 24, 2024
5c2dce9
fix bug
charles2022wood Jul 24, 2024
1aa5cd6
support dual staking
falcon2048 Jul 19, 2024
c9778f8
fix BitcoinStake
falcon2048 Jul 24, 2024
8fdd24e
fix BitcoinStake
falcon2048 Jul 24, 2024
b9d3e35
fix bug
charles2022wood Jul 24, 2024
e6050fc
fix bug
charles2022wood Jul 24, 2024
1435c4e
support calculate for StakeHub
falcon2048 Jul 24, 2024
e7bdfb7
modify StakeHub
falcon2048 Jul 24, 2024
06ee1de
fix StakeHub
falcon2048 Jul 24, 2024
fadf1bb
add calculateReward methods
charles2022wood Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ build/
pids
logs
.idea/
contracts/.prettierrc
contracts/flattened/*.sol
contracts/artifacts/*.json
.DS_Store
coverage/
coverage.json
coverage.js
abi/Address.abi
abi/BytesLib.abi
abi/BytesToTypes.abi
abi/BitcoinHelper.abi
abi/I*.abi
abi/Memory.abi
abi/Ownable.abi
abi/ReentrancyGuard.abi
abi/RLP*.abi
abi/SafeCast.abi
abi/SafeMath.abi
abi/System.abi
abi/TypedMemView.abi

# test
.pytest_cache
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Core Genesis Contracts

This repo holds all the genesis contracts on Core blockchain, which are part of the core implementations of Satoshi Plus consensus. For more information about Core blockchain and Satoshi Plus consensus, please read the [technical whitepaper](https://docs.coredao.org/core-white-paper-v1.0.5/).
This repo holds all the genesis contracts on Core blockchain, which are part of the core implementations of Satoshi Plus consensus. For more information about Core blockchain and Satoshi Plus consensus, please read the [technical whitepaper](https://whitepaper.coredao.org/core-white-paper-v1.0.7).



Expand Down
1 change: 1 addition & 0 deletions abi/BitcoinAgent.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"MismatchParamLength","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"given","type":"uint256"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"}],"name":"OutOfBounds","type":"error"},{"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":"BTCLST_STAKE_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BTC_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BTC_STAKE_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CANDIDATE_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORE_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FOUNDATION_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOV_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HASH_AGENT_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":"PLEDGE_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLASH_CONTRACT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKE_HUB_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":"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":"candidateMap","outputs":[{"internalType":"uint256","name":"lstStakeAmount","type":"uint256"},{"internalType":"uint256","name":"stakeAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"validators","type":"address[]"},{"internalType":"uint256[]","name":"rewardList","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"candidates","type":"address[]"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"getStakeAmounts","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"totalAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"candidates","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"initHardforkRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"round","type":"uint256"}],"name":"prepare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"validators","type":"address[]"},{"internalType":"uint256","name":"round","type":"uint256"}],"name":"setNewRound","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"}]
1 change: 1 addition & 0 deletions abi/BitcoinLSTStake.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"MismatchParamLength","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"given","type":"uint256"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"}],"name":"OutOfBounds","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_hash","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"_type","type":"uint64"}],"name":"addedWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"txid","type":"bytes32"},{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":false,"internalType":"uint64","name":"amount","type":"uint64"}],"name":"delegated","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":"delegator","type":"address"},{"indexed":false,"internalType":"uint64","name":"amount","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"utxoFee","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"pkscript","type":"bytes"}],"name":"redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_hash","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"_type","type":"uint64"}],"name":"removedWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"txid","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"outputIndex","type":"uint32"},{"indexed":true,"internalType":"address","name":"delegator","type":"address"},{"indexed":false,"internalType":"uint64","name":"amount","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"pkscript","type":"bytes"}],"name":"undelegated","type":"event"},{"inputs":[],"name":"BTCLST_STAKE_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BTC_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BTC_STAKE_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURN_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CANDIDATE_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORE_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FOUNDATION_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOV_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HASH_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INIT_UTXO_FEE","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIGHT_CLIENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLEDGE_AGENT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELAYER_HUB_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SLASH_CONTRACT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKE_HUB_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":"VALIDATOR_CONTRACT_ADDR","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WST_ACTIVE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WST_INACTIVE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_P2PKH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_P2SH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_P2TAPROOT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_P2WPKH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_P2WSH","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WTYPE_UNKNOWN","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"alreadyInit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"btcConfirmBlock","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"btcTxMap","outputs":[{"internalType":"uint64","name":"amount","type":"uint64"},{"internalType":"uint32","name":"outputIndex","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"delegator","type":"address"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"btcTx","type":"bytes"},{"internalType":"uint32","name":"blockHeight","type":"uint32"},{"internalType":"bytes32[]","name":"nodes","type":"bytes32[]"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bytes","name":"script","type":"bytes"}],"name":"delegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"validators","type":"address[]"},{"internalType":"uint256[]","name":"rewardList","type":"uint256[]"}],"name":"distributeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"candidates","type":"address[]"}],"name":"getStakeAmounts","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lstToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"prepare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"amount","type":"uint64"},{"internalType":"bytes","name":"pkscript","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"redeemRequests","outputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint32","name":"addrType","type":"uint32"},{"internalType":"address","name":"delegator","type":"address"},{"internalType":"uint64","name":"amount","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundTag","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256","name":"round","type":"uint256"}],"name":"setNewRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAmount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"btcTx","type":"bytes"},{"internalType":"uint32","name":"blockHeight","type":"uint32"},{"internalType":"bytes32[]","name":"nodes","type":"bytes32[]"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"undelegate","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":"address","name":"","type":"address"}],"name":"userStakeInfo","outputs":[{"internalType":"uint256","name":"changeRound","type":"uint256"},{"internalType":"uint64","name":"totalAmount","type":"uint64"},{"internalType":"uint64","name":"stakedAmount","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"utxoFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wallets","outputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint32","name":"addrType","type":"uint32"},{"internalType":"uint32","name":"status","type":"uint32"}],"stateMutability":"view","type":"function"}]
Loading
Loading