Skip to content

Commit

Permalink
WeEth Market Deployment (#49)
Browse files Browse the repository at this point in the history
* feat: weETH reserve oracle and fork tests

* feat: wstETH per weETH spot oracle and tests

* feat: WeEthHandler

* clean 2

* chore: forge fmt

* Create LICENSE

BUSL License

* update LICENSE

* chore: SPDX-License-Identifiers

* chore: casing

* feat: weETH reserve oracle and fork tests

* feat: wstETH per weETH spot oracle and tests

* forge install: forge-safe

* feat: cli tool to target script and contracts to run

* fix: weETH deployment for YieldOracle
feat: deployment script fork tests

* fix: weETH wstETH spot oracle now uses market price instead of exchange rate for valuing stETH against ETH

* chore: global imports and removed blockNumber setter

* test: test the WeEthHandler

* refactor: generalize UniswapFlashswapDirectMint for any market instance

* docs: document the

* style: rename amountLrt to amountOut

* docs: EtherFi library natspec

* refactor: move REDSTONE_DECIMALS to Constants.sol and make last update time in spot oracle immutable

* fix: replace wstETH with weETH

* feat: deployment script tests

* wip: bash deploy

* feat: single asset deployment tests and ionPool createX deployment

* chore: deployment cleanup and input validation

* feat: multisig action scripts

* feat: refactor deployment scripts with input validation

* feat: multisig action scripts

* fmt: format

* fix: local node deployments scripts

* fix: revert Liquidation changes

* fix: deployment scripts with create3 addresses

* chore: update env.example

* fix: make WeEthIonPoolSharedSetup setUp() virtual

* refactor: rename Liqudation variables

* refactor: __TestFlashswapLeverage script for WeEth market and add gemJoin to output from deploy-sim.sh

* fix: UniswapFlashswapDirectMint should compare maxResultingDebt against input wstEth amount from swap

* fix: UniswapFlashswapDirectMint should compare maxResultingDebt against input wstEth amount from swap

* chore: reduce reserve oracle cooldown to 58 min

* test: fuzz the WeEthHandler

* fix: handle rounding error on EtherFiLibrary

* chore: docs and cleanup

* refactor: make Liquidation contract support IonPool when ilkCount != 3

* feat: add new Pause role for the pause() function and add pausability for the mintAndBurnGem() function

* feat: multisig deployment

* fix: reserve factor input validation

* fix: merge conflict

* Update README.md

* CI checks (#50)

* chore: ci

* fmt: run forge fmt

* chore: link validation in ci

* chore: spell check

* chore: ci for tests and solhint

* fix: solhint ci

* fix: forge test ci

* chore: slither ci and triage

* feat: foundry-storage-check

* fix: remove tests from ci

* chore: add husky hooks

* Update README.md

---------

Co-authored-by: Alex Narvaez-Duckworth <[email protected]>

* fix: solhint and slither

* slither

* fix: spell check

* feat: AdminTransfer script

* feat: deployment script for ion pool implementation

* chore: dry run

* fix: remove arrays from Liquidation constructor args

* fix: slither

* fix: slither

* test: integration tests (#60)

* feat: YieldOracleNull

* feat: YieldOracleNull deployment script

---------

Co-authored-by: Jun Kim <[email protected]>
Co-authored-by: teryanarmen <[email protected]>
Co-authored-by: Alex Narvaez-Duckworth <[email protected]>
  • Loading branch information
4 people authored Feb 23, 2024
1 parent 2c0d7eb commit 701925d
Show file tree
Hide file tree
Showing 114 changed files with 5,060 additions and 1,439 deletions.
Binary file modified .DS_Store
Binary file not shown.
33 changes: 21 additions & 12 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
MAINNET_RPC_URL=https://mainnet.infura.io/v3/
MAINNET_ARCHIVE_RPC_URL=
MAINNET_ETHERSCAN_URL=https://api.etherscan.io/api
ETHERSCAN_API_KEY=

# ETH_FROM and PRIVATE_KEY needs to be specified for Tenderly for node.sh
# Anvil will use default private key and public keys for node.sh
ETH_FROM=
PRIVATE_KEY=
RPC_URL= # http://localhost:8545 for Anvil or custom RPC for Tenderly
# Read from deployment scripts in package.json
SEPOLIA_RPC_URL=
MAINNET_RPC_URL=
TENDERLY_RPC_URL=

# When using Tenderly
TENDERLY_ACCOUNT="ion-protocol"
TENDERLY_PROJECT="money-market-v1"
TENDERLY_API_KEY=
TENDERLY_RID= # the key at the end of the RPC_URL
CHAIN_ID= # custom on Tenderly, defaults to 31337 for localhost:8545
# Used by base script, deploy-sim.sh, deploy-sim requires a public key that matches the salt
ETH_FROM=
PRIVATE_KEY=

# Decides between tenderly or anvil for deploy-sim.sh
DEPLOY_SIM_CHAIN=anvil
TENDERLY_CHAIN_ID=

# Verifying on Tenderly
TENDERLY_RID=
TENDERLY_ACCOUNT=
TENDERLY_PROJECT=
TENDERLY_API_KEY=

# forge-safe
CHAIN=sepolia
WALLET_TYPE=
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ coverage/

# Ignores development broadcast logs
broadcast/*/*
!broadcast/*/1/
!broadcast/*/1/

# Ignores development deployment logs
deployment/*/*/*/
!deployment/*/*/1/

# Dependency directories
node_modules/
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/Vectorized/solady
[submodule "lib/forge-safe"]
path = lib/forge-safe
url = https://github.com/ind-igo/forge-safe
[submodule "lib/solarray"]
path = lib/solarray
url = https://github.com/evmcheb/solarray
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/
package.json
42 changes: 42 additions & 0 deletions broadcast/01_DeployYieldOracle.s.sol/1/dry-run/run-1708314152.json

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions broadcast/01_DeployYieldOracle.s.sol/1/dry-run/run-latest.json

Large diffs are not rendered by default.

114 changes: 114 additions & 0 deletions broadcast/Multisig.s.sol/1/run-1708127691.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"transactions": [
{
"hash": "0xd4f95266511547b6e7173a5a28614ce9a2374641fec79bee3720234bd9f03199",
"transactionType": "CALL",
"contractName": "CreateX",
"contractAddress": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"function": "deployCreate3AndInit(bytes32,bytes,bytes,(uint256,uint256))",
"arguments": [
"0x00000000000000000000000000000000000000000174df2ce43afc1f0124065e",
"0x608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552",
"0xb63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000f48f2b2d2a534e402487b3ee7c18c33aec0fe5e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001d607e4eb747f1294ae632d3490f121b00db93120000000000000000000000000000000000000000000000000000000000000000",
"(0, 0)"
],
"transaction": {
"type": "0x02",
"from": "0x01bd9abd70d74d8ec70d338bd6099ca29da3f9b4",
"to": "0xba5ed099633d3b313e4d5f7bdc1305d3c28ba5ed",
"gas": "0x668cb",
"value": "0x0",
"data": "0x00d84acb00000000000000000000000000000000000000000174df2ce43afc1f0124065e00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000226608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee70955200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000164b63e800d0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000f48f2b2d2a534e402487b3ee7c18c33aec0fe5e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001d607e4eb747f1294ae632d3490f121b00db9312000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0",
"accessList": []
},
"additionalContracts": [
{
"transactionType": "CREATE2",
"address": "0x643c93062156C5A27455FD1777b66CC956138d25",
"initCode": "0x67363d3d37363d34f03d5260086018f3"
},
{
"transactionType": "CREATE",
"address": "0x0000000094f8DCc6E82f08015C4E23E46e7a61F6",
"initCode": "0x608060405234801561001057600080fd5b506040516101e63803806101e68339818101604052602081101561003357600080fd5b8101908080519060200190929190505050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806101c46022913960400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060ab806101196000396000f3fe608060405273ffffffffffffffffffffffffffffffffffffffff600054167fa619486e0000000000000000000000000000000000000000000000000000000060003514156050578060005260206000f35b3660008037600080366000845af43d6000803e60008114156070573d6000fd5b3d6000f3fea2646970667358221220d1429297349653a4918076d650332de1a1068c5f3e07c5c82360c277770b955264736f6c63430007060033496e76616c69642073696e676c65746f6e20616464726573732070726f7669646564000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552000000000000000000000000d9db270c1b5e3bd161e8c8503c55ceabee709552"
}
],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0xd4f95266511547b6e7173a5a28614ce9a2374641fec79bee3720234bd9f03199",
"transactionIndex": "0x157",
"blockHash": "0x61f28b1ad93032b4e2c45bea67cb50a0ed57fdea55ae9260929f22511f83360b",
"blockNumber": "0x125a352",
"from": "0x01bd9aBD70D74D8eC70D338bD6099ca29DA3F9B4",
"to": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"cumulativeGasUsed": "0xb00ff1",
"gasUsed": "0x4a40e",
"contractAddress": null,
"logs": [
{
"address": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"topics": [
"0x2feea65dd4e9f9cbd86b74b7734210c59a1b2981b5b137bd0ee3e208200c9067",
"0x000000000000000000000000643c93062156c5a27455fd1777b66cc956138d25",
"0x1aaab8949631d11fe40dca8b6f6cf1f051bc67219b9a2a8017ea266efdf8977c"
],
"data": "0x",
"blockHash": "0x61f28b1ad93032b4e2c45bea67cb50a0ed57fdea55ae9260929f22511f83360b",
"blockNumber": "0x125a352",
"transactionHash": "0xd4f95266511547b6e7173a5a28614ce9a2374641fec79bee3720234bd9f03199",
"transactionIndex": "0x157",
"logIndex": "0x20",
"removed": false
},
{
"address": "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed",
"topics": [
"0x4db17dd5e4732fb6da34a148104a592783ca119a1e7bb8829eba6cbadef0b511",
"0x0000000000000000000000000000000094f8dcc6e82f08015c4e23e46e7a61f6"
],
"data": "0x",
"blockHash": "0x61f28b1ad93032b4e2c45bea67cb50a0ed57fdea55ae9260929f22511f83360b",
"blockNumber": "0x125a352",
"transactionHash": "0xd4f95266511547b6e7173a5a28614ce9a2374641fec79bee3720234bd9f03199",
"transactionIndex": "0x157",
"logIndex": "0x21",
"removed": false
},
{
"address": "0x0000000094f8DCc6E82f08015C4E23E46e7a61F6",
"topics": [
"0x141df868a6331af528e38c83b7aa03edc19be66e37ae67f9285bf4f8e3c6a1a8",
"0x000000000000000000000000ba5ed099633d3b313e4d5f7bdc1305d3c28ba5ed"
],
"data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f48f2b2d2a534e402487b3ee7c18c33aec0fe5e400000000000000000000000000000000000000000000000000000000000000010000000000000000000000001d607e4eb747f1294ae632d3490f121b00db9312",
"blockHash": "0x61f28b1ad93032b4e2c45bea67cb50a0ed57fdea55ae9260929f22511f83360b",
"blockNumber": "0x125a352",
"transactionHash": "0xd4f95266511547b6e7173a5a28614ce9a2374641fec79bee3720234bd9f03199",
"transactionIndex": "0x157",
"logIndex": "0x22",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x00020000000000000000000000000000000000000000000000040000200400000000000014000000000800000000000000000000000004000000000000000000000000000000000000000000020000000000000000000008000000000000002000000000000000000100000000000000000000000020000000000000000000000000000000000000000800000000000000000000000000000000004000000000000000000000000000000000080000000000000000000000000000000000000000000000010000000640000000000000000020002000000000000000000000000000000000000200000000000000000020000002000020000000000000000000",
"type": "0x2",
"effectiveGasPrice": "0x499f150a0"
}
],
"libraries": [],
"pending": [],
"returns": {
"deployed": {
"internal_type": "address",
"value": "0x0000000094f8DCc6E82f08015C4E23E46e7a61F6"
}
},
"timestamp": 1708127691,
"chain": 1,
"multi": false,
"commit": "0a55342"
}
Loading

0 comments on commit 701925d

Please sign in to comment.