Skip to content

Commit

Permalink
Deploy(Mode): FRAX, sFRAX, sfrxETH, FXS (#4)
Browse files Browse the repository at this point in the history
* deploy: Mode FRAX, sFRAX, sfrxETH, FXS

* fix: rm salt

* fix: delete serializedTxs before func execution

* deploy(Mode): sFRAX, FRAX, sfrxETH, FXS

* docs: README addrs

* docs: deploy instructions and operations log

* feat: verify proxy addrs on deployment

* build: v1.0.1
  • Loading branch information
pegahcarter authored Jun 17, 2024
1 parent df166b6 commit de847b9
Show file tree
Hide file tree
Showing 12 changed files with 3,901 additions and 4,662 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
OFT_DEPLOYER=0x909DBdE1eBE906Af95660033e478D59EFe831fED
OFT_DEPLOYER=0x9C9dD956b413cdBD81690c9394a6B4D22afe6745
PK_OFT_DEPLOYER=
CONFIG_DEPLOYER=0x3DdD463472Bc839a616042E05C825C6910DB12b0
CONFIG_DEPLOYER=0x0990be6dB8c785FBbF9deD8bAEc612A10CaE814b
PK_CONFIG_DEPLOYER=

RPC_URL=https://mainnet.mode.network/
3 changes: 3 additions & 0 deletions OPERATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# OPERATIONS
## 2024.06.14
- Deploy Mode: FRAX, sFRAX, sfrxETH, FXS
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,62 @@

<p align="center">Template project for getting started with LayerZero's <code>OFT</code> contract development.</p>

## Contracts & Addresses
### Admin
- `ProxyAdmin`: `0x223a681fc5c5522c85c96157c0efa18cd6c5405c`
- Msigs
- `Ethereum`: `0xB1748C79709f4Ba2Dd82834B8c82D4a505003f27`
- `Blast`: `0x33A133020b2C2CD41a24F74033B11EC2fC0bF97a`
- `Metis`: `0xF4A4F32732F9B2fB84Ee28c58616946F3bF80F7d`
- `Base`: `0xCBfd4Ef00a8cf91Fd1e1Fe97dC05910772c15E53`
- `Mode`: `0x6336CFA6eDBeC2A459d869031DB77fC2770Eaa66`


### Legacy (non-upgradeable) OFTs
- Chain: `Ethereum`, `Metis`, `Blast`, `Base`
- Chain to convert from native token into OFT: Ethereum
- Admin: Chain-respective msig
- OFTs
- `FRAX`: `0x909DBdE1eBE906Af95660033e478D59EFe831fED`
- `sFRAX`: `0xe4796cCB6bB5DE2290C417Ac337F2b66CA2E770E`
- `sfrxETH`: `0x1f55a02A049033E3419a8E2975cF3F572F4e6E9A`
- `FXS`: `0x23432452B720C80553458496D4D9d7C5003280d0`

### Proxy (upgradeable) OFTs
- Chain: Mode, TBD
- Contract to interact with: `Proxy`
- Admin: `ProxyAdmin` (owned by chain-respective msig)
- OFTs
- `FRAX`
- `Implementation`: `0x6a678cefca10d5bbe4638d27c671ce7d56865037`
- `Proxy`: `0x80eede496655fb9047dd39d9f418d5483ed600df`
- `sFRAX`
- `Implementation`: `0x7feda252881b9c6166b387d3d11d1bdfc076d5cb`
- `Proxy`: `0x5bff88ca1442c2496f7e475e9e7786383bc070c0`
- `sfrxETH`
- `Implementation`: `0xade2b968674724ce009576b5c1e4a7d69f365d37`
- `Proxy`: `0x3ec3849c33291a9ef4c5db86de593eb4a37fde45 `
- `FXS`
- `Implementation`: `0x0b72af03b18861f894e4f184032e95c260796825`
- `Proxy`: `0x64445f0aecc51e94ad52d8ac56b7190e764e561a`


## New Chain Deployment
- Ensure `PK_OFT_DEPLOYER` and `PK_CONFIG_DEPLOYER` are the private keys for `0x9C9dD956b413cdBD81690c9394a6B4D22afe6745` and `0x0990be6dB8c785FBbF9deD8bAEc612A10CaE814b, respectively.
- Modify `.env` `RPC_URL` to the new chain RPC
- Add an item to `scripts/L0Config.json:Proxy` with the new chain details (incorrect data will cause the script to fail).
- `source .env && forge script scripts/DeployFraxOFTProtocol.s.sol --broadcast --slow`
- Manually verify each contract on the deployed chain (TODO: add to script cmd).
- Modify `scripts/tx/{SOURCE_CHAIN_ID}-{DESTINATION_CHAIN_ID}.json` values to strings so that:
```
"operation": "0",
...
"value": "0"
```
TODO: automatically save as strings.

- Submit each newly crafted json to the respective `DESTINATION_CHAIN_ID` msig.

carter@laptop:~/Documents/frax/frax-oft-upgradeable$ forge verify-contract --rpc-url $MODE_RPC_URL --constructor-args $(cast abi-encode "constructor(address)" 0x1a44076050125825900e736c501f859c50fE728c) --verifier-url 'https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan' --etherscan-api-key "verifyContract" --chain-id 34443 0x90a706775489D190256D0C721fC6eA3Df64904d0 contracts/FraxOFTUpgradeable.sol:FraxOFTUpgradeable --watch
Start verifying contract `0x90a706775489D190256D0C721fC6eA3Df64904d0` deployed on mode

Expand Down

Large diffs are not rendered by default.

3,678 changes: 1,839 additions & 1,839 deletions broadcast/DeployFraxOFTProtocol.s.sol/34443/run-latest.json

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@layerzerolabs/oft-example",
"version": "0.2.6",
"private": true,
"name": "@frax-oft-upgradeable",
"version": "1.0.1",
"private": false,
"license": "MIT",
"scripts": {
"clean": "rm -rf artifacts cache out",
Expand All @@ -24,8 +24,10 @@
"devDependencies": {
"@babel/core": "^7.23.9",
"@fraxfinance/layerzero-v2-upgradeable": "github:fraxfinance/LayerZero-v2-upgradeable",
"@layerzerolabs/lz-evm-messagelib-v2": "~2.3.21",
"@layerzerolabs/lz-evm-oapp-v2": "~2.3.19",
"@layerzerolabs/lz-evm-protocol-v2": "~2.3.3",
"@layerzerolabs/toolbox-foundry": "~0.1.5",
"@openzeppelin/contracts": "^4.8.1",
"@openzeppelin/contracts-upgradeable": "^4.8.1",
"@rushstack/eslint-patch": "^1.7.0",
Expand Down Expand Up @@ -62,10 +64,5 @@
"@nomicfoundation/edr": "0.3.5",
"ethers": "^5.7.2",
"hardhat-deploy": "^0.12.1"
},
"dependencies": {
"@layerzerolabs/lz-evm-messagelib-v2": "^2.3.21",
"@layerzerolabs/toolbox-foundry": "^0.1.5",
"frax-template": "github:fraxfinance/frax-template"
}
}
21 changes: 10 additions & 11 deletions scripts/DeployFraxOFTProtocol.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ contract DeployFraxOFTProtocol is Script {
uint256 public chainid;

function version() public pure returns (uint256, uint256, uint256) {
return (1, 0, 0);
return (1, 0, 1);
}

modifier broadcastAs(uint256 privateKey) {
Expand All @@ -102,6 +102,9 @@ contract DeployFraxOFTProtocol is Script {


modifier simulateAndWriteTxs(L0Config memory _config) {
// Clear out any previously serialized txs
delete serializedTxs;

vm.createSelectFork(_config.RPC);
chainid = _config.chainid;
vm.startPrank(_config.delegate);
Expand All @@ -116,9 +119,6 @@ contract DeployFraxOFTProtocol is Script {
filename = string.concat(filename, ".json");

new SafeTxUtil().writeTxs(serializedTxs, string.concat(root, filename));
for (uint256 i=0; i<serializedTxs.length; i++) {
serializedTxs.pop();
}
}

function setUp() external {
Expand Down Expand Up @@ -268,10 +268,10 @@ contract DeployFraxOFTProtocol is Script {
// the EVM has differing logic, or we are not on an EVM compatable chain.
// TODO: support for non-evm addresses
// TODO: validate that differing OFT addrs does not impact assumed setup functions.
// require(fxsOft == );
// require(sFraxOft == );
// require(sfrxETH == );
// require(fraxOft == );
require(fxsOft == 0x64445f0aecc51e94ad52d8ac56b7190e764e561a);
require(sFraxOft == 0x5bff88ca1442c2496f7e475e9e7786383bc070c0);
require(sfrxETH == 0x3ec3849c33291a9ef4c5db86de593eb4a37fde45);
require(fraxOft == 0x80eede496655fb9047dd39d9f418d5483ed600df);
require(proxyOfts.length == numOfts);
}

Expand Down Expand Up @@ -328,9 +328,8 @@ contract DeployFraxOFTProtocol is Script {
revert(0, 0)
}
}
/// @dev: create pre-deterministic proxy address, then initialize with correct implementation
bytes32 salt = keccak256(abi.encodePacked(_symbol));
proxy = address(new TransparentUpgradeableProxy{salt: salt}(implementationMock, vm.addr(oftDeployerPK), ""));
/// @dev: create semi-pre-deterministic proxy address, then initialize with correct implementation
proxy = address(new TransparentUpgradeableProxy(implementationMock, vm.addr(oftDeployerPK), ""));

/// @dev: proxyConfig deployer is temporary OFT owner until setPriviledgedRoles()
bytes memory initializeArgs = abi.encodeWithSelector(
Expand Down
Loading

0 comments on commit de847b9

Please sign in to comment.