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

Integrate PufferVault #158

Merged
merged 32 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d57ffa1
code style + bugfix
bxmmm1 Dec 21, 2023
b51c6f6
update snapshot
bxmmm1 Dec 21, 2023
9ffbf5d
linter
bxmmm1 Dec 21, 2023
6c517f1
rename function
bxmmm1 Dec 21, 2023
4b2e629
reduce update interval for reserves to 12h
bxmmm1 Dec 21, 2023
16e2683
Update upgradeProtocol script
bxmmm1 Dec 21, 2023
ea0a8de
smoothing commitment fix
bxmmm1 Jan 11, 2024
c0fbf7e
integrate pufETH
bxmmm1 Jan 24, 2024
e38585e
Validator Tickets (#159)
CheyenneAtapour Jan 25, 2024
440dd4a
add VT to the protocol
bxmmm1 Jan 29, 2024
4ff768b
add burn
bxmmm1 Jan 29, 2024
625a787
VT refactoring in progress
bxmmm1 Jan 30, 2024
e7f7763
ci
bxmmm1 Jan 31, 2024
32bc784
submodule update
bxmmm1 Jan 31, 2024
9cb5763
update branch
bxmmm1 Jan 31, 2024
abbb700
wip
bxmmm1 Feb 2, 2024
6638b36
more refactoring
bxmmm1 Feb 5, 2024
b39ba8f
remove 2 unused pools
bxmmm1 Feb 6, 2024
15e918b
refactor validator registration, deployment scripts
bxmmm1 Feb 6, 2024
2918640
upscale the amounts for VT
bxmmm1 Feb 6, 2024
d058803
PufferProtocol weight loss
bxmmm1 Feb 7, 2024
81cf7a5
PR comments
bxmmm1 Feb 8, 2024
036dd5c
public access for some restricted functions
bxmmm1 Feb 8, 2024
2ec69df
slither false positives
bxmmm1 Feb 8, 2024
4068e8a
VT Accounting (#166)
bxmmm1 Feb 16, 2024
cdb7d40
Proof of Rewards Interface Change (#164)
CheyenneAtapour Feb 16, 2024
624abcc
update submodule
bxmmm1 Feb 16, 2024
c85c31b
Merge branch 'pufETH' of github.com:PufferFinance/PufferPool into pufETH
bxmmm1 Feb 16, 2024
90ba56d
formatting, solhint
bxmmm1 Feb 16, 2024
42fcf65
update submodule
bxmmm1 Feb 16, 2024
2225e28
change submodule to use https
bxmmm1 Feb 16, 2024
2f6e62a
Bugfix retreive bond (#170)
bxmmm1 Feb 20, 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
137 changes: 69 additions & 68 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,95 @@ EnclaveVerifierTest:testRaveEvidence3() (gas: 901150)
EnclaveVerifierTest:testRemoveLeafX509() (gas: 200998)
EnclaveVerifierTest:testSetup() (gas: 89268)
EnclaveVerifierTest:testVerifyingStaleEvidence() (gas: 739311)
GuardianModuleTest:testAddGuardian(address) (runs: 256, μ: 133546, ~: 133546)
GuardianModuleTest:testChangeThreshold() (gas: 35408)
GuardianModuleTest:testChangeThresholdReverts() (gas: 27725)
GuardianModuleTest:testAddGuardian(address) (runs: 256, μ: 133524, ~: 133524)
GuardianModuleTest:testChangeThreshold() (gas: 35386)
GuardianModuleTest:testChangeThresholdReverts() (gas: 27703)
GuardianModuleTest:testPostWithdrawalsRootReverts(address[],uint256[]) (runs: 256, μ: 84793, ~: 86424)
GuardianModuleTest:testRave() (gas: 69851395)
GuardianModuleTest:testRemoveGuardian(address) (runs: 256, μ: 113417, ~: 113402)
GuardianModuleTest:testRave() (gas: 69921368)
GuardianModuleTest:testRemoveGuardian(address) (runs: 256, μ: 113383, ~: 113367)
GuardianModuleTest:testRotateGuardianKeyFromNonGuardianReverts() (gas: 12201)
GuardianModuleTest:testRotateGuardianKeyWithInvalidRaveReverts() (gas: 843560)
GuardianModuleTest:testRotateGuardianToInvalidPubKeyReverts() (gas: 14683)
GuardianModuleTest:testSplitFunds() (gas: 125793)
GuardianModuleTest:testSplitFundsRounding() (gas: 130017)
GuardianModuleTest:testValidateSkipProvisioningReverts() (gas: 29704)
NoRestakingModuleTest:testClaimingMultipleProofs() (gas: 250743)
NoRestakingModuleTest:testCollectRewards() (gas: 255017)
NoRestakingModuleTest:testClaimingMultipleProofs() (gas: 250743)
NoRestakingModuleTest:testCollectRewards() (gas: 255017)
LibBeaconChainTest:testUpdatedVersion(bytes32) (runs: 256, μ: 24088, ~: 24088)
NoRestakingModuleTest:testClaimingMultipleProofs() (gas: 250655)
NoRestakingModuleTest:testCollectRewards() (gas: 254929)
NoRestakingModuleTest:testCollectRewardsRevertsForZeroValues() (gas: 28228)
NoRestakingModuleTest:testDonation() (gas: 11855)
NoRestakingModuleTest:testDoubleClaimInSameTransaction() (gas: 196261)
NoRestakingModuleTest:testPostRewardsRoot(bytes32,uint256) (runs: 256, μ: 103892, ~: 103892)
NoRestakingModuleTest:testPostRewardsRootReverts(address,bytes32,uint256) (runs: 256, μ: 42051, ~: 42585)
NoRestakingModuleTest:testPostingRewardsForSameBlockReverts() (gas: 106293)
NoRestakingModuleTest:testRewardsClaimingForAnotherUser(address) (runs: 256, μ: 264137, ~: 264245)
NoRestakingModuleTest:testDoubleClaimInSameTransaction() (gas: 196173)
NoRestakingModuleTest:testPostRewardsRoot(bytes32,uint256) (runs: 256, μ: 103848, ~: 103848)
NoRestakingModuleTest:testPostRewardsRootReverts(address,bytes32,uint256) (runs: 256, μ: 41986, ~: 42519)
NoRestakingModuleTest:testPostingRewardsForSameBlockReverts() (gas: 106249)
NoRestakingModuleTest:testRewardsClaimingForAnotherUser(address) (runs: 256, μ: 264135, ~: 264135)
NoRestakingModuleTest:testSetup() (gas: 16008)
PufferModuleTest:testBeaconUpgrade() (gas: 379702)
PufferModuleTest:testCollectNoRestakingRewards(bytes32) (runs: 256, μ: 1223217, ~: 1223217)
PufferModuleTest:testCollectNoRestakingRewards(bytes32) (runs: 256, μ: 1223173, ~: 1223173)
PufferModuleTest:testCreatePufferModule(bytes32) (runs: 256, μ: 303410, ~: 303410)
PufferModuleTest:testDonation(bytes32) (runs: 256, μ: 309589, ~: 309589)
PufferModuleTest:testPostRewardsRoot(bytes32,uint256) (runs: 256, μ: 395216, ~: 395216)
PufferModuleTest:testPostRewardsRootReverts(bytes32,address,bytes32,uint256) (runs: 256, μ: 328211, ~: 328900)
PufferModuleTest:testPostRewardsRoot(bytes32,uint256) (runs: 256, μ: 395172, ~: 395172)
PufferModuleTest:testPostRewardsRootReverts(bytes32,address,bytes32,uint256) (runs: 256, μ: 328147, ~: 328834)
PufferPoolIntegrationTest:testMulticallStrategyDepositOnGoerli() (gas: 302738)
PufferPoolTest:testBurn(address) (runs: 256, μ: 104774, ~: 104758)
PufferPoolTest:testDeposit(address,uint256) (runs: 256, μ: 145087, ~: 145207)
PufferPoolTest:testDepositAndRedeemRoundingError(address,uint256) (runs: 256, μ: 189766, ~: 189824)
PufferPoolTest:testDepositAndRedeemRoundingErrorForDifferentExchangeRate(address,uint256) (runs: 256, μ: 323869, ~: 323986)
PufferPoolTest:testBurn(address) (runs: 256, μ: 104773, ~: 104758)
PufferPoolTest:testDeposit(address,uint256) (runs: 256, μ: 145055, ~: 145172)
PufferPoolTest:testDepositAndRedeemRoundingError(address,uint256) (runs: 256, μ: 189737, ~: 189797)
PufferPoolTest:testDepositAndRedeemRoundingErrorForDifferentExchangeRate(address,uint256) (runs: 256, μ: 323830, ~: 323947)
PufferPoolTest:testDepositForOneWei() (gas: 89277)
PufferPoolTest:testMintZero() (gas: 20152)
PufferPoolTest:testMultipleDeposits() (gas: 138195)
PufferPoolTest:testRatioChange() (gas: 230870)
PufferPoolTest:testRatioChangeSandwichAttack(uint256,uint256) (runs: 256, μ: 207776, ~: 207954)
PufferPoolTest:testRatioChange() (gas: 230866)
PufferPoolTest:testRatioChangeSandwichAttack(uint256,uint256) (runs: 256, μ: 207753, ~: 207919)
PufferPoolTest:testRecoverERC20() (gas: 516930)
PufferPoolTest:testSetup() (gas: 32675)
PufferPoolTest:testStorageS() (gas: 19397)
PufferProtocolInvariants:invariant_callSummary() (runs: 100, calls: 11000, reverts: 1)
PufferProtocolInvariants:invariant_callSummary() (runs: 100, calls: 11000, reverts: 0)
PufferProtocolInvariants:invariant_pufEthToETHRate() (runs: 100, calls: 11000, reverts: 0)
PufferProtocolInvariants:invariant_pufferPoolETHCanOnlyGoUp() (runs: 100, calls: 11000, reverts: 9)
PufferProtocolInvariants:invariant_pufferProtocolBond() (runs: 100, calls: 11000, reverts: 0)
PufferProtocolTest:testBurstThreshold() (gas: 542477)
PufferProtocolTest:testChangeModule() (gas: 30532)
PufferProtocolTest:testChangeModuleToCustom() (gas: 51226)
PufferProtocolTest:testClaimBackBond() (gas: 2306577)
PufferProtocolTest:testClaimBackBondForSingleWithdrawal() (gas: 1181426)
PufferProtocolTest:testCreateExistingModuleShouldFail() (gas: 33461)
PufferProtocolTest:testCreatePufferModule() (gas: 298009)
PufferProtocolTest:testEmptyQueue() (gas: 32549)
PufferProtocolTest:testExtendCommitment() (gas: 527638)
PufferProtocolTest:testFeeCalculations() (gas: 134767)
PufferProtocolTest:testFeeCalculationsEverythingToPufferPool() (gas: 145527)
PufferProtocolTest:testFeeCalculationsEverythingToWithdrawalPool() (gas: 147361)
PufferProtocolTest:testFuzzRegisterManyValidators(uint8) (runs: 256, μ: 26842065, ~: 14413412)
PufferProtocolTest:testGetPayload() (gas: 143359)
PufferProtocolTest:testModuleDOS() (gas: 3640730)
PufferProtocolTest:testPause() (gas: 135124)
PufferProtocolTest:testProofOfReserve() (gas: 176869)
PufferProtocolTest:testProvisionNode() (gas: 3841718)
PufferProtocolTest:testProvisioning() (gas: 61529)
PufferProtocolInvariants:invariant_pufferPoolETHCanOnlyGoUp() (runs: 100, calls: 11000, reverts: 0)
PufferProtocolInvariants:invariant_pufferProtocolBond() (runs: 100, calls: 11000, reverts: 3)
PufferProtocolTest:testBurstThreshold() (gas: 542429)
PufferProtocolTest:testChangeModule() (gas: 30488)
PufferProtocolTest:testChangeModuleToCustom() (gas: 51182)
PufferProtocolTest:testClaimBackBond() (gas: 2306995)
PufferProtocolTest:testClaimBackBondForSingleWithdrawal() (gas: 1181519)
PufferProtocolTest:testCreateExistingModuleShouldFail() (gas: 33439)
PufferProtocolTest:testCreatePufferModule() (gas: 297987)
PufferProtocolTest:testEmptyQueue() (gas: 32527)
PufferProtocolTest:testExtendCommitment() (gas: 527528)
PufferProtocolTest:testFeeCalculations() (gas: 134657)
PufferProtocolTest:testFeeCalculationsEverythingToPufferPool() (gas: 145417)
PufferProtocolTest:testFeeCalculationsEverythingToWithdrawalPool() (gas: 147229)
PufferProtocolTest:testFuzzRegisterManyValidators(uint8) (runs: 256, μ: 25827721, ~: 14412279)
PufferProtocolTest:testGetPayload() (gas: 143448)
PufferProtocolTest:testModuleDOS() (gas: 3640642)
PufferProtocolTest:testPause() (gas: 135102)
PufferProtocolTest:testProofOfReserve() (gas: 176865)
PufferProtocolTest:testProvisionNode() (gas: 3842249)
PufferProtocolTest:testProvisioning() (gas: 61485)
PufferProtocolTest:testRegisterInvalidPrivKeyShares() (gas: 77957)
PufferProtocolTest:testRegisterInvalidPubKeyShares() (gas: 81112)
PufferProtocolTest:testRegisterMoreValidatorsThanTheLimit() (gas: 782165)
PufferProtocolTest:testRegisterMultipleValidatorKeysAndDequeue(bytes32,bytes32) (runs: 256, μ: 2044673, ~: 2044673)
PufferProtocolTest:testRegisterToInvalidModule() (gas: 70400)
PufferProtocolTest:testRegisterValidatorKeyWithPermit() (gas: 497556)
PufferProtocolTest:testRegisterValidatorKeyWithPermitSignature() (gas: 506646)
PufferProtocolTest:testRegisterValidatorKeyWithPermitSignatureRevertsInvalidSC() (gas: 224544)
PufferProtocolTest:testRegisterValidatorWithHugeCommitment() (gas: 83628)
PufferProtocolTest:testRegisterWithInvalidAmountPaid() (gas: 86118)
PufferProtocolTest:testRegisterWithInvalidBLSPubKey() (gas: 47089)
PufferProtocolTest:testRegisterWithoutRAVE() (gas: 336964)
PufferProtocolTest:testSetGuardiansFeeRateOverTheLimit() (gas: 28330)
PufferProtocolTest:testSetProtocolFeeRate() (gas: 33527)
PufferProtocolTest:testSetProtocolFeeRateOverTheLimit() (gas: 28343)
PufferProtocolTest:testRegisterInvalidPubKeyShares() (gas: 81090)
PufferProtocolTest:testRegisterMoreValidatorsThanTheLimit() (gas: 782341)
PufferProtocolTest:testRegisterMultipleValidatorKeysAndDequeue(bytes32,bytes32) (runs: 256, μ: 2044772, ~: 2044772)
PufferProtocolTest:testRegisterToInvalidModule() (gas: 70378)
PufferProtocolTest:testRegisterValidatorKeyWithPermit() (gas: 497588)
PufferProtocolTest:testRegisterValidatorKeyWithPermitSignature() (gas: 506678)
PufferProtocolTest:testRegisterValidatorKeyWithPermitSignatureRevertsInvalidSC() (gas: 224665)
PufferProtocolTest:testRegisterValidatorWithHugeCommitment() (gas: 83606)
PufferProtocolTest:testRegisterWithInvalidAmountPaid() (gas: 86207)
PufferProtocolTest:testRegisterWithInvalidBLSPubKey() (gas: 47067)
PufferProtocolTest:testRegisterWithoutRAVE() (gas: 336942)
PufferProtocolTest:testSetGuardiansFeeRateOverTheLimit() (gas: 28419)
PufferProtocolTest:testSetProtocolFeeRate() (gas: 33505)
PufferProtocolTest:testSetProtocolFeeRateOverTheLimit() (gas: 28321)
PufferProtocolTest:testSetSmoothingCommitment() (gas: 86893)
PufferProtocolTest:testSetSmoothingCommitment(bytes32) (runs: 256, μ: 86845, ~: 86821)
PufferProtocolTest:testSetWithdrawalPoolRateMax() (gas: 36394)
PufferProtocolTest:testSetup() (gas: 18955)
PufferProtocolTest:testSkipProvisioning() (gas: 993052)
PufferProtocolTest:testStopRegistration() (gas: 1059107)
PufferProtocolTest:testUpgrade() (gas: 4733802)
PufferProtocolTest:testValidatorLimitPerModule() (gas: 500077)
WithdrawalPoolTest:testWithdrawETH() (gas: 183727)
WithdrawalPoolTest:testWithdrawETHWithSignature() (gas: 195607)
PufferProtocolTest:testSetSmoothingCommitment(bytes32) (runs: 256, μ: 86826, ~: 86804)
PufferProtocolTest:testSetWithdrawalPoolRateMax() (gas: 36372)
PufferProtocolTest:testSetup() (gas: 18933)
PufferProtocolTest:testSkipProvisioning() (gas: 993061)
PufferProtocolTest:testStopRegistration() (gas: 1059256)
PufferProtocolTest:testUpgrade() (gas: 4737990)
PufferProtocolTest:testValidatorGriefingAttack() (gas: 951773)
PufferProtocolTest:testValidatorLimitPerModule() (gas: 500033)
WithdrawalPoolTest:testWithdrawETH() (gas: 183692)
WithdrawalPoolTest:testWithdrawETHWithSignature() (gas: 195572)
WithdrawalPoolTest:testWithdrawSomebodyElsesPufETHReverts() (gas: 195887)
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY_PUF }}

- uses: actions/checkout@v4

- name: Install Foundry
Expand All @@ -29,17 +33,19 @@ jobs:
slither:
runs-on: ubuntu-latest
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY_PUF }}

- uses: actions/checkout@v4

- uses: crytic/[email protected]
with:
node-version: 16

solhint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
- name: Install solhint
run: npm i -g solhint
- name: Run solhint
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "lib/murky"]
path = lib/murky
url = https://github.com/dmfxyz/murky
[submodule "lib/pufETH"]
path = lib/pufETH
url = https://github.com/PufferFinance/pufETH
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cbor_metadata = false
bytecode_hash = "none"
optimizer = true
optimizer_runs = 200
# seed = "0x1337" # uncomment / change when debugging fuzz tests
# via_ir = true
solc = "0.8.23"
# evm_version = "shanghai"
Expand Down
1 change: 1 addition & 0 deletions lib/pufETH
Submodule pufETH added at f04b4a
17 changes: 12 additions & 5 deletions output/31337-guardians.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"": "",
"enclaveVerifier": "0xd60DeE1b240f14A4bd22aeA4363D08FA6dA40F25",
"guardianModule": "0xf55C5aa17a2a985316639882F3735Ee103737da5",
"guardians": "0x76d1b66f91044A909C7A3BB834bd302840cd3E4a",
"safeImplementation": "0xc54e6F16A1940d000C6ADEE341D11570490a86F6",
"safeProxyFactory": "0xE25E53220Df33D41b0422FeDBD2D23A94045cFf3"
"PufferDepositor": "0x4E166a233cEeb916B4539afC7922fd8622716552",
"PufferDepositorImplementation": "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1",
"PufferProtocol": "0x9E545E3C0baAB3E08CdfD552C960A1050f373042",
"PufferProtocolImplementation": "0xf5059a5D33d5853360D16C683c16e67980206f36",
"PufferVault": "0x8411199Ce709DD578a946c09136b7e6b7Fe55824",
"PufferVaultImplementation": "0xCD8a1C3ba11CF5ECfa6267617243239504a98d90",
"accessManager": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF",
"enclaveVerifier": "0xc351628EB244ec633d5f21fBD6621e1a683B1181",
"guardianModule": "0xFD471836031dc5108809D173A067e8486B9047A3",
"moduleBeacon": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8",
"moduleFactory": "0x851356ae760d987E095750cCeb3bC6014560891C",
"noRestakingModule": "0x998abeb3E57409262aE5b751f60747921B33613E"
}
23 changes: 12 additions & 11 deletions output/puffer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"": "",
"PufferProtocol": "0x773559Ee80eDE685FBBd5F0Ebd60608DF51b777D",
"PufferProtocolImplementation": "0xE6D876EA7c4B41a2c86DFAFb2E162c686CC95Fb5",
"accessManager": "0x482CDc9277Ae7d4636c0EbA7342C8d440fE7E442",
"enclaveVerifier": "0xB3fAb5f8FDce34FeEf691ccCE6ed20E6b3a0B6fB",
"guardianModule": "0xd4c8730F555F9E9d969BC37280805104c1B039A1",
"moduleBeacon": "0x1BB06aA4c8C8627adb352Dd8C01E38c0482C1c6A",
"moduleFactory": "0x5cd853e676BC218Ec78e4CB904b7dF58db50b8e4",
"noRestakingModule": "0x49CE199bbA75926ab5C6fc16fEDD11d418cB2EDf",
"pauser": "0xeb1D5EE982DbEFf6E57e5Ca3CA45F35bBE229FFE",
"pufferPool": "0xfE7e307d24cB0953b4b5A71E780d6f622525638c",
"withdrawalPool": "0xDAb95f41709473d55EBF7c3b5873b96149A14353"
"PufferDepositor": "0x4E166a233cEeb916B4539afC7922fd8622716552",
"PufferDepositorImplementation": "0x82e01223d51Eb87e16A03E24687EDF0F294da6f1",
"PufferProtocol": "0x8198f5d8F8CfFE8f9C413d98a0A55aEB8ab9FbB7",
"PufferProtocolImplementation": "0x172076E0166D1F9Cc711C77Adf8488051744980C",
"PufferVault": "0x8411199Ce709DD578a946c09136b7e6b7Fe55824",
"PufferVaultImplementation": "0xCD8a1C3ba11CF5ECfa6267617243239504a98d90",
"accessManager": "0x0E801D84Fa97b50751Dbf25036d067dCf18858bF",
"enclaveVerifier": "0xc351628EB244ec633d5f21fBD6621e1a683B1181",
"guardianModule": "0xFD471836031dc5108809D173A067e8486B9047A3",
"moduleBeacon": "0x202CCe504e04bEd6fC0521238dDf04Bc9E8E15aB",
"moduleFactory": "0xf4B146FbA71F41E0592668ffbF264F1D186b2Ca8",
"noRestakingModule": "0xBEc49fA140aCaA83533fB00A2BB19bDdd0290f25"
}
3 changes: 3 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ solady/=lib/solady/src/
rave/=lib/rave/src/
rave-test/=lib/rave/test/
murky/=lib/murky/src/
pufETH/=lib/pufETH/src/
pufETHTest/=lib/pufETH/test/
pufETHScript/=lib/pufETH/script/
40 changes: 35 additions & 5 deletions script/DeployEverything.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,46 @@ import { BaseScript } from "script/BaseScript.s.sol";
import { DeployGuardians } from "script/DeployGuardians.s.sol";
import { DeployPuffer } from "script/DeployPuffer.s.sol";
import { SetupAccess } from "script/SetupAccess.s.sol";
import { GuardiansDeployment, PufferDeployment } from "./DeploymentStructs.sol";
import { AccessManager } from "openzeppelin/access/manager/AccessManager.sol";
import { DeployPuffETH, PufferDeployment } from "pufETHScript/DeployPuffETH.s.sol";
import { UpgradePuffETH } from "pufETHScript/UpgradePuffETH.s.sol";
import { DeployPufferOracle } from "script/DeployPufferOracle.s.sol";
import { GuardiansDeployment, PufferProtocolDeployment } from "./DeploymentStructs.sol";

contract DeployEverything is BaseScript {
address DAO;

function run(address[] calldata guardians, uint256 threshold) public returns (PufferDeployment memory) {
// Deploy guardians
GuardiansDeployment memory guardiansDeployment = new DeployGuardians().run(guardians, threshold);
function run(address[] calldata guardians, uint256 threshold) public returns (PufferProtocolDeployment memory) {
PufferProtocolDeployment memory deployment;

PufferDeployment memory pufferDeployment = new DeployPuffer().run(guardiansDeployment);
// 1. Deploy pufETH
// @todo In test environment, we need to deploy pufETH first, in prod, we just do the upgrade
// AccessManager is part of the pufETH deployment
PufferDeployment memory puffETHDeployment = new DeployPuffETH().run();

deployment.pufferVault = puffETHDeployment.pufferVault;
deployment.pufferDepositor = puffETHDeployment.pufferDepositor;
deployment.stETH = puffETHDeployment.stETH;
deployment.weth = puffETHDeployment.weth;
deployment.accessManager = puffETHDeployment.accessManager;

GuardiansDeployment memory guardiansDeployment =
new DeployGuardians().run(AccessManager(puffETHDeployment.accessManager), guardians, threshold);

address pufferOracle =
new DeployPufferOracle().run(puffETHDeployment.accessManager, guardiansDeployment.guardianModule);

// 2. Upgrade the vault
new UpgradePuffETH().run(puffETHDeployment.pufferVault, puffETHDeployment.accessManager, pufferOracle);

PufferProtocolDeployment memory pufferDeployment = new DeployPuffer().run(
guardiansDeployment, puffETHDeployment.pufferVault, puffETHDeployment.weth, pufferOracle
);

pufferDeployment.pufferDepositor = puffETHDeployment.pufferDepositor;
pufferDeployment.pufferVault = puffETHDeployment.pufferVault;
pufferDeployment.stETH = puffETHDeployment.stETH;
pufferDeployment.weth = puffETHDeployment.weth;

if (!isAnvil()) {
DAO = _broadcaster;
Expand Down
Loading
Loading