diff --git a/contracts/token/oft/v2/BaseOFTV2.sol b/contracts/token/oft/latest/BaseOFTV2.sol similarity index 100% rename from contracts/token/oft/v2/BaseOFTV2.sol rename to contracts/token/oft/latest/BaseOFTV2.sol diff --git a/contracts/token/oft/v2/OFTCoreV2.sol b/contracts/token/oft/latest/OFTCoreV2.sol similarity index 100% rename from contracts/token/oft/v2/OFTCoreV2.sol rename to contracts/token/oft/latest/OFTCoreV2.sol diff --git a/contracts/token/oft/v2/OFTV2.sol b/contracts/token/oft/latest/OFTV2.sol similarity index 100% rename from contracts/token/oft/v2/OFTV2.sol rename to contracts/token/oft/latest/OFTV2.sol diff --git a/contracts/token/oft/v2/ProxyOFTV2.sol b/contracts/token/oft/latest/ProxyOFTV2.sol similarity index 100% rename from contracts/token/oft/v2/ProxyOFTV2.sol rename to contracts/token/oft/latest/ProxyOFTV2.sol diff --git a/contracts/token/oft/latest/README.md b/contracts/token/oft/latest/README.md new file mode 100644 index 00000000..1519795a --- /dev/null +++ b/contracts/token/oft/latest/README.md @@ -0,0 +1,45 @@ +## Endpoint V1 OFT: Latest + +> **NOTE:** This document should be read in conjunction with the LayerZero V1 OFT Docs. + +This set of interfaces, contracts, and utilities are all related to the OFT (Omnichain Fungible Token) Endpoint V1 implementation, designed for seamless fungible token transfers across multiple blockchains. + +There are a few core contracts that implement the behavior specified in the OFT V2: + +* **{OFTV2}**: the main contract that combines `BaseOFTV2` with `ERC20`, implementing the OFT functionalities. +* {BaseOFTV2}: the base abstract contract that provides the essential functionality for omnichain token transfer. +* {{OFTCoreV2}}: the core contract that implements baseline logic for debiting and crediting tokens across multiple chains. +* {{NonblockingLzApp}}: the generic message passing standard to send and receive arbitrary pieces of data between LayerZero contracts. +* {ERC20}: the standard ERC-20 implementation from OpenZeppelin, providing basic token functionalities like transfer, balance tracking, and allowances. + +Additionally there are multiple custom extensions, including: + +* **{ProxyOFTV2}**: an implementation that allows an already deployed ERC20 to expand to any supported chain as a native token. +* {NativeOFTV2}: support for native gas token transfers. +* {OFTWithFee}: support for custom fees on token transfer. + +### Core + +{{OFTV2}} + +{{BaseOFTV2}} + +{{OFTCoreV2}} + +{{IOFTV2}} + +{{ERC20}} + +> **NOTE:** This core set of contracts is designed to be unopinionated, allowing developers to access the internal functions in `OFTV2.sol`, `BaseOFTV2.sol`, and `OFTCoreV2.sol`, and expose them as external functions in the way they prefer. + +### Extensions + +{{OFTWithFee}} + +{{ProxyOFTWithFee}} + +{{NativeOFTV2}} + +{{NativeOFTWithFee}} + +> **NOTE:** We encourage developers to explore the internal workings of the `OFTV2` contract to fully utilize its capabilities in omnichain environments. diff --git a/contracts/token/oft/v2/NativeOFTV2.sol b/contracts/token/oft/latest/extensions/NativeOFTV2.sol similarity index 99% rename from contracts/token/oft/v2/NativeOFTV2.sol rename to contracts/token/oft/latest/extensions/NativeOFTV2.sol index 9e84fab3..b23fda11 100644 --- a/contracts/token/oft/v2/NativeOFTV2.sol +++ b/contracts/token/oft/latest/extensions/NativeOFTV2.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; -import "./OFTV2.sol"; +import "../OFTV2.sol"; contract NativeOFTV2 is OFTV2, ReentrancyGuard { uint public outboundAmount; diff --git a/contracts/token/oft/v2/fee/BaseOFTWithFee.sol b/contracts/token/oft/latest/extensions/fee/BaseOFTWithFee.sol similarity index 98% rename from contracts/token/oft/v2/fee/BaseOFTWithFee.sol rename to contracts/token/oft/latest/extensions/fee/BaseOFTWithFee.sol index c039c818..1b23b60d 100644 --- a/contracts/token/oft/v2/fee/BaseOFTWithFee.sol +++ b/contracts/token/oft/latest/extensions/fee/BaseOFTWithFee.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; -import "../OFTCoreV2.sol"; +import "../../OFTCoreV2.sol"; import "./IOFTWithFee.sol"; import "./Fee.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; diff --git a/contracts/token/oft/v2/fee/Fee.sol b/contracts/token/oft/latest/extensions/fee/Fee.sol similarity index 100% rename from contracts/token/oft/v2/fee/Fee.sol rename to contracts/token/oft/latest/extensions/fee/Fee.sol diff --git a/contracts/token/oft/v2/fee/IOFTWithFee.sol b/contracts/token/oft/latest/extensions/fee/IOFTWithFee.sol similarity index 96% rename from contracts/token/oft/v2/fee/IOFTWithFee.sol rename to contracts/token/oft/latest/extensions/fee/IOFTWithFee.sol index 07dcd62d..b6d9b7a4 100644 --- a/contracts/token/oft/v2/fee/IOFTWithFee.sol +++ b/contracts/token/oft/latest/extensions/fee/IOFTWithFee.sol @@ -2,7 +2,7 @@ pragma solidity >=0.5.0; -import "../interfaces/ICommonOFT.sol"; +import "../../interfaces/ICommonOFT.sol"; /** * @dev Interface of the IOFT core standard diff --git a/contracts/token/oft/v2/fee/NativeOFTWithFee.sol b/contracts/token/oft/latest/extensions/fee/NativeOFTWithFee.sol similarity index 100% rename from contracts/token/oft/v2/fee/NativeOFTWithFee.sol rename to contracts/token/oft/latest/extensions/fee/NativeOFTWithFee.sol diff --git a/contracts/token/oft/v2/fee/OFTWithFee.sol b/contracts/token/oft/latest/extensions/fee/OFTWithFee.sol similarity index 100% rename from contracts/token/oft/v2/fee/OFTWithFee.sol rename to contracts/token/oft/latest/extensions/fee/OFTWithFee.sol diff --git a/contracts/token/oft/v2/fee/ProxyOFTWithFee.sol b/contracts/token/oft/latest/extensions/fee/ProxyOFTWithFee.sol similarity index 100% rename from contracts/token/oft/v2/fee/ProxyOFTWithFee.sol rename to contracts/token/oft/latest/extensions/fee/ProxyOFTWithFee.sol diff --git a/contracts/token/oft/v2/interfaces/ICommonOFT.sol b/contracts/token/oft/latest/interfaces/ICommonOFT.sol similarity index 100% rename from contracts/token/oft/v2/interfaces/ICommonOFT.sol rename to contracts/token/oft/latest/interfaces/ICommonOFT.sol diff --git a/contracts/token/oft/v2/interfaces/IOFTReceiverV2.sol b/contracts/token/oft/latest/interfaces/IOFTReceiverV2.sol similarity index 100% rename from contracts/token/oft/v2/interfaces/IOFTReceiverV2.sol rename to contracts/token/oft/latest/interfaces/IOFTReceiverV2.sol diff --git a/contracts/token/oft/v2/interfaces/IOFTV2.sol b/contracts/token/oft/latest/interfaces/IOFTV2.sol similarity index 100% rename from contracts/token/oft/v2/interfaces/IOFTV2.sol rename to contracts/token/oft/latest/interfaces/IOFTV2.sol diff --git a/contracts/token/oft/v2/mocks/OFTStakingMockV2.sol b/contracts/token/oft/latest/mocks/OFTReceiverMockV2.sol similarity index 100% rename from contracts/token/oft/v2/mocks/OFTStakingMockV2.sol rename to contracts/token/oft/latest/mocks/OFTReceiverMockV2.sol diff --git a/contracts/token/oft/v2/mocks/OFTV2Mock.sol b/contracts/token/oft/latest/mocks/OFTV2Mock.sol similarity index 100% rename from contracts/token/oft/v2/mocks/OFTV2Mock.sol rename to contracts/token/oft/latest/mocks/OFTV2Mock.sol diff --git a/contracts/token/oft/v1/NativeOFT.sol b/contracts/token/oft/legacy/NativeOFT.sol similarity index 100% rename from contracts/token/oft/v1/NativeOFT.sol rename to contracts/token/oft/legacy/NativeOFT.sol diff --git a/contracts/token/oft/v1/OFT.sol b/contracts/token/oft/legacy/OFT.sol similarity index 100% rename from contracts/token/oft/v1/OFT.sol rename to contracts/token/oft/legacy/OFT.sol diff --git a/contracts/token/oft/v1/OFTCore.sol b/contracts/token/oft/legacy/OFTCore.sol similarity index 100% rename from contracts/token/oft/v1/OFTCore.sol rename to contracts/token/oft/legacy/OFTCore.sol diff --git a/contracts/token/oft/v1/ProxyOFT.sol b/contracts/token/oft/legacy/ProxyOFT.sol similarity index 100% rename from contracts/token/oft/v1/ProxyOFT.sol rename to contracts/token/oft/legacy/ProxyOFT.sol diff --git a/contracts/token/oft/v1/interfaces/IOFT.sol b/contracts/token/oft/legacy/interfaces/IOFT.sol similarity index 100% rename from contracts/token/oft/v1/interfaces/IOFT.sol rename to contracts/token/oft/legacy/interfaces/IOFT.sol diff --git a/contracts/token/oft/v1/interfaces/IOFTCore.sol b/contracts/token/oft/legacy/interfaces/IOFTCore.sol similarity index 100% rename from contracts/token/oft/v1/interfaces/IOFTCore.sol rename to contracts/token/oft/legacy/interfaces/IOFTCore.sol diff --git a/contracts/token/oft/v1/mocks/OFTMock.sol b/contracts/token/oft/legacy/mocks/OFTMock.sol similarity index 100% rename from contracts/token/oft/v1/mocks/OFTMock.sol rename to contracts/token/oft/legacy/mocks/OFTMock.sol diff --git a/contracts/token/oft/v2/README.md b/contracts/token/oft/v2/README.md deleted file mode 100644 index 5754e90f..00000000 --- a/contracts/token/oft/v2/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## IMPORTANT: OFTV2 - -In order to make the token balance compatible on Aptos e.g. using uint64 to represent balance, OFTV2 has a shared decimal point setting to normalize the data type difference. - -It is recommended to use a smaller shared decimal point on all chains so that your token can have a larger balance. For example, if the decimal point is 18, then you can not have more than approximately 18 * 10^18 tokens bounded by the uint64.max