parent
a41755e7b9
commit
4c57fc8715
@ -1,19 +1,45 @@ |
||||
// SPDX-License-Identifier: MIT OR Apache-2.0 |
||||
pragma solidity >=0.6.11; |
||||
|
||||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; |
||||
pragma solidity ^0.8.13; |
||||
|
||||
// ============ Internal Imports ============ |
||||
import {IAbcToken} from "../interfaces/IAbcToken.sol"; |
||||
// ============ External Imports ============ |
||||
import {Router} from "@abacus-network/core/contracts/router/Router.sol"; |
||||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; |
||||
|
||||
import {IAbcToken} from "../interfaces/IAbcToken.sol"; |
||||
contract TransferRouter is Router { |
||||
// The address of the token contract. |
||||
IERC20 public token; |
||||
|
||||
constructor(address _token) { |
||||
token = IERC20(_token); |
||||
} |
||||
|
||||
error SenderNotToken(); |
||||
|
||||
modifier onlyToken() { |
||||
if (msg.sender != address(token)) { |
||||
revert SenderNotToken(); |
||||
} |
||||
_; |
||||
} |
||||
|
||||
// Dispatches a message to a remote router to mint `amount` to `recipient`. |
||||
function transferRemote( |
||||
uint32 domain, |
||||
address sender, |
||||
address recipient, |
||||
uint256 amount |
||||
) external onlyToken {} |
||||
|
||||
contract AbcRouter is Router { |
||||
// The address of the token contract. |
||||
ERC20Mintable public token; |
||||
// Mints message.amount to message.recipient. |
||||
function handleTransferMessage(bytes memory message) internal {} |
||||
|
||||
// Dispatches a message to a remote router to mint `amount` to `recipient`. |
||||
function transferRemote(uint32 domain, address sender, address recipient, uint256 amount) external onlyToken; |
||||
function handle( |
||||
uint32 _origin, |
||||
bytes32 _sender, |
||||
bytes calldata _message |
||||
) external override { |
||||
|
||||
// Mints message.amount to message.recipient. |
||||
function handleTransferMessage(bytes memory message) internal; |
||||
} |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue