ThUSDMinter.sol

Public Methods

encodeOrder

function encodeOrder(Order memory order) public view returns (bytes32)

Returns a hash of the order struct used for signature verification.

Name
Type
Description

order

Order struct to hash

Permissioned Methods

These methods can only be called by users with the MINTER_ROLE.

mint

function mint(
    Order memory order,
    address assetDestination,
    bytes memory signature
) external

Mints thUSD using a signed order and sends the collateral to assetDestination.

Name
Type
Description

order

Struct containing mint details

assetDestination

address

Address to receive collateral asset

signature

bytes

Signature validating the order

redeem

function redeem(Order memory order, bytes memory signature) external

Burns thUSD and releases collateral, based on a signed redeem order.

Name
Type
Description

order

Struct containing redeem details

signature

bytes

Signature validating the order

Admin Methods

setSupportedAssetDestination

function setSupportedAssetDestination(address destination, bool isSupported) external

Adds or removes a destination address for asset transfers.

Name
Type
Description

destination

address

Address to configure

isSupported

bool

true to allow, false to block

setSupportedAsset

function setSupportedAsset(address asset, bool isSupported) external

Enables or disables an ERC20 asset for mint/redeem.

Name
Type
Description

asset

address

Asset token address (e.g. USDC)

isSupported

bool

true to allow, false to block

setMaxMintPerBlock

function setMaxMintPerBlock(uint256 _maxMintPerBlock) external

Sets the maximum amount of thUSD that can be minted in a single block.

Name
Type
Description

_maxMintPerBlock

uint256

Max mintable thUSD per block

setMaxRedeemPerBlock

function setMaxRedeemPerBlock(uint256 _maxRedeemPerBlock) external

Sets the maximum amount of thUSD that can be redeemed in a single block.

Name
Type
Description

_maxRedeemPerBlock

uint256

Max redeemable thUSD per block

disableContract

function disableContract() external

Permanently disables minting and redeeming.

Structs

Order

struct Order {
  OrderType orderType;
  uint256 nonce;
  address owner;
  address asset;
  uint256 assetAmount;
  uint256 thusdAmount;
  address receiver;
}

Defines a signed order for mint/redeem operations.

Field
Type
Description

orderType

enum

MINT or REDEEM

nonce

uint256

Unique value for replay protection

owner

address

Initiator of the mint/redeem

asset

address

Collateral asset address

assetAmount

uint256

Amount of asset to transfer

thusdAmount

uint256

thUSD to mint or burn

receiver

address

Destination address for asset or thUSD

Last updated