166 lines
No EOL
4.4 KiB
Markdown
166 lines
No EOL
4.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:SepoliaScript --slow --broadcast --verify --rpc-url ${SEPOLIA_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)
|
|
|
|
|
|
## References
|
|
|
|
- take percentage math from here: https://github.com/attestate/libharberger/tree/master
|
|
- implement this ERC for Harb: https://eips.ethereum.org/EIPS/eip-4907
|
|
- TaxHouse contract - erc721 owner - 20% of supply
|
|
- implement auction model with tax
|
|
- instrument holder is user in ERC4907
|
|
- 5% of supply founder and influencers
|
|
- direct ERC721 ownernership
|
|
- add this function: https://github.com/721labs/partial-common-ownership/blob/3e7713bc60b6bb2e103320036ec5aeaaaceb7d2b/contracts/token/modules/Taxation.sol#L260
|
|
- address this issue: "Seems like an owner could always frontrun buy attempts by increasing the valuation by one wei."
|
|
- rename TAX_FLOOR_DURATION to cooldown?
|
|
- limit discovery position growth to max_issuance / day
|
|
|
|
open features:
|
|
- token minting limit / limit on discovery position growth
|
|
- ERC721 & ERC4907, user/owner separation, influencer incentives
|
|
- token contract not visible in uniswap sepolia
|
|
- snatch collision
|
|
- previousTotalSupply at beginning?
|
|
- profit for staking position
|
|
- tax paid for staking position
|
|
- partially snatched
|
|
- liquidation bot
|
|
- shift/slide bot
|
|
- ubi claim bot
|
|
- deployment on L2
|
|
- make minStake a gov param
|
|
- prep for audit
|
|
- clean up TODOs
|
|
- clean up magic numbers
|
|
- coverage
|
|
- overflows
|
|
- reentry
|
|
- definition of severity and rewards
|
|
- Minor: Results in some unexpected or undesired behavior or disrupts a system function, causing at least minor loss of funds for user or Liquidity Manager. - reward 0.5% share of fees
|
|
- Major: Bug capable of creating a severe loss of funds for HARB holders or collapsing large parts of the system - reward: 2% share of fees
|
|
- Critical: Bug capable of triggering severe loss of funds for LiquidityManager contract or complete shutdown in Harb/Stake/LiquidityManager contracts - reward: 5%
|
|
- limitations: max 10% share of fees, no seat in multisig
|
|
- HARB
|
|
- mint - limit supply to 2^96?
|
|
- Stake
|
|
- sharesToAssets - should the average total supply be used for this calculation?
|
|
- what if someone calls payTax and exitPosition in the same transaction?
|
|
-
|
|
- LiquidityManager
|
|
- add events
|
|
- what to do with stuck funds if slide/shift become inoperable?
|
|
- _isPriceStable - // Handle try catch, possibly by trying with a different time interval or providing a default response
|
|
|
|
|
|
|
|
- find a way to account harb/eth for attacker
|
|
- NFT support of etherscan
|
|
https://etherscan.io/nft/0xe12edaab53023c75473a5a011bdb729ee73545e8/4218 |