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

ApxUSD

Git Source

Inherits: Initializable, ERC20Upgradeable, ERC20PermitUpgradeable, ERC20PausableUpgradeable, ERC20DenyListUpgradable, ERC20BurnableUpgradeable, AccessManagedUpgradeable, UUPSUpgradeable

Title: ApxUSD

A stablecoin backed by off-chain preferred shares with dividend yields

Implements ERC-20 with Permit (EIP-2612), pausability, deny listing, and role-based access control Features:

  • Supply cap to limit total issuance
  • MINT_STRAT for authorized minting contracts
  • Pausable for emergency situations
  • DenyList addresses for compliance
  • UUPS upgradeable pattern

State Variables

APXUSD_STORAGE_LOC

bytes32 private constant APXUSD_STORAGE_LOC = 0xd4bd5aaf4064e82ca5c0ebf6f76b7f421377722e7c3f989b53116d58938a1600

Functions

_getApxUSDStorage

function _getApxUSDStorage() private pure returns (ApxUSDStorage storage $);

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor() ;

initialize

Initializes the ApxUSD contract

function initialize(
    string memory name,
    string memory symbol,
    address initialAuthority,
    address initialDenyList,
    uint256 initialSupplyCap
) public initializer;

Parameters

NameTypeDescription
namestring
symbolstring
initialAuthorityaddressAddress of the AccessManager contract
initialDenyListaddress
initialSupplyCapuint256Maximum total supply (e.g., 1_000_000e18 for $1M)

_authorizeUpgrade

Authorizes contract upgrades

Only callable through AccessManager

function _authorizeUpgrade(address newImplementation) internal override restricted;

mint

Mints new apxUSD tokens

Only callable through AccessManager with MINT_STRAT_ROLE

The nonce is not enforced in ApxUSD and is only included to ensure uniqueness when scheduling operations with AccessManager. The nonce MUST be enforced by a Minter contract (ie MinterV0).

function mint(address to, uint256 amount, uint256 nonce) external restricted;

Parameters

NameTypeDescription
toaddressAddress to receive the minted tokens
amountuint256Amount of tokens to mint (in wei, 18 decimals)
nonceuint256Nonce for the mint

_update

Hook that is called before any token transfer

Enforces pause and freeze functionality

function _update(address from, address to, uint256 value)
    internal
    override(ERC20Upgradeable, ERC20PausableUpgradeable, ERC20DenyListUpgradable);

setSupplyCap

Updates the supply cap

Only callable through AccessManager with ADMIN_ROLE

function setSupplyCap(uint256 newSupplyCap) external restricted;

Parameters

NameTypeDescription
newSupplyCapuint256New maximum total supply

supplyCap

Returns the current supply cap

function supplyCap() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Maximum total supply allowed

supplyCapRemaining

Returns the remaining capacity before hitting the supply cap

function supplyCapRemaining() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Amount of tokens that can still be minted

pause

Pauses all token transfers

Only callable through AccessManager with ADMIN_ROLE

function pause() external restricted;

unpause

Unpauses all token transfers

Only callable through AccessManager with ADMIN_ROLE

function unpause() external restricted;

setDenyList

function setDenyList(IAddressList newDenyList) external restricted;

Events

SupplyCapUpdated

Emitted when the supply cap is updated

event SupplyCapUpdated(uint256 oldCap, uint256 newCap);

Errors

SupplyCapExceeded

Error thrown when minting would exceed the supply cap

error SupplyCapExceeded(uint256 requestedAmount, uint256 availableCapacity);

InvalidSupplyCap

Error thrown when setting an invalid supply cap

error InvalidSupplyCap();

Structs

ApxUSDStorage

Note: storage-location: erc7201:apyx.storage.ApxUSD

struct ApxUSDStorage {
    /// @notice Maximum total supply allowed (in wei, 18 decimals)
    uint256 supplyCap;
}