Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrum release zap tests #50

Closed
wants to merge 76 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b23c488
⚙️ update env example
JaredBorders Jul 24, 2024
2f872c2
🚀 add arbitrum params
JaredBorders Jul 24, 2024
4b71502
✅ update async test
JaredBorders Jul 24, 2024
251ceac
✅ add arbitrum to bootstrap
JaredBorders Jul 24, 2024
70804c9
✅ update import
JaredBorders Jul 24, 2024
55e79dc
⚙️ add abriscan api key
JaredBorders Jul 24, 2024
ce2afd8
🚀 deploy smv3 to arbitrum sepolia
JaredBorders Jul 24, 2024
69bf41e
📸 update lcov
JaredBorders Jul 24, 2024
692dc4e
🚀 update proxy addresses
JaredBorders Jul 31, 2024
28eb0e0
👷🏻‍♂️ add local version of zap
JaredBorders Jul 31, 2024
836466b
🗑️ remove zap gitmodule
JaredBorders Jul 31, 2024
6faa14f
✅ update deployment test
JaredBorders Jul 31, 2024
ecc2c3f
👷🏻‍♂️ wrap immutable setters in try-catch
JaredBorders Jul 31, 2024
85af7a2
🚀 add zap-less deployment
JaredBorders Jul 31, 2024
60427cf
🚀 deploy SMv3 to arbitrum sepolia
JaredBorders Aug 5, 2024
652375b
🚀 deploy new instance of SMv3 to arbitrum sepolia
Flocqst Aug 27, 2024
99e66ce
🚀 deploy new instance of SMv3 to arbitrum
Flocqst Aug 29, 2024
b33395f
👷 Use updated zap contract
Flocqst Sep 13, 2024
95e6283
👷 Update interfaces
Flocqst Sep 13, 2024
7d69349
👷 Update Engine with new Zap contract and functionnalities
Flocqst Sep 13, 2024
cf8bbf3
⚙ change optimizer_runs value
Flocqst Sep 13, 2024
abbc856
✅ adjust to new zap contract
Flocqst Sep 13, 2024
85a6d02
🚀 deploy arbitrum sepolia with updated zap
Flocqst Sep 13, 2024
e82c71e
👷 Add wrapModifyCollateralZap
Flocqst Sep 13, 2024
26cce14
🚀 deploy arbitrum sepolia
Flocqst Sep 13, 2024
6611439
👷 Add zap collateral approval
Flocqst Sep 16, 2024
41f338b
👷 Zap flow approval
Flocqst Sep 16, 2024
3f8c81a
🚀 deploy arbitrum sepolia
Flocqst Sep 16, 2024
7ad5d12
👷 Rename modifyCollateralWrap
Flocqst Sep 18, 2024
fe9e9fa
🚀 deploy arbitrum mainnet test engine
Flocqst Sep 18, 2024
eb3f357
🚀 deploy arbitrum sepolia
Flocqst Sep 19, 2024
f9e8f6f
👷 Add latest Zap contract
Flocqst Sep 25, 2024
f8d373c
👷 Adjust Engine to latest zap contract
Flocqst Sep 25, 2024
642bebf
✅ Adjust to new Engine constructor
Flocqst Sep 25, 2024
8a08a01
👷 latest Zap contract
Flocqst Sep 25, 2024
62e4c07
🚀 deploy arbitrum mainnet test engine
Flocqst Sep 25, 2024
47c7a50
👷 Add payDebt and modifyCollateralETH
Flocqst Sep 25, 2024
9c0675e
✅ Adjust to new Engine constructor
Flocqst Sep 25, 2024
e4707d4
🚀 deploy arbitrum mainnet test engine
Flocqst Sep 25, 2024
f919318
👷 use PERPS_MARKET_PROXY.payDebt
Flocqst Sep 25, 2024
59f59d7
🚀 deploy arbitrum mainnet test engine
Flocqst Sep 25, 2024
816025f
add approval
jcmonte Sep 25, 2024
8b50cd4
remove negative casting as we are doing a withdrawal
jcmonte Sep 25, 2024
2b8989c
👷 pull latest zap contract
Flocqst Sep 26, 2024
9dcfcb0
👷 rename to swapWith
Flocqst Sep 26, 2024
608e46c
🚀 deploy arbitrum mainnet test engine
Flocqst Sep 26, 2024
dcf4178
🚀 deploy arbitrum sepolia
Flocqst Sep 26, 2024
4844f06
👷 fix conversion
Flocqst Sep 26, 2024
c71012f
🚀 deploy test engine on Arbitrum
Flocqst Sep 26, 2024
ed6be07
🚀 deploy arbitrum sepolia
Flocqst Sep 26, 2024
025f268
🚀 Fix WETH addresses on Arb and Arb sepolia
Flocqst Sep 26, 2024
fa36f7e
🚀 deploy arbitrum test engine
Flocqst Sep 26, 2024
6b935c0
👷 use zap.burn to pay debt
Flocqst Sep 26, 2024
6d7baa8
✨ prettify
Flocqst Sep 26, 2024
eebf788
🚀 deploy test engine on arb and arb sepolia
Flocqst Sep 26, 2024
43342c0
👷 set correct allowance for burn
Flocqst Sep 27, 2024
0291364
👷 add depositCollateralETH & withdrawCollateralETH
Flocqst Sep 27, 2024
c3e4b57
🚀 update zap deployment addresses
Flocqst Sep 27, 2024
10be7cf
🚀 deploy test Engine on Arbitrum & Arbitrum sepolia
Flocqst Sep 27, 2024
dba6ce7
✨ prettify
Flocqst Sep 30, 2024
c31ba0d
👷 extract CollateralETH actions to interface
Flocqst Sep 30, 2024
70749d4
👷 pull latest zap
Flocqst Oct 1, 2024
1606302
🚀 Update Zap addresses
Flocqst Oct 1, 2024
85ee168
🚀 Deploy latest arb test engines
Flocqst Oct 1, 2024
90d9cc5
👷 use withdrawTo for withdrawCollateralETH
Flocqst Oct 1, 2024
ac8e673
👷 pull latest Zap contract
Flocqst Oct 2, 2024
76c6478
👷 bump Solidity version to 0.8.27
Flocqst Oct 2, 2024
6b99e65
✅ bump Solidity version to 0.8.27
Flocqst Oct 2, 2024
9261114
🚀 bump Solidity version to 0.8.27
Flocqst Oct 2, 2024
5a4b2ad
bump Solidity version to 0.8.27
Flocqst Oct 2, 2024
04070d9
🚀 update to latest zap deploys
Flocqst Oct 2, 2024
fdfb93f
🚀 deploy arb test engine
Flocqst Oct 2, 2024
986ce93
🚀 deploy arb multicollateral engine
Flocqst Oct 3, 2024
20e3342
fix .env-example change RPL to RPC
cmontecoding Oct 2, 2024
0a77032
change base to arbitrum
cmontecoding Oct 3, 2024
fdf008c
change base to arbitrum in package.json
cmontecoding Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ GOERLI_RPC_URL=https://eth-goerli.g.alchemy.com/v2/KEY
OPTIMISM_GOERLI_RPC_URL=https://opt-goerli.g.alchemy.com/v2/KEY
BASE_GOERLI_RPC_URL=https://base-goerli.g.alchemy.com/v2/KEY
BASE_SEPOLIA_RPC_URL=https://base-sepolia.g.alchemy.com/v2/KEY
PRIVATE_KEY=0xKEY
ARBITRUM_RPC_URL=https://arb-mainnet.g.alchemy.com/v2/KEY
ARBITRUM_SEPOLIA_RPC_URL=https://arb-sepolia.g.alchemy.com/v2/KEY
PRIVATE_KEY=KEY
ETHERSCAN_API_KEY=KEY
OPTIMISM_ETHERSCAN_API_KEY=KEY
BASESCAN_API_KEY=KEY
BASESCAN_API_KEY=KEY
ARBISCAN_API_KEY=KEY
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/zap"]
path = lib/zap
url = https://github.com/JaredBorders/zap
6 changes: 6 additions & 0 deletions deployments/Arbitrum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"EngineImplementation": "0x149042fE4fBb741582125e709378F07b55D3eDF0",
"EngineProxy": "0x2712DeDE1d4Aac904b91D4a2426281A274971b7c",
"TestEngineImplementation": "0x5225dFdC934f9569d2612a082E1F66B16DD5d624",
"TestEngineProxy": "0x51D3F6bE4B8b6476346Fbc3ed8790Ef863af4b77"
}
4 changes: 4 additions & 0 deletions deployments/ArbitrumSepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"EngineImplementation": "0x2211F4d112deF7e433e66e50Bd173803f9563086",
"EngineProxy": "0xaEd5977ed65d340b4B8e58Ec3EC3b04b19308f21"
}
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ src = 'src'
test = 'test/'
out = 'out'
libs = ['lib']
solc_version = "0.8.20"
solc_version = "0.8.27"
optimizer = true
optimizer_runs = 1_000_000
optimizer_runs = 1_000

[fmt]
line_length = 80
Expand Down
146 changes: 84 additions & 62 deletions lcov.info
Original file line number Diff line number Diff line change
@@ -1,39 +1,61 @@
TN:
SF:script/Deploy.s.sol
FN:22,Setup.deploySystem
FNDA:4,Setup.deploySystem
DA:30,103
DA:30,103
DA:40,100
DA:40,100
DA:40,100
DA:43,100
DA:43,100
FN:51,DeployBase_Andromeda.run
FN:113,DeployArbitrumSepolia.run
FNDA:0,DeployArbitrumSepolia.run
DA:114,0
DA:114,0
DA:114,0
DA:115,0
DA:115,0
DA:117,0
DA:117,0
DA:126,0
DA:126,0
FN:92,DeployArbitrum.run
FNDA:0,DeployArbitrum.run
DA:93,0
DA:93,0
DA:93,0
DA:94,0
DA:94,0
DA:96,0
DA:96,0
DA:105,0
DA:105,0
FN:50,DeployBase_Andromeda.run
FNDA:0,DeployBase_Andromeda.run
DA:51,0
DA:51,0
DA:51,0
DA:52,0
DA:52,0
DA:52,0
DA:53,0
DA:53,0
DA:55,0
DA:55,0
DA:64,0
DA:64,0
FN:72,DeployBaseSepolia_Andromeda.run
DA:54,0
DA:54,0
DA:63,0
DA:63,0
FN:71,DeployBaseSepolia_Andromeda.run
FNDA:0,DeployBaseSepolia_Andromeda.run
DA:72,0
DA:72,0
DA:72,0
DA:73,0
DA:73,0
DA:73,0
DA:74,0
DA:74,0
DA:76,0
DA:76,0
DA:85,0
DA:85,0
FNF:3
DA:75,0
DA:75,0
DA:84,0
DA:84,0
FN:21,Setup.deploySystem
FNDA:4,Setup.deploySystem
DA:29,103
DA:29,103
DA:39,100
DA:39,100
DA:39,100
DA:42,100
DA:42,100
FNF:5
FNH:1
LF:11
LF:19
LH:3
BRF:0
BRH:0
Expand All @@ -51,10 +73,6 @@ DA:46,0
DA:46,0
DA:55,0
DA:55,0
FN:19,Setup.deployImplementation
FNDA:0,Setup.deployImplementation
DA:27,0
DA:27,0
FN:63,DeployBaseSepolia_Andromeda.run
FNDA:0,DeployBaseSepolia_Andromeda.run
DA:64,0
Expand All @@ -66,6 +84,10 @@ DA:67,0
DA:67,0
DA:76,0
DA:76,0
FN:19,Setup.deployImplementation
FNDA:0,Setup.deployImplementation
DA:27,0
DA:27,0
FNF:3
FNH:0
LF:9
Expand Down Expand Up @@ -865,23 +887,15 @@ BRH:0
end_of_record
TN:
SF:test/utils/Bootstrap.sol
FN:58,Bootstrap.initializeBase
FN:62,Bootstrap.initializeBase
FNDA:0,Bootstrap.initializeBase
DA:59,99
DA:59,99
DA:59,99
DA:60,99
DA:60,99
DA:69,99
DA:69,99
DA:71,99
DA:71,99
DA:72,99
DA:72,99
DA:63,99
DA:63,99
DA:63,99
DA:64,99
DA:64,99
DA:73,99
DA:73,99
DA:74,99
DA:74,99
DA:75,99
DA:75,99
DA:76,99
Expand All @@ -892,26 +906,34 @@ DA:78,99
DA:78,99
DA:79,99
DA:79,99
DA:80,99
DA:80,99
DA:81,99
DA:81,99
DA:82,99
DA:82,99
DA:83,99
DA:83,99
DA:88,99
DA:88,99
DA:90,99
DA:90,99
FN:95,BootstrapBase.init
DA:85,99
DA:85,99
DA:86,99
DA:86,99
DA:87,99
DA:87,99
DA:92,99
DA:92,99
DA:94,99
DA:94,99
FN:99,BootstrapBase.init
FNDA:99,BootstrapBase.init
DA:108,99
DA:108,99
DA:108,99
DA:117,99
DA:117,99
DA:117,99
DA:126,99
DA:126,99
DA:112,99
DA:112,99
DA:112,99
DA:121,99
DA:121,99
DA:121,99
DA:130,99
DA:130,99
FNF:2
FNH:1
LF:20
Expand Down Expand Up @@ -1082,6 +1104,10 @@ BRH:0
end_of_record
TN:
SF:test/utils/mocks/EIP7412Mock.sol
FN:24,EIP7412MockRevert.fulfillOracleQuery
FNDA:256,EIP7412MockRevert.fulfillOracleQuery
DA:25,256
DA:25,256
FN:9,EIP7412Mock.fulfillOracleQuery
FNDA:769,EIP7412Mock.fulfillOracleQuery
DA:10,769
Expand All @@ -1090,10 +1116,6 @@ BRDA:10,0,0,-
BRDA:10,0,1,769
DA:11,769
DA:11,769
FN:24,EIP7412MockRevert.fulfillOracleQuery
FNDA:256,EIP7412MockRevert.fulfillOracleQuery
DA:25,256
DA:25,256
FN:16,EIP7412MockRefund.fulfillOracleQuery
FNDA:256,EIP7412MockRefund.fulfillOracleQuery
DA:17,256
Expand Down
1 change: 0 additions & 1 deletion lib/zap
Submodule zap deleted from 1886f9
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/Kwenta/smart-margin-v3#readme",
"scripts": {
"compile": "forge build",
"test": "forge test --fork-url $(grep BASE_RPC_URL .env | cut -d '=' -f2) --etherscan-api-key $(grep BASESCAN_API_KEY .env | cut -d '=' -f2) --gas-report -vvv",
"test": "forge test --fork-url $(grep ARBITRUM_RPC_URL .env | cut -d '=' -f2) --etherscan-api-key $(grep ARBISCAN_API_KEY .env | cut -d '=' -f2) --gas-report -vvv",
"test:hh": "npx hardhat test",
"format": "forge fmt",
"coverage": "forge coverage --fork-url $(grep BASE_RPC_URL .env | cut -d '=' -f2)",
Expand Down
47 changes: 25 additions & 22 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.20;
pragma solidity 0.8.27;

// proxy
import {ERC1967Proxy as Proxy} from
"lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol";

// contracts
import {Engine} from "src/Engine.sol";

// parameters
import {BaseParameters} from "script/utils/parameters/BaseParameters.sol";
import {BaseSepoliaParameters} from
"script/utils/parameters/BaseSepoliaParameters.sol";
import {ArbitrumParameters} from
"script/utils/parameters/ArbitrumParameters.sol";
import {ArbitrumSepoliaParameters} from
"script/utils/parameters/ArbitrumSepoliaParameters.sol";

// forge utils
import {Script} from "lib/forge-std/src/Script.sol";
Expand All @@ -24,16 +23,18 @@ contract Setup is Script {
address spotMarketProxy,
address sUSDProxy,
address pDAO,
address zap,
address usdc,
uint128 sUSDCId
address weth
) public returns (Engine engine) {
engine = new Engine({
_perpsMarketProxy: perpsMarketProxy,
_spotMarketProxy: spotMarketProxy,
_sUSDProxy: sUSDProxy,
_pDAO: pDAO,
_zap: zap,
_usdc: usdc,
_sUSDCId: sUSDCId
_weth: weth
});

// deploy ERC1967 proxy and set implementation to engine
Expand All @@ -44,42 +45,44 @@ contract Setup is Script {
}
}

/// @dev steps to deploy and verify on Base:
/// @dev steps to deploy and verify on Arbitrum:
/// (1) load the variables in the .env file via `source .env`
/// (2) run `forge script script/Deploy.s.sol:DeployBase_Andromeda --rpc-url $BASE_RPC_URL --etherscan-api-key $BASESCAN_API_KEY --broadcast --verify -vvvv`
contract DeployBase_Andromeda is Setup, BaseParameters {
/// (2) run `forge script script/Deploy.s.sol:DeployArbitrum --rpc-url $ARBITRUM_RPC_URL --etherscan-api-key $ARBISCAN_API_KEY --broadcast --verify -vvvv`
contract DeployArbitrum is Setup, ArbitrumParameters {
function run() public {
uint256 privateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(privateKey);

Setup.deploySystem({
perpsMarketProxy: PERPS_MARKET_PROXY_ANDROMEDA,
spotMarketProxy: SPOT_MARKET_PROXY_ANDROMEDA,
sUSDProxy: USD_PROXY_ANDROMEDA,
perpsMarketProxy: PERPS_MARKET_PROXY,
spotMarketProxy: SPOT_MARKET_PROXY,
sUSDProxy: USD_PROXY,
pDAO: PDAO,
zap: ZAP,
usdc: USDC,
sUSDCId: SUSDC_SPOT_MARKET_ID
weth: WETH
});

vm.stopBroadcast();
}
}

/// @dev steps to deploy and verify on Base Goerli:
/// @dev steps to deploy and verify on Arbitrum Sepolia:
/// (1) load the variables in the .env file via `source .env`
/// (2) run `forge script script/Deploy.s.sol:DeployBaseSepolia_Andromeda --rpc-url $BASE_SEPOLIA_RPC_URL --etherscan-api-key $BASESCAN_API_KEY --broadcast --verify -vvvv`
contract DeployBaseSepolia_Andromeda is Setup, BaseSepoliaParameters {
/// (2) run `forge script script/Deploy.s.sol:DeployArbitrumSepolia --rpc-url $ARBITRUM_SEPOLIA_RPC_URL --etherscan-api-key $ARBISCAN_API_KEY --broadcast --verify -vvvv`
contract DeployArbitrumSepolia is Setup, ArbitrumSepoliaParameters {
function run() public {
uint256 privateKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(privateKey);

Setup.deploySystem({
perpsMarketProxy: PERPS_MARKET_PROXY_ANDROMEDA,
spotMarketProxy: SPOT_MARKET_PROXY_ANDROMEDA,
sUSDProxy: USD_PROXY_ANDROMEDA,
perpsMarketProxy: PERPS_MARKET_PROXY,
spotMarketProxy: SPOT_MARKET_PROXY,
sUSDProxy: USD_PROXY,
pDAO: PDAO,
zap: ZAP,
usdc: USDC,
sUSDCId: SUSDC_SPOT_MARKET_ID
weth: WETH
});

vm.stopBroadcast();
Expand Down
Loading
Loading