forked from ExocoreNetwork/exocore-contracts
-
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.
v4: testnet changes (ExocoreNetwork#71)
* feat(v4): whitelist two tokens on deployment * v4: add deployment addresses * feat(v4): update `generate.js` * chore: forge fmt * fix(generate): correct the order of meta info * fix(generate): depend on min self delegation * fix(generate): load oracle data * fix(generate): add price decimals for oracle * fix(generate): x/oracle future start block * script: add redeploy bootstrap script * fix(pre-req): use correct lz endpoint * fix(script): allow set peers to run * fix(script): allow `getDeployedCode` to work In newer versions of Foundry, the imports are required * fix: correct lz endpoint * update exocore gateway deployment * update client chain gateway address * add corrected bootstrap deployment * chore: forge fmt * chore: forge fmt with newer foundry
- Loading branch information
1 parent
61ad95f
commit 1346b0d
Showing
11 changed files
with
297 additions
and
113 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
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,110 @@ | ||
pragma solidity ^0.8.19; | ||
|
||
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; | ||
|
||
import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol"; | ||
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import {ITransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
|
||
import "../src/core/BeaconProxyBytecode.sol"; | ||
import {Bootstrap} from "../src/core/Bootstrap.sol"; | ||
import {ClientChainGateway} from "../src/core/ClientChainGateway.sol"; | ||
|
||
import "../src/core/ExoCapsule.sol"; | ||
import {Vault} from "../src/core/Vault.sol"; | ||
import {ICustomProxyAdmin} from "../src/interfaces/ICustomProxyAdmin.sol"; | ||
|
||
import {BaseScript} from "./BaseScript.sol"; | ||
import {ILayerZeroEndpointV2} from "@layerzero-v2/protocol/contracts/interfaces/ILayerZeroEndpointV2.sol"; | ||
import {ERC20PresetFixedSupply} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol"; | ||
import "forge-std/Script.sol"; | ||
|
||
import "@beacon-oracle/contracts/src/EigenLayerBeaconOracle.sol"; | ||
|
||
// This script uses the address in `deployedBootstrapOnly` and redeploys on top of it. For that to work, the | ||
// modifier for the initialize function needs to be changed from `initializer` to `reinitializer(2)`. At the same | ||
// time, the `reinitializer` in the `ClientChainGateway` will need to be changed to `3`. | ||
contract CorrectBootstrapErrors is BaseScript { | ||
|
||
address wstETH; | ||
address proxyAddress; | ||
address proxyAdmin; | ||
|
||
function setUp() public virtual override { | ||
// load keys | ||
super.setUp(); | ||
// load contracts | ||
string memory prerequisiteContracts = vm.readFile("script/prerequisiteContracts.json"); | ||
clientChainLzEndpoint = | ||
ILayerZeroEndpointV2(stdJson.readAddress(prerequisiteContracts, ".clientChain.lzEndpoint")); | ||
require(address(clientChainLzEndpoint) != address(0), "Client chain endpoint not found"); | ||
restakeToken = ERC20PresetFixedSupply(stdJson.readAddress(prerequisiteContracts, ".clientChain.erc20Token")); | ||
require(address(restakeToken) != address(0), "Restake token not found"); | ||
clientChain = vm.createSelectFork(clientChainRPCURL); | ||
// we should use the pre-requisite to save gas instead of deploying our own | ||
beaconOracle = EigenLayerBeaconOracle(stdJson.readAddress(prerequisiteContracts, ".clientChain.beaconOracle")); | ||
require(address(beaconOracle) != address(0), "Beacon oracle not found"); | ||
// same for BeaconProxyBytecode | ||
beaconProxyBytecode = | ||
BeaconProxyBytecode(stdJson.readAddress(prerequisiteContracts, ".clientChain.beaconProxyBytecode")); | ||
require(address(beaconProxyBytecode) != address(0), "Beacon proxy bytecode not found"); | ||
// wstETH on Sepolia | ||
// https://docs.lido.fi/deployed-contracts/sepolia/ | ||
wstETH = stdJson.readAddress(prerequisiteContracts, ".clientChain.wstETH"); | ||
require(wstETH != address(0), "wstETH not found"); | ||
|
||
string memory deployed = vm.readFile("script/deployedBootstrapOnly.json"); | ||
proxyAddress = stdJson.readAddress(deployed, ".clientChain.bootstrap"); | ||
require(address(proxyAddress) != address(0), "bootstrap address should not be empty"); | ||
proxyAdmin = stdJson.readAddress(deployed, ".clientChain.proxyAdmin"); | ||
require(address(proxyAdmin) != address(0), "proxy admin address should not be empty"); | ||
vaultImplementation = Vault(stdJson.readAddress(deployed, ".clientChain.vaultImplementation")); | ||
require(address(vaultImplementation) != address(0), "vault implementation should not be empty"); | ||
vaultBeacon = UpgradeableBeacon(stdJson.readAddress(deployed, ".clientChain.vaultBeacon")); | ||
require(address(vaultBeacon) != address(0), "vault beacon should not be empty"); | ||
} | ||
|
||
function run() public { | ||
address[] memory emptyList; | ||
|
||
vm.selectFork(clientChain); | ||
vm.startBroadcast(exocoreValidatorSet.privateKey); | ||
ProxyAdmin proxyAdmin = ProxyAdmin(proxyAdmin); | ||
Bootstrap bootstrapLogic = new Bootstrap( | ||
address(clientChainLzEndpoint), exocoreChainId, address(vaultBeacon), address(beaconProxyBytecode) | ||
); | ||
bytes memory data = abi.encodeCall( | ||
Bootstrap.initialize, | ||
( | ||
exocoreValidatorSet.addr, | ||
// 1 week from now | ||
block.timestamp + 168 hours, | ||
2 seconds, | ||
emptyList, | ||
address(proxyAdmin) | ||
) | ||
); | ||
proxyAdmin.upgradeAndCall(ITransparentUpgradeableProxy(proxyAddress), address(bootstrapLogic), data); | ||
Bootstrap bootstrap = Bootstrap(payable(proxyAddress)); | ||
vm.stopBroadcast(); | ||
|
||
string memory clientChainContracts = "clientChainContracts"; | ||
vm.serializeAddress(clientChainContracts, "lzEndpoint", address(clientChainLzEndpoint)); | ||
vm.serializeAddress(clientChainContracts, "erc20Token", address(restakeToken)); | ||
vm.serializeAddress(clientChainContracts, "wstETH", wstETH); | ||
vm.serializeAddress(clientChainContracts, "proxyAdmin", address(proxyAdmin)); | ||
vm.serializeAddress(clientChainContracts, "vaultImplementation", address(vaultImplementation)); | ||
vm.serializeAddress(clientChainContracts, "vaultBeacon", address(vaultBeacon)); | ||
vm.serializeAddress(clientChainContracts, "beaconProxyBytecode", address(beaconProxyBytecode)); | ||
vm.serializeAddress(clientChainContracts, "bootstrapLogic", address(bootstrapLogic)); | ||
vm.serializeAddress(clientChainContracts, "bootstrap", address(bootstrap)); | ||
string memory clientChainContractsOutput = | ||
vm.serializeAddress(clientChainContracts, "beaconOracle", address(beaconOracle)); | ||
|
||
string memory deployedContracts = "deployedContracts"; | ||
string memory finalJson = vm.serializeString(deployedContracts, "clientChain", clientChainContractsOutput); | ||
|
||
vm.writeJson(finalJson, "script/correctBootstrapErrors.json"); | ||
} | ||
|
||
} |
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
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
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,14 @@ | ||
{ | ||
"clientChain": { | ||
"beaconOracle": "0xd3D285cd1516038dAED61B8BF7Ae2daD63662492", | ||
"beaconProxyBytecode": "0xA15Ce26ba8E50ac21ecDa1791BAa3bf22a95b575", | ||
"bootstrap": "0x53f39D2ECd900Fb018180dB692A9fc29c8efD38E", | ||
"bootstrapLogic": "0x3C9928feC16faDD504ab663a202c43cebC29f88D", | ||
"erc20Token": "0x83E6850591425e3C1E263c054f4466838B9Bd9e4", | ||
"lzEndpoint": "0x6EDCE65403992e310A62460808c4b910D972f10f", | ||
"proxyAdmin": "0x266517829c443D5F8d2dB3782d3F5f6D8Ed40903", | ||
"vaultBeacon": "0xad6F09ED99aE9E2f47892e2b49b18E024fC2938C", | ||
"vaultImplementation": "0x4B7422868F4574b9c1830aD6466D406FF7503290", | ||
"wstETH": "0xB82381A3fBD3FaFA77B3a7bE693342618240067b" | ||
} | ||
} |
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
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,7 +1,7 @@ | ||
{ | ||
"exocore": { | ||
"exocoreGateway": "0xe13Ef2fE9B4bC1A3bBB62Df6bB19d6aD79525036", | ||
"exocoreGatewayLogic": "0x617c588c3FaAA105cec3438D0c031E143A8B23fd", | ||
"exocoreGateway": "0xbf5497Deb7C409623Ad58D798E73a865a80873DD", | ||
"exocoreGatewayLogic": "0xdd359906110Ae307eeCdE5d1179ab59461152348", | ||
"lzEndpoint": "0x6EDCE65403992e310A62460808c4b910D972f10f" | ||
} | ||
} |
Oops, something went wrong.