OrderDelegate
Inherits: ERC1271Delegated, AccessManaged, Pausable, ReentrancyGuardTransient, EInvalidAmount, EInsufficientBalance
Title: OrderDelegate
Contract skeleton for delegated order signing and execution
State Variables
beneficiary
Beneficiary address that receives minted/received assets
address public immutable beneficiary
asset
Asset token (e.g. apxUSD)
IERC20 public immutable asset
Functions
constructor
Initializes the order delegate
constructor(address _authority, address _beneficiary, address _signingDelegate, address _asset)
AccessManaged(_authority)
ERC1271Delegated(_signingDelegate);
Parameters
| Name | Type | Description |
|---|---|---|
_authority | address | Address of the AccessManager contract |
_beneficiary | address | Beneficiary that receives assets |
_signingDelegate | address | Address that may sign on behalf of this contract |
_asset | address | Asset token |
isValidSignature
ERC-1271: when paused, reverts so no new mints to this beneficiary
function isValidSignature(bytes32 hash, bytes calldata signature)
public
view
override
whenNotPaused
returns (bytes4 magicValue);
pause
Pauses the contract (isValidSignature will revert when paused). No unpause.
function pause() external restricted;
transfer
Transfers the configured asset to the beneficiary (convenience for primary mint token)
function transfer(uint256 amount) external restricted;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount to transfer |
transferToken
Transfers an ERC20 from this contract to the beneficiary
function transferToken(address token, uint256 amount) public restricted nonReentrant;
Parameters
| Name | Type | Description |
|---|---|---|
token | address | Token address |
amount | uint256 | Amount to transfer |