this pull request: - creates a unit test that can take any scenario file (default: `out/scenario.json` and play it back on the deployment - during the playback a debug trace generated in `timeSeries.csv` - extracts the sentimenter into a separate upgradeable contract Co-authored-by: JulesCrown <admin@noip.localhost> Co-authored-by: giteadmin <gite@admin.com> Reviewed-on: http://gitea.loseyourip.com:4000/dark-meme-society/harb/pulls/11
173 lines
3.4 KiB
Markdown
173 lines
3.4 KiB
Markdown
## Foundry
|
|
|
|
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
|
|
|
|
Foundry consists of:
|
|
|
|
- **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.
|
|
|
|
## Documentation
|
|
|
|
https://book.getfoundry.sh/
|
|
|
|
## Usage
|
|
|
|
### Install
|
|
|
|
```shell
|
|
$ git clone
|
|
$ git submodule init
|
|
$ git submodule update
|
|
$ cd lib/uni-v3-lib
|
|
$ yarn
|
|
```
|
|
|
|
### Build
|
|
|
|
```shell
|
|
$ forge build
|
|
```
|
|
|
|
### Test
|
|
|
|
```shell
|
|
$ forge test
|
|
```
|
|
|
|
### Format
|
|
|
|
```shell
|
|
$ forge fmt
|
|
```
|
|
|
|
### Gas Snapshots
|
|
|
|
```shell
|
|
$ forge snapshot
|
|
```
|
|
|
|
### Anvil
|
|
|
|
```shell
|
|
$ anvil
|
|
```
|
|
|
|
### Deploy
|
|
|
|
```shell
|
|
forge clean
|
|
forge cache clean
|
|
source .env
|
|
forge script script/Deploy.sol:BaseXDeploy --slow --broadcast --verify --rpc-url ${X_RPC_URL}
|
|
```
|
|
|
|
if verification fails:
|
|
```shell
|
|
forge verify-contract --watch --chain sepolia --constructor-args $(cast abi-encode "constructor(string,string,address,address,address)" "Harberger Tax" "HARB" "0x0227628f3F023bb0B980b67D528571c95c6DaC1c" "0xb16F35c0Ae2912430DAc15764477E179D9B9EbEa" "0x64dda11815b883c589afed914666ef2d63c8c338") 0x7517db0f2b24223f2f0e3567149ca180e204da8a Harb
|
|
|
|
forge verify-contract --watch --chain sepolia --constructor-args $(cast abi-encode "constructor(address)" "0x7517db0f2b24223f2f0e3567149ca180e204da8a") 0x00b4d656b8182d0c2f4841b7a6f1429b94f73a66 Stake
|
|
```
|
|
|
|
|
|
|
|
### Cast
|
|
|
|
```shell
|
|
$ cast <subcommand>
|
|
```
|
|
|
|
### Help
|
|
|
|
```shell
|
|
$ forge --help
|
|
$ anvil --help
|
|
$ cast --help
|
|
```
|
|
|
|
|
|
## Deployment on Sepolia
|
|
|
|
### Harb
|
|
|
|
address: 0x087F256D11fe533b0c7d372e44Ee0F9e47C89dF9
|
|
|
|
[abi](../subgraph/harb/abis/Harb.json)
|
|
|
|
### Stake
|
|
|
|
address: 0xCd21a41a137BCAf8743E47D048F57D92398f7Da9
|
|
|
|
[abi](../subgraph/harb/abis/Stake.json)
|
|
|
|
### LP
|
|
|
|
address: 0xCc7467616bBDB574D04C7e9d2B0982c59F33D43c
|
|
|
|
[abi](../subgraph/harb/abis/BaseLineLP.json)
|
|
|
|
## Deployment on Base Sepolia
|
|
|
|
### Multisig
|
|
|
|
address: 0xf6a3eef9088A255c32b6aD2025f83E57291D9011
|
|
|
|
### Harberg
|
|
|
|
address: 0x54838DC097E7fC4736B801bF1c1FCf1597348265
|
|
|
|
### Stake
|
|
|
|
address: 0xd7728173F73C748944d29EA77b56f09b8FEc8F33
|
|
|
|
### LP
|
|
|
|
address: 0x00E4da809989f40F5D1B31bE6202A5e512db4212
|
|
|
|
|
|
## References
|
|
|
|
open features:
|
|
- reduce snatch collision
|
|
|
|
todos:
|
|
- write unit test for capital exit function
|
|
- would anchorLiquidityShare affect capitalInefficiency?
|
|
- could the UBI pool run dry?
|
|
- what happens if discovery runs out?
|
|
|
|
## Simulation data:
|
|
|
|
```json
|
|
{ "VWAP":0,
|
|
"comEthBal":1234,
|
|
"comHarbBal":0,
|
|
"comStakeShare":0,
|
|
"liquidity":[{
|
|
"liquidity":1234,
|
|
"tickLower":-123,
|
|
"tickUpper":124
|
|
}],
|
|
"startTime":1234,
|
|
"txns":[{
|
|
"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":0,"ethAmount":1,"x":0,"y":""},
|
|
{"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":0,"ethAmount":2,"x":0,"y":""},
|
|
{"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":0,"ethAmount":4,"x":0,"y":""},
|
|
{"action":2,"harbAmount":3000,"tax":10,"y":""},
|
|
{"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":4,"positionId":654321,"x":0,"y":""},
|
|
{"action":2,"harbAmount":5000,"tax":20,"y":""},
|
|
{"action":0,"ethAmount":8,"x":0,"y":""},
|
|
{"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":1,"harbAmount":20000,"x":0,"y":""},
|
|
{"action":5,"timeOffset":0,"x":0,"y":""},
|
|
{"action":4,"positionId":654321,"x":0,"y":""},
|
|
{"action":2,"harbAmount":8000,"tax":29,"y":""}
|
|
]
|
|
}
|
|
```
|