/frax-oft-upgradeable

Frax L0 Upgradeable OFTs

Primary LanguageSolidity

LayerZero

Homepage | Docs | Developers

OFT Example

Quickstart | Configuration | Message Execution Options | Endpoint Addresses

Template project for getting started with LayerZero's OFT contract development.

Contracts & Addresses

Admin

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
    • frxETH : 0xF010a7c8877043681D59AD125EbF575633505942
    • FPI: 0xE41228a455700cAF09E551805A8aB37caa39D08c

Proxy (upgradeable) OFTs

  • Chain: Mode, Sei, Fraxtal, X-Layer
  • Admin: ProxyAdmin (owned by chain-respective msig)
  • OFTs
    • FRAX: 0x80eede496655fb9047dd39d9f418d5483ed600df
    • sFRAX: 0x5bff88ca1442c2496f7e475e9e7786383bc070c0
    • sfrxETH: 0x3ec3849c33291a9ef4c5db86de593eb4a37fde45
    • FXS: 0x64445f0aecc51e94ad52d8ac56b7190e764e561a
    • frxETH: 0x43eDD7f3831b08FE70B7555ddD373C8bF65a9050
    • FPI : 0xEed9DE5E41b53D1C8fAB8AAB4b0e446F828c1483

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.

1) Developing Contracts

Installing dependencies

We recommend using pnpm as a package manager (but you can of course use a package manager of your choice):

pnpm install

Compiling your contracts

This project supports both hardhat and forge compilation. By default, the compile command will execute both:

pnpm compile

If you prefer one over the other, you can use the tooling-specific commands:

pnpm compile:forge
pnpm compile:hardhat

Or adjust the package.json to for example remove forge build:

- "compile": "$npm_execpath run compile:forge && $npm_execpath run compile:hardhat",
- "compile:forge": "forge build",
- "compile:hardhat": "hardhat compile",
+ "compile": "hardhat compile"

Running tests

Similarly to the contract compilation, we support both hardhat and forge tests. By default, the test command will execute both:

pnpm test

If you prefer one over the other, you can use the tooling-specific commands:

pnpm test:forge
pnpm test:hardhat

Or adjust the package.json to for example remove hardhat tests:

- "test": "$npm_execpath test:forge && $npm_execpath test:hardhat",
- "test:forge": "forge test",
- "test:hardhat": "$npm_execpath hardhat test"
+ "test": "forge test"

2) Deploying Contracts

Set up deployer wallet/account:

  • Rename .env.example -> .env
  • Choose your preferred means of setting up your deployer wallet/account:
MNEMONIC="test test test test test test test test test test test junk"
or...
PRIVATE_KEY="0xabc...def"
  • Fund this address with the corresponding chain's native tokens you want to deploy to.

To deploy your contracts to your desired blockchains, run the following command in your project's folder:

npx hardhat lz:deploy

More information about available CLI arguments can be found using the --help flag:

npx hardhat lz:deploy --help

By following these steps, you can focus more on creating innovative omnichain solutions and less on the complexities of cross-chain communication.



Join our community on Discord | Follow us on Twitter