Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/devtools"]
path = lib/devtools
url = https://github.com/layerzero-labs/devtools
[submodule "lib/LayerZero-v2"]
path = lib/LayerZero-v2
url = https://github.com/layerzero-labs/LayerZero-v2
[submodule "lib/solidity-bytes-utils"]
path = lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils.git
6 changes: 6 additions & 0 deletions foundry.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"lib/LayerZero-v2": {
"rev": "9c741e7f9790639537b1710a203bcdfd73b0b9ac"
},
"lib/devtools": {
"rev": "128b697838f4b0fd53ae748093fd66cc409ae5c4"
},
"lib/forge-std": {
"tag": {
"name": "v1.14.0",
Expand Down
9 changes: 9 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ evm_version = "cancun"
optimizer = true
optimizer_runs = 200

remappings = [
'@layerzerolabs/oft-evm/=lib/devtools/packages/oft-evm/',
'@layerzerolabs/oapp-evm/=lib/devtools/packages/oapp-evm/',
'@layerzerolabs/lz-evm-protocol-v2/=lib/LayerZero-v2/packages/layerzero-v2/evm/protocol/',
'@layerzerolabs/lz-evm-messagelib-v2/=lib/LayerZero-v2/packages/layerzero-v2/evm/messagelib/',
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/',
'solidity-bytes-utils/=lib/solidity-bytes-utils/',
]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
1 change: 1 addition & 0 deletions lib/LayerZero-v2
Submodule LayerZero-v2 added at 9c741e
1 change: 1 addition & 0 deletions lib/devtools
Submodule devtools added at 128b69
1 change: 1 addition & 0 deletions lib/solidity-bytes-utils
Submodule solidity-bytes-utils added at fc5024
17 changes: 17 additions & 0 deletions src/OpenGradientOFT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OFT} from "@layerzerolabs/oft-evm/contracts/OFT.sol";

/**
* @title OpenGradient OFT
* @dev BSC-side omnichain representation of the canonical OpenGradient token on Base Sepolia.
* Supply should begin at zero on satellite chains and expand/contract through LayerZero sends.
*/
contract OpenGradientOFT is OFT {
string private constant NAME = "OpenGradient";
string private constant SYMBOL = "OPG";

constructor(address _lzEndpoint, address _delegate) OFT(NAME, SYMBOL, _lzEndpoint, _delegate) Ownable(_delegate) {}
}
23 changes: 23 additions & 0 deletions src/OpenGradientOFTAdapter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {OFTAdapter} from "@layerzerolabs/oft-evm/contracts/OFTAdapter.sol";

/**
* @title OpenGradient OFT Adapter
* @dev LayerZero lockbox adapter for the canonical OpenGradient ERC20 on Base Sepolia.
*
* @dev For existing ERC20 tokens, this can be used to convert the token to crosschain compatibility.
* @dev WARNING: ONLY 1 of these should exist for a given global mesh,
* unless you make a NON-default implementation of OFT and needs to be done very carefully.
* @dev WARNING: The default OFTAdapter implementation assumes LOSSLESS transfers, ie. 1 token in, 1 token out.
* IF the 'innerToken' applies something like a transfer fee, the default will NOT work...
* a pre/post balance check will need to be done to calculate the amountSentLD/amountReceivedLD.
*/
contract OpenGradientOFTAdapter is OFTAdapter {
constructor(address _token, address _lzEndpoint, address _delegate)
OFTAdapter(_token, _lzEndpoint, _delegate)
Ownable(_delegate)
{}
}