-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Kelp-DAO/init-asset-module
Asset Module MVP
- Loading branch information
Showing
32 changed files
with
1,062 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DEV_PUB_ADDR=xxx | ||
BSC_SCAN_API_KEY=xxx | ||
BSC_MAINNET_RPC_URL="xxx" | ||
BSC_TESTNET_RPC_URL="xxx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: "CI" | ||
|
||
env: | ||
FOUNDRY_PROFILE: "ci" | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
- "holesky" | ||
- "dev" | ||
|
||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Build the contracts and print their size" | ||
run: "forge build --sizes" | ||
|
||
- name: "Add build summary" | ||
run: | | ||
echo "## Build result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY | ||
test: | ||
needs: ["lint", "build"] | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: "Install Foundry" | ||
uses: "foundry-rs/foundry-toolchain@v1" | ||
|
||
- name: "Show the Foundry config" | ||
run: "forge config" | ||
|
||
- name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance" | ||
run: > | ||
echo "FOUNDRY_FUZZ_SEED=$( | ||
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800)) | ||
)" >> $GITHUB_ENV | ||
- name: "Run the tests" | ||
run: | | ||
forge test" | ||
- name: "Add test summary" | ||
run: | | ||
echo "## Tests result" >> $GITHUB_STEP_SUMMARY | ||
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"solidity.compileUsingRemoteVersion": "v0.8.26", | ||
"editor.formatOnSave": true, | ||
"[solidity]": { | ||
"editor.defaultFormatter": "JuanBlanco.solidity" | ||
}, | ||
"solidity.formatter": "forge" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Code Style | ||
|
||
Please follow the code guidelines here while adding any code. | ||
|
||
- All internal functions should start with a underscore "_" | ||
- Do not use underscores in parameter variables | ||
- In case of conflict between state variable and param, append underscore at the end of param variable eg: `conflictingParamVariable_` | ||
|
||
- Please follow below order for imports | ||
- openzepplin interfaces/contracts | ||
- external protocol libraries | ||
- external protocol interfaces/contracts | ||
- internal libraries | ||
- internal interfaces/contracts | ||
|
||
- Please follow this order in all contracts | ||
- state variables | ||
- modifiers | ||
- constructor | ||
- functions | ||
|
||
- Please follow the order for functions | ||
- constructor, initialize | ||
- receive, fallback | ||
- user/ external protocol interactions | ||
- fund transfer interactions | ||
- operational interactions | ||
- setters | ||
- other write functions | ||
- read functions | ||
- internal and private functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# include .env file and export its env vars | ||
# (-include to ignore error if it does not exist) | ||
# Note that any unset variables here will wipe the variables if they are set in | ||
# .zshrc or .bashrc. Make sure that the variables are set in .env, especially if | ||
# you're running into issues with fork tests | ||
include .env | ||
|
||
# add your private key using below command | ||
# cast wallet import devKey --interactive | ||
|
||
# deploy contracts for kelp june upgrade | ||
deploy-mainnet :; forge script script/deploy/DeployAll.s.sol:DeployAll --rpc-url ${BSC_MAINNET_RPC_URL} --account devKey --sender ${DEV_PUB_ADDR} --broadcast --etherscan-api-key ${BSC_SCAN_API_KEY} --verify -vvv | ||
deploy-testnet :; forge script script/deploy/DeployAll.s.sol:DeployAll --rpc-url ${BSC_TESTNET_RPC_URL} --account devKey --sender ${DEV_PUB_ADDR} --broadcast --etherscan-api-key ${BSC_SCAN_API_KEY} --verify -vvv | ||
deploy-local-test :; forge script script/deploy/DeployAll.s.sol:DeployAll --rpc-url http://127.0.0.1:8545 --account devKey --sender ${DEV_PUB_ADDR} -vvv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,122 @@ | ||
## Foundry | ||
# Kernel | ||
|
||
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** | ||
**Kernel is a restaking platform on Binance Smart Chain.** | ||
|
||
Foundry consists of: | ||
# Getting Started | ||
|
||
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). | ||
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. | ||
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. | ||
- **Chisel**: Fast, utilitarian, and verbose solidity REPL. | ||
## Setup | ||
|
||
## Documentation | ||
Install dependencies | ||
|
||
https://book.getfoundry.sh/ | ||
```bash | ||
forge install | ||
``` | ||
|
||
## Usage | ||
copy .env.example to .env and fill in the values | ||
|
||
## Project Dependencies | ||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
- solidity 0.8.26 | ||
- openzepplin v4 | ||
## Develop | ||
|
||
### Build | ||
This is a list of the most frequently needed commands. | ||
|
||
```shell | ||
$ forge build | ||
### Clean | ||
|
||
Delete the build artifacts and cache directories: | ||
|
||
```sh | ||
$ forge clean | ||
``` | ||
|
||
### Test | ||
### Compile | ||
|
||
```shell | ||
$ forge test | ||
Compile the contracts: | ||
|
||
```sh | ||
$ forge build | ||
``` | ||
|
||
### Format | ||
|
||
```shell | ||
Format the contracts: | ||
|
||
```sh | ||
$ forge fmt | ||
``` | ||
|
||
### Gas Snapshots | ||
### Gas Usage | ||
|
||
Get a gas report: | ||
|
||
```sh | ||
$ forge test --gas-report | ||
``` | ||
|
||
## Test | ||
|
||
Run the tests: | ||
|
||
```shell | ||
$ forge snapshot | ||
```sh | ||
$ forge test | ||
``` | ||
|
||
### Anvil | ||
Generate test coverage and output result to the terminal: | ||
|
||
```shell | ||
$ anvil | ||
```sh | ||
$ forge coverage | ||
``` | ||
|
||
### Deploy | ||
## Deploy | ||
|
||
Check `Makefile` to see a list of deploy commands for different use-cases. | ||
Below are few sample deploy commands. | ||
|
||
### setup | ||
|
||
```shell | ||
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> | ||
import dev private key to cast, this will ask for pvt key and a password | ||
|
||
```bash | ||
cast wallet import devKey --interactive | ||
``` | ||
|
||
### Cast | ||
add the public address of the wallet in `.env` file | ||
|
||
```shell | ||
$ cast <subcommand> | ||
```bash | ||
DEV_PUB_ADDR=xxxx | ||
``` | ||
|
||
### Help | ||
### Deploy to testnet | ||
|
||
```shell | ||
$ forge --help | ||
$ anvil --help | ||
$ cast --help | ||
```bash | ||
make deploy-testnet | ||
``` | ||
|
||
### Deploy to Anvil: | ||
|
||
```bash | ||
anvil --fork-url $BSC_MAINNET_RPC_URL // on terminal 2 | ||
make deploy-local-test // on terminal 1 | ||
``` | ||
|
||
# Deployed Contracts | ||
|
||
## Testnet | ||
|
||
| Role | Address | | ||
| ------- | ------------------------------------------ | | ||
| Admin | 0x0e4B97563723eF7f0a7FDe4c7bD3B17a5bF63fBf | | ||
| Manager | 0x2F4041DccdBCa39c5Cf9Ae408AfC66F9261AaFC7 | | ||
|
||
| Contract Name | Address | | ||
| -------------- | ------------------------------------------ | | ||
| Proxy Admin | 0xFDB18D756400AbD0f106DA9A8a225ed109FDB766 | | ||
| Config | 0x56ae0D2Ea707B93646dF9AAA3bEEAfB0139bFBCa | | ||
| Vault Beacon | 0x24856165A87ce1a3705d1F607a0A3E4B659E7F60 | | ||
| BNBx Vault | 0xb0f4d5E60ACE51E656374A58b821F63DE7062B18 | | ||
| WBNB Vault | 0xd0B91Fc0a323bbb726faAF8867CdB1cA98c44ABB | | ||
| BNBx Oracle | 0xc2Ab86FC74706Ed7148f994627084776a29A637c | | ||
| WBNB Oracle | 0xb32dF5B33dBCCA60437EC17b27842c12bFE83394 | | ||
| Asset Registry | 0xac50155CBE48F3CB0800008f205dB29D1aC01395 | | ||
| Staker Gateway | 0x9ff770Ad4bD0456fCEC05251E62790260327250F | |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.