Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

OrderDelegate

Git Source

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

NameTypeDescription
_authorityaddressAddress of the AccessManager contract
_beneficiaryaddressBeneficiary that receives assets
_signingDelegateaddressAddress that may sign on behalf of this contract
_assetaddressAsset 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

NameTypeDescription
amountuint256Amount to transfer

transferToken

Transfers an ERC20 from this contract to the beneficiary

function transferToken(address token, uint256 amount) public restricted nonReentrant;

Parameters

NameTypeDescription
tokenaddressToken address
amountuint256Amount to transfer