-
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.
feat: Add source and destination portal ERC20s, and a minting and bur…
…ning mechanism
- Loading branch information
1 parent
fcbbe20
commit 383ee92
Showing
6 changed files
with
89 additions
and
16 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
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,41 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import { OFT } from "@layerzerolabs/oft-evm/contracts/OFT.sol"; | ||
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
import { ISourcePortal } from "./interfaces/ISourcePortal.sol"; | ||
|
||
contract SourcePortal is OFT, ISourcePortal { | ||
uint8 private constant DECIMALS = 6; | ||
|
||
address private immutable i_multiAssetVault; | ||
|
||
modifier onlyMultiAssetVault() { | ||
if (msg.sender != i_multiAssetVault) revert SourcePortal__NotMultiAssetVault(msg.sender, i_multiAssetVault); | ||
_; | ||
} | ||
|
||
constructor( | ||
address _lzEndpoint, | ||
address _globalOwner, | ||
address _multiAssetVault | ||
) | ||
OFT("Portal", "PORTAL", _lzEndpoint, _globalOwner) | ||
Ownable(_globalOwner) | ||
{ | ||
i_multiAssetVault = _multiAssetVault; | ||
} | ||
|
||
function mint(address _to, uint256 _amount) external onlyMultiAssetVault { | ||
_mint(_to, _amount); | ||
} | ||
|
||
function burn(address _to, uint256 _amount) external onlyMultiAssetVault { | ||
_burn(_to, _amount); | ||
} | ||
|
||
function decimals() public pure override returns (uint8) { | ||
return DECIMALS; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
interface ISourcePortal { | ||
error SourcePortal__NotMultiAssetVault(address caller, address multiAssetVault); | ||
|
||
function mint(address _to, uint256 _amount) external; | ||
|
||
function burn(address _to, uint256 _amount) external; | ||
} |