generated from PaulRBerg/foundry-template
-
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.
- Loading branch information
1 parent
6ef0a4e
commit 7282a82
Showing
50 changed files
with
2,650 additions
and
162 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,15 @@ | ||
[submodule "lib/solady"] | ||
path = lib/solady | ||
url = https://github.com/Vectorized/solady | ||
[submodule "lib/openzeppelin-contracts-upgradeable"] | ||
path = lib/openzeppelin-contracts-upgradeable | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable | ||
[submodule "lib/prb-math"] | ||
path = lib/prb-math | ||
url = https://github.com/PaulRBerg/prb-math | ||
[submodule "lib/tenderswap"] | ||
path = lib/tenderswap | ||
url = https://github.com/Tenderize/tenderswap | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/openzeppelin/openzeppelin-contracts |
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,53 +1,39 @@ | ||
# Full reference https://github.com/foundry-rs/foundry/tree/master/crates/config | ||
|
||
[profile.default] | ||
auto_detect_solc = false | ||
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT | ||
bytecode_hash = "none" | ||
evm_version = "paris" # See https://www.evmdiff.com/features?name=PUSH0&kind=opcode | ||
fuzz = { runs = 1_000 } | ||
gas_reports = ["*"] | ||
optimizer = true | ||
optimizer_runs = 10_000 | ||
out = "out" | ||
script = "script" | ||
solc = "0.8.25" | ||
src = "src" | ||
test = "test" | ||
auto_detect_solc = false | ||
block_timestamp = 1_680_220_800 # March 31, 2023 at 00:00 GMT | ||
bytecode_hash = "none" | ||
evm_version = "paris" # See https://www.evmdiff.com/features?name=PUSH0&kind=opcode | ||
fuzz = { runs = 1_000 } | ||
gas_reports = ["*"] | ||
optimizer = true | ||
optimizer_runs = 10_000 | ||
out = "out" | ||
script = "script" | ||
solc = "0.8.25" | ||
src = "src" | ||
test = "test" | ||
|
||
[profile.ci] | ||
fuzz = { runs = 10_000 } | ||
verbosity = 4 | ||
fuzz = { runs = 10_000 } | ||
verbosity = 4 | ||
|
||
[etherscan] | ||
arbitrum = { key = "${API_KEY_ARBISCAN}" } | ||
avalanche = { key = "${API_KEY_SNOWTRACE}" } | ||
bnb_smart_chain = { key = "${API_KEY_BSCSCAN}" } | ||
gnosis_chain = { key = "${API_KEY_GNOSISSCAN}" } | ||
goerli = { key = "${API_KEY_ETHERSCAN}" } | ||
mainnet = { key = "${API_KEY_ETHERSCAN}" } | ||
optimism = { key = "${API_KEY_OPTIMISTIC_ETHERSCAN}" } | ||
polygon = { key = "${API_KEY_POLYGONSCAN}" } | ||
sepolia = { key = "${API_KEY_ETHERSCAN}" } | ||
mainnet = { key = "${API_KEY_ETHERSCAN}" } | ||
arbitrum = { key = "${API_KEY_ARBISCAN}" } | ||
|
||
[fmt] | ||
bracket_spacing = true | ||
int_types = "long" | ||
line_length = 120 | ||
multiline_func_header = "all" | ||
number_underscore = "thousands" | ||
quote_style = "double" | ||
tab_width = 4 | ||
wrap_comments = true | ||
bracket_spacing = true | ||
int_types = "long" | ||
line_length = 120 | ||
multiline_func_header = "all" | ||
number_underscore = "thousands" | ||
quote_style = "double" | ||
tab_width = 4 | ||
wrap_comments = true | ||
|
||
[rpc_endpoints] | ||
arbitrum = "https://arbitrum-mainnet.infura.io/v3/${API_KEY_INFURA}" | ||
avalanche = "https://avalanche-mainnet.infura.io/v3/${API_KEY_INFURA}" | ||
bnb_smart_chain = "https://bsc-dataseed.binance.org" | ||
gnosis_chain = "https://rpc.gnosischain.com" | ||
goerli = "https://goerli.infura.io/v3/${API_KEY_INFURA}" | ||
localhost = "http://localhost:8545" | ||
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${API_KEY_ALCHEMY}" | ||
optimism = "https://optimism-mainnet.infura.io/v3/${API_KEY_INFURA}" | ||
polygon = "https://polygon-mainnet.infura.io/v3/${API_KEY_INFURA}" | ||
sepolia = "https://sepolia.infura.io/v3/${API_KEY_INFURA}" | ||
mainnet = "https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}" | ||
arbitrum = "https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}" | ||
sepolia = "https://sepolia-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}" |
Submodule openzeppelin-contracts
added at
dbb610
Submodule openzeppelin-contracts-upgradeable
added at
723f8c
Submodule tenderswap
added at
8b1e34
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,2 +1,9 @@ | ||
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ | ||
forge-std/=node_modules/forge-std/ | ||
forge-std/=node_modules/forge-std/src | ||
@=src/ | ||
@test=test/ | ||
@openzeppelin/upgradeable=lib/openzeppelin-contracts-upgradeable/contracts | ||
@openzeppelin/contracts=lib/openzeppelin-contracts/contracts | ||
@solady/=lib/solady/src/ | ||
@prb/math/=lib/prb-math/src/ | ||
@tenderswap=lib/tenderswap/src | ||
@solmate=lib/solmate/src |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
pragma solidity >=0.8.20; | ||
|
||
import { Script, console2 } from "forge-std/Script.sol"; | ||
import { Registry } from "@/Registry.sol"; | ||
import { UnsETH } from "@/unsETH/UnsETH.sol"; | ||
import { Renderer } from "@/unsETH/Renderer.sol"; | ||
import { LPETH } from "@/LPETH.sol"; | ||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import { ERC20 } from "solady/tokens/ERC20.sol"; | ||
|
||
contract DeployLocal is Script { | ||
bytes32 salt = bytes32(uint256(1)); | ||
|
||
function run() public { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(deployerPrivateKey); | ||
address swap = 0xB5A53938316E4a02c0d91F1b454E43583429e347; | ||
|
||
LPETH(payable(swap)).deposit{ value: 5000 ether }(0); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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,39 @@ | ||
pragma solidity >=0.8.20; | ||
|
||
import { Script, console2 } from "forge-std/Script.sol"; | ||
import { UnsETH } from "@/unsETH/UnsETH.sol"; | ||
import { Renderer } from "@/unsETH/Renderer.sol"; | ||
import { LPETH } from "@/LPETH.sol"; | ||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
import { ERC20 } from "solady/tokens/ERC20.sol"; | ||
|
||
// Adapters | ||
import { Adapter } from "@/adapters/Adapter.sol"; | ||
import { EETHAdapter, EETH_TOKEN } from "@/adapters/eETH/EETHAdapter.sol"; | ||
import { ETHxAdapter, ETHx_TOKEN } from "@/adapters/ETHx/ETHxAdapter.sol"; | ||
import { METHAdapter, METH_TOKEN } from "@/adapters/mETH/METHAdapter.sol"; | ||
import { StETHAdapter, STETH_TOKEN } from "@/adapters/stETH/StETHAdapter.sol"; | ||
import { SwETHAdapter, SWETH_TOKEN } from "@/adapters/swETH/SwETHAdapter.sol"; | ||
|
||
// Token holders, to get some funds | ||
import { EETH_HOLDER } from "@test/adapters/EETHAdapter.t.sol"; | ||
import { ETHx_HOLDER } from "@test/adapters/ETHxAdapter.t.sol"; | ||
import { METH_HOLDER } from "@test/adapters/METHAdapter.t.sol"; | ||
import { STETH_HOLDER } from "@test/adapters/StETHAdapter.t.sol"; | ||
import { SWETH_HOLDER } from "@test/adapters/SwETHAdapter.t.sol"; | ||
|
||
contract DeployLocal is Script { | ||
bytes32 salt = bytes32(uint256(1)); | ||
|
||
function run() public { | ||
address me = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266; | ||
|
||
console2.log("balance", ERC20(EETH_TOKEN).balanceOf(me)); | ||
|
||
console2.log("balance", ERC20(EETH_TOKEN).balanceOf(me)); | ||
|
||
console2.log("balance", ERC20(EETH_TOKEN).balanceOf(me)); | ||
|
||
console2.log("balance", ERC20(EETH_TOKEN).balanceOf(me)); | ||
} | ||
} |
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,83 @@ | ||
// pragma solidity >=0.8.20; | ||
|
||
// import { Script, console2 } from "forge-std/Script.sol"; | ||
// import { Registry } from "@/Registry.sol"; | ||
// import { UnsETH } from "@/unsETH/UnsETH.sol"; | ||
// import { Renderer } from "@/unsETH/Renderer.sol"; | ||
// import { LPETH, ConstructorConfig } from "@/LPETH.sol"; | ||
// import { LPToken } from "@/LPToken.sol"; | ||
// import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
// import { ERC20 } from "solady/tokens/ERC20.sol"; | ||
|
||
// // Adapters | ||
// import { Adapter } from "@/adapters/Adapter.sol"; | ||
// import { EETHAdapter, EETH_TOKEN } from "@/adapters/eETH/EETHAdapter.sol"; | ||
// import { ETHxAdapter, ETHx_TOKEN } from "@/adapters/ETHx/ETHxAdapter.sol"; | ||
// import { METHAdapter, METH_TOKEN } from "@/adapters/mETH/METHAdapter.sol"; | ||
// import { StETHAdapter, STETH_TOKEN } from "@/adapters/stETH/StETHAdapter.sol"; | ||
// import { SwETHAdapter, SWETH_TOKEN } from "@/adapters/swETH/SwETHAdapter.sol"; | ||
|
||
// // Token holders, to get some funds | ||
// import { EETH_HOLDER } from "@test/adapters/EETHAdapter.t.sol"; | ||
// import { ETHx_HOLDER } from "@test/adapters/ETHxAdapter.t.sol"; | ||
// import { METH_HOLDER } from "@test/adapters/METHAdapter.t.sol"; | ||
// import { STETH_HOLDER } from "@test/adapters/StETHAdapter.t.sol"; | ||
// import { SWETH_HOLDER } from "@test/adapters/SwETHAdapter.t.sol"; | ||
|
||
// contract DeployLocal is Script { | ||
// bytes32 salt = bytes32(uint256(1)); | ||
|
||
// function run() public { | ||
// uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
// vm.startBroadcast(deployerPrivateKey); | ||
|
||
// LPToken lpToken = new LPToken(); | ||
|
||
// address registry_impl = address(new Registry{ salt: salt }()); | ||
// Registry registryProxy = Registry(address(new ERC1967Proxy{ salt: salt }(address(registry_impl), ""))); | ||
// registryProxy.initialize(); | ||
// console2.log("Registry Implementation: %s", registry_impl); | ||
// console2.log("Registry Proxy: %s", address(registryProxy)); | ||
|
||
// address renderer = address(new Renderer()); | ||
// address unsETH_impl = address(new UnsETH{ salt: salt }(address(registryProxy), renderer)); | ||
// UnsETH unsETHProxy = UnsETH(payable(address(new ERC1967Proxy{ salt: salt }(unsETH_impl, "")))); | ||
// unsETHProxy.initialize(); | ||
// console2.log("UnsETH Implementation: %s", unsETH_impl); | ||
// console2.log("UnsETH Proxy: %s", address(unsETHProxy)); | ||
|
||
// ConstructorConfig memory config = ConstructorConfig({ | ||
// registry: registryProxy, | ||
// lpToken: lpToken, | ||
// treasury: address(0), | ||
// unsETH: address(unsETHProxy), | ||
// withdrawQueue: address(0) | ||
// }); | ||
|
||
// address lpETH_impl = address(new LPETH{ salt: salt }()); | ||
// LPETH lpETHProxy = LPETH(payable(address(new ERC1967Proxy{ salt: salt }(lpETH_impl, "")))); | ||
// lpETHProxy.initialize(); | ||
// console2.log("LPETH Implementation: %s", lpETH_impl); | ||
// console2.log("LPETH Proxy: %s", address(lpETHProxy)); | ||
// console2.log("LP Token: %s", address(lpETHProxy.lpToken())); | ||
|
||
// // Register and deploy adapters, send some funds | ||
// Adapter eETHAdapter = new EETHAdapter(); | ||
// registryProxy.setAdapter(EETH_TOKEN, eETHAdapter); | ||
// console2.log("EETH Adapter: %s", address(eETHAdapter)); | ||
|
||
// Adapter ethxAdapter = new ETHxAdapter(); | ||
// registryProxy.setAdapter(ETHx_TOKEN, ethxAdapter); | ||
// console2.log("ETHx Adapter: %s", address(ethxAdapter)); | ||
|
||
// Adapter methAdapter = new METHAdapter(); | ||
// registryProxy.setAdapter(METH_TOKEN, methAdapter); | ||
// console2.log("METH Adapter: %s", address(methAdapter)); | ||
|
||
// Adapter stETHAdapter = new StETHAdapter(); | ||
// registryProxy.setAdapter(STETH_TOKEN, stETHAdapter); | ||
// console2.log("StETH Adapter: %s", address(stETHAdapter)); | ||
|
||
// vm.stopBroadcast(); | ||
// } | ||
// } |
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,17 @@ | ||
#!/bin/bash | ||
set -x | ||
source .env | ||
|
||
nohup bash -c "anvil --fork-url ${MAINNET_RPC} --fork-block-number 19847895 --chain-id 1337 &" >/dev/null 2>&1 && sleep 5 | ||
|
||
forge build | ||
|
||
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","id":67,"method":"anvil_setCode","params": ["0x4e59b44847b379578588920ca78fbf26c0b4956c","0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3"]}' 127.0.0.1:8545 | ||
|
||
export PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | ||
|
||
forge script script/deploy.local.s.sol --rpc-url http://127.0.0.1:8545 --broadcast --private-key $PRIVATE_KEY -vvvv | ||
forge script script/add_liq.s.sol --rpc-url http://127.0.0.1:8545 --broadcast --private-key $PRIVATE_KEY | ||
read -r -d '' _ </dev/tty | ||
echo "Closing Down Anvil" | ||
pkill -9 anvil |
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,26 @@ | ||
# This calls Anvil and lets us impersonate our unlucky user | ||
ME=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
|
||
# EETH | ||
UNLUCKY_USER=0x22162DbBa43fE0477cdC5234E248264eC7C6EA7c; | ||
TOKEN=0x35fA164735182de50811E8e2E824cFb9B6118ac2 | ||
AMOUNT=100000000000000000000 | ||
cast rpc anvil_impersonateAccount $UNLUCKY_USER | ||
cast send $TOKEN \ | ||
--from $UNLUCKY_USER \ | ||
"transfer(address,uint256)(bool)" \ | ||
$ME \ | ||
$AMOUNT \ | ||
--unlocked | ||
|
||
# SWETEH | ||
# UNLUCKY_USER=0x38D43a6Cb8DA0E855A42fB6b0733A0498531d774; | ||
# TOKEN=0xf951E335afb289353dc249e82926178EaC7DEd78 | ||
# AMOUNT=800000000000000000000 | ||
# cast rpc anvil_impersonateAccount $UNLUCKY_USER | ||
# cast send $TOKEN \ | ||
# --from $UNLUCKY_USER \ | ||
# "transfer(address,uint256)(bool)" \ | ||
# $ME \ | ||
# $AMOUNT \ | ||
# --unlocked |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.