Protocol Contracts
Inherits: UUPSUpgradeable, Ownable2StepUpgradeable, PausableUpgradeable, IAzoth
State Variables
FEE_DENOMINATOR
uint256 private constant FEE_DENOMINATOR = 1_000_000;usdt
Note: oz-upgrades-unsafe-allow: state-variable-immutable
address private immutable usdt;factory
Note: oz-upgrades-unsafe-allow: state-variable-immutable
address public immutable factory;nftManager
Note: oz-upgrades-unsafe-allow: state-variable-immutable
address public immutable nftManager;curvePoolManager
Note: oz-upgrades-unsafe-allow: state-variable-immutable
AzothStorageLocation
keccak256(abi.encode(uint256(keccak256("AZOTH.storage.Azoth")) - 1)) & ~bytes32(uint256(0xff))
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
initialize
newRWA
This function enables the owner to add or support a new Real-World Asset (RWA). Specifically, the process involves the following steps: 1) Deployment of the wRWA contract; 2) Deployment of the vault contract; 3) Creation of a Curve liquidity pool;
tip1: _rwaIf it is not zero (no check for duplicate addition, manual attention is required)
tip2: _feePercentMust not exceed the denominator of the rate (1,000,000)
tip3: Trigger event LOG_NewRWA(address indexed rwa, address wRWA, address rwaVault, address pool)
Parameters
_rwa
address
The address of RWA token
_nameWRWA
string
The name of the wRWA token
_symbolWRWA
string
The symbol of the wRWA token
_feePercent
uint256
Transaction fee rate (eg: 450 => 0.045%)
_params
ICurve.DeployPoolParams
Parameters for Curve Pool creation
depositRWA
This function enables the owner to deposit $RWA tokens and set the mint price. It is utilized after the official subscription of RWA from the fund issue company, deposit RWA into the protocol for users to purchase.
tip1: Both _amount and _mintPrice are not zero, and the RWA asset corresponding to _wRWA has been supported.
tip2: _mintPricerepresents the price of RWA in terms of USDT, with a precision of 6. eg: if the value of 1 RWA is 1 USDT, then _mintPrice should be 1000000
tip3: The caller needs to approve _amountamount of RWA assets to this contract
tip4: Trigger event LOG_DepositRWA(address indexed wRWA, uint256 amount, uint256 mintPrice)
Parameters
_wRWA
address
The wRWA token address corresponding to RWA assets
_amount
uint256
The amount of $RWA deposited
_mintPrice
uint256
The mint price (excluding fees, also known as the subscription price)
withdrawRWA
This function is used by the owner to redeem $RWA. It is applied to: officially redeem RWA to repay the fund issuers, or reduce the mintable amount of RWA.
tip1: _wRWAThe corresponding RWA assets have been paid; _amountToRepay and _amountForOther cannot both be 0
tip2: _amountToRepaycannot exceed the user's redemption amount,_amountForOthercannot exceed the remaining mintable amount of RWA
tip3: Trigger event LOG_WithdrawRWA(address indexed wRWA, address to, uint256 amount)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amountToRepay
uint256
The amount of $RWA redeemed for repaying the fund issuance company (redeemed from azoth)
_amountForOther
uint256
For other purposes (redeem from the vault)
repayRWA
This function allows the owner to deposit USDT and set the redemption price. The function is applied as follows: After repaying the $RWA to the fund issuance company, USDT is deposited to be available for users' redemption.
tip1: The RWA assets corresponding to _wRWA are supported, and both _amount and _redeemPrice are not zero
tip2: The caller needs to approve _amount amount of USDT to this contract
tip3: _amount % _redeemPrice == 0
tip4: Trigger event:LOG_RepayRWA(address indexed wRWA, uint256 amount, uint256 redeemPrice, uint256 usdtAmount)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amount
uint256
The amount of RWA to be repaid
_redeemPrice
uint256
Redemption price (This redemption price does not take into account the fee)
withdrawUSDT
This function is used by the owner to withdraw USDT. The function is applied to: the official withdrawal of USDT for repurchasing $RWA.
tip1: The RWA assets corresponding to _wRWA are supported, and _amount is not zero
tip2: LOG_WithdrawUSDT(address indexed wRWA, address to, uint256 amount)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amount
uint256
The amount of USDT to be redeemed (there is no limit on the withdrawal amount)
setFeeRecipientw
This function allows the Owner to designate the recipient of the transaction fee.
tip1: _newFeeRecipientis not 0
tip2: Trigger event LOG_NewFeeRecipient(address newFeeRecipient)
Parameters
_newFeeRecipient
address
The new recipient
setFeePercent
This function is used by the Owner to set the fee rate for a certain RWA asset.
tip1: The RWA assets corresponding to _wRWA are now supported
tip2: _newFeePercentmust not exceed 1000000
tip3: Trigger event LOG_NewFeePercent(address indexed wRWA, uint256 newFeePercent)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_newFeePercent
uint256
The new recipient
setWRWABlackList
This function is used by the Owner to set the blacklist for the wRWA tokens of RWA. Users on the blacklist cannot transfer the tokens (true -> false, false -> true).
tip1: The RWA assets corresponding to _wRWA are now supported.
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_user
address
Set the addresses of the users
addLiquidity
The owner deposits USDT, mints $wRWA, and provides liquidity to the Curve Pool by supplying both USDT and $wRWA tokens.
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amount
uint256
The amount of wRWA
_min_mint_amount
uint256
The minimum amount of LP tokens to be obtained
Returns
lpAmount
uint256
The amount of LP tokens obtained.
pendingRemoveLiquidity
This function is used to apply for liquidity removal (with a 7-day delay).If 3 days have passed since the timestamp, the request is expired and must be renewed.
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
removeLiquidity
This function is used to remove liquidity and save the obtained tokens in the vault.
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_lpAmount
uint256
The amount of LP tokens used to remove liquidity
_min_amount
uint256[2]
The minimum amount of each token to be obtained
Returns
receivedToken
uint256[2]
Return the amount of each token obtained
mint
Users use USDT to mint $wRWA
Trigger event: LOG_Mint(address indexed wRWA, address to, uint256 amount)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amount
uint256
The amount of minted $wRWA
requestRedeem
When a user deposits $wRWA and submits an application to redeem USDT, a corresponding NFT must be minted as a formal redemption voucher.
_amountis not 0
Trigger event:LOG_RequestRedeem(address indexed wRWA, uint256 amount)
Parameters
_wRWA
address
The address of the wRWA token corresponding to RWA assets
_amount
uint256
The amount of $wRWA applied for redemption
withdrawRedeem
Users can redeem NFTs for USDT.
Trigger event:LOG_Withdraw(address indexed wRWA, uint256 nftId, address to, uint256 usdtAmount)
Parameters
_nftId
uint256
The token ID of NFT
_authorizeUpgrade
pause
Suspend contract, only for administrators
unpause
Resume contract suspension, only for administrators
_getAzothStorage
_checkUintNotZero
_check2UintNotZero
_checkRWAByVault
_checkAddressNotZero
getFeeRecipient
Get the address of the fee recipient
Returns
<none>
address
the address of the fee recipient
getRWAInfo
Gather detailed information about RWA assets
If the wRWA does not exist, return zero
Returns
vault
address
The vault address of this RWA asset
rwa
address
The wrapped token address of this RWA asset
mintPrice
uint256
The minting price of this RWA asset (excluding fee)
redeemPrice
uint256
The redemption price of this RWA asset (excluding fee)
feePercent
uint256
The redemption price of this RWA asset (excluding fee)
getNFTRedeemInfo
Get the redemption information of NFTs.
If the tokenId does not exist, return zero
Returns
<none>
address
The address of RWA assetRWA
<none>
uint256
Redemption amount
<none>
uint256
Batch (Cycle) Index
<none>
uint256
The specific sequence of this batch
getRWARedeemInfo
Obtain redemption information for RWA assets
If the wRWA does not exist, return zero
Returns
<none>
uint256[]
The amount of each batch
<none>
uint256
The batch index assigned to the user's redemption application
<none>
uint256
The specific sequence of the redemption batch
<none>
uint256
The index of the batches of redemptions that have been officially processed
<none>
uint256
he specific sequence of the redemption batch
inWRWABlacklist
Check if the user is on the blacklist (users on the blacklist cannot transfer tokens).If wRWA does not exist, return False
Parameters
_wRWA
address
The address of wRWA assets
_user
address
The address of the user being queried
Returns
<none>
bool
bool true -> The user is on the blacklist
getLpUnlockTimestamp
Check the timestamp when liquidity can be removed. If the timestamp is exceeded by 3 days, the request will be deemed expired, and a new application must be submitted. (0 indicates no removal application has been made)
If wRWA does not exist, return 0
Parameters
_wRWA
address
The address of wRWA
Returns
<none>
uint256
Timestamp
getCurvePool
Check the timestamp when liquidity can be removed. If the timestamp is exceeded by 3 days, the request will be deemed expired, and a new application must be submitted. (0 indicates no removal application has been made)
Parameters
_wRWA
address
The address of wRWA
Returns
<none>
address
The address of the liquidity pool
Structs
AzothStorage
Note: storage-location: erc7201:AZOTH.storage.Azoth
other
Contract Update Function:
transferOwnership
For owners to transfer administrative privileges.
Trigger event:emit OwnershipTransferStarted(owner(), newOwner);
Parameters
newOwner
address
The address of the wRWA token corresponding to the RWA assets
acceptOwnership
The new administrator receives the authority/
Trigger event:emit OwnershipTransferred(oldOwner, newOwner);