Skip to content

Commit

Permalink
chore: fix bugs and add annotation for error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Dec 8, 2023
1 parent 7b0e0be commit 997e02e
Show file tree
Hide file tree
Showing 24 changed files with 2,287 additions and 97 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ contracts/flattened/*.sol
lib/forge-std/

.env
**/.bak
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ foundryup
forge install --no-git --no-commit foundry-rs/[email protected]
```

Please make sure your dependency version is as follows:

Node: v12.18.3
Install poetry:
```shell script
curl -sSL https://install.python-poetry.org | python3 -
poetry install
```

Tips: You can manage multi version of Node:
```Shell
Expand Down Expand Up @@ -59,20 +61,11 @@ All system contracts will be flattened and output into `${workspace}/contracts/f

## How to generate mainnet/testnet/QA/local genesis file

You may need install some python dependencies firstly.
Save the following content to `requirements.txt` file, and run `pip install -r requirements.txt` to install them.
```txt
Jinja2==3.1.2
typer==0.9.0
```


Then:
```shell
python scripts/generate.py ${network}
poetry run python -m scripts.generate ${network}
```
Check the `genesis.json` file, and you can get the exact compiled bytecode for different network.
(`python scripts/generate.py --help` for more details)
(`poetry run python -m scripts.generate --help ` for more details)

## How to update contract interface for test

Expand Down
62 changes: 62 additions & 0 deletions abi/bscgovernor.abi
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "governorProtector",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "hasVoted",
Expand Down Expand Up @@ -711,6 +724,26 @@
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "pause",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "paused",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "proposalDeadline",
Expand Down Expand Up @@ -1097,6 +1130,13 @@
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "resume",
"inputs": [],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "setLateQuorumVoteExtension",
Expand Down Expand Up @@ -1372,6 +1412,12 @@
],
"anonymous": false
},
{
"type": "event",
"name": "Paused",
"inputs": [],
"anonymous": false
},
{
"type": "event",
"name": "ProposalCanceled",
Expand Down Expand Up @@ -1535,6 +1581,12 @@
],
"anonymous": false
},
{
"type": "event",
"name": "Resumed",
"inputs": [],
"anonymous": false
},
{
"type": "event",
"name": "TimelockChange",
Expand Down Expand Up @@ -1677,6 +1729,11 @@
"name": "Empty",
"inputs": []
},
{
"type": "error",
"name": "GovernorPaused",
"inputs": []
},
{
"type": "error",
"name": "InvalidValue",
Expand All @@ -1703,6 +1760,11 @@
"name": "OnlyCoinbase",
"inputs": []
},
{
"type": "error",
"name": "OnlyGovernorProtector",
"inputs": []
},
{
"type": "error",
"name": "OnlySystemContract",
Expand Down
91 changes: 86 additions & 5 deletions abi/stakecredit.abi
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "claimableUnbondRequest",
"inputs": [
{
"name": "delegator",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "decimals",
Expand Down Expand Up @@ -270,6 +289,11 @@
"name": "delegator",
"type": "address",
"internalType": "address"
},
{
"name": "number",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
Expand All @@ -294,6 +318,44 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "pendingUnbondRequest",
"inputs": [
{
"name": "delegator",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "rewardRecord",
"inputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "slash",
Expand Down Expand Up @@ -339,6 +401,25 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalPooledBNBRecord",
"inputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalSupply",
Expand Down Expand Up @@ -466,11 +547,6 @@
"internalType": "uint256"
}
]
},
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
Expand Down Expand Up @@ -699,6 +775,11 @@
"name": "OutOfBounds",
"inputs": []
},
{
"type": "error",
"name": "RequestExisted",
"inputs": []
},
{
"type": "error",
"name": "TransferFailed",
Expand Down
48 changes: 48 additions & 0 deletions abi/stakehub.abi
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,54 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidatorRewardRecord",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"internalType": "address"
},
{
"name": "dayIndex",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getValidatorTotalPooledBNBRecord",
"inputs": [
{
"name": "operatorAddress",
"type": "address",
"internalType": "address"
},
{
"name": "dayIndex",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "initialize",
Expand Down
37 changes: 37 additions & 0 deletions abi/systemreward.abi
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "MAX_REWARDS_FOR_FINALITY",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "RELAYERHUB_CONTRACT_ADDR",
Expand Down Expand Up @@ -365,6 +378,30 @@
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "claimRewardsforFinality",
"inputs": [
{
"name": "to",
"type": "address",
"internalType": "address payable"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "isOperator",
Expand Down
Loading

0 comments on commit 997e02e

Please sign in to comment.