NFT
Inherits: ERC721EnumerableUpgradeable, UUPSUpgradeable
Contract Summary
The NFT generated post-redemption are uniformly created in accordance with the ERC-721 standard. Each NFT possesses a unique identifier, is non-fungible and indivisible, and supports functionalities such as ownership transfer, approval authorization, and metadata storage.
State Variables
NFTManagerStorageLocation
bytes32 private constant NFTManagerStorageLocation = 0x980c83754224d51d8374ad9970317aaf24ad04850ecf2b771ca42610c8b64700;
azoth
Note: oz-upgrades-unsafe-allow: state-variable-immutable
address public immutable azoth;
Functions
constructor
Note: oz-upgrades-unsafe-allow: constructor
constructor(address _azoth);
initialize
function initialize() public initializer;
onlyAzoth
modifier onlyAzoth();
addBatch
depositRWA
This function is used to add the batch information (quantity) when depositing $RWA in the depositRWA function in Azoth.
function addBatch(address _wRWA, uint256 _amount) external onlyAzoth;
Parameters
_wRWA
address
The token address of RWA assets.
_amount
uint256
The quantity of this batch.
mint
This function is designed to mint a redemption voucher (in the form of an NFT) within the requestRedeem
function of Azoth during the redemption application process.
function mint(address _wRWA, uint256 _amount, address _to) external onlyAzoth;
Parameters
_wRWA
address
The token address of RWA assets
_amount
uint256
The amount of $wRWA to be redeemed is applied for
_to
address
To whom the NFT is minted
burn
This function is used in the withdrawRedeem
function of Azoth to check the conditions and destroy the NFT when redeeming.
function burn(address _from, uint256 _tokenId) external onlyAzoth returns (uint256);
Parameters
_from
address
Address who redeem stablecoins
_tokenId
uint256
NFT tokenId
Returns
<none>
uint256
Returns the withdrawable stablecoin amount as a uint256
repay
This function is used in the Azothrepay
function to indicate the amount of $RWA repayments processed.
In the loop, there is no check for whether batchAmount is out of bounds because the quantity of repay is less than or equal to the quantity applied for redemption by the user, and it has been ensured that the quantity applied for redemption does not exceed the bounds when the application for redemption is made.
function repay(address _wRWA, uint256 _amount, uint256 _repayPrice) external onlyAzoth;
Parameters
_wRWA
address
wThe token address of wRWA assets
_amount
uint256
The processed amount
_repayPrice
uint256
Repayment price
tokenURI
function tokenURI(uint256 tokenId) public view override returns (string memory);
_authorizeUpgrade
function _authorizeUpgrade(address _newImplementation) internal override onlyAzoth;
getNextTokenId
Get the ID of the next NFT.
function getNextTokenId() external view returns (uint256);
getNFTRedeemInfo
Get the redemption information of NFTs.
If the tokenId does not exist, return all zeros.
function getNFTRedeemInfo(uint256 _tokenId) external view returns (address, uint256, uint256, uint256);
Parameters
_tokenId
uint256
NFT ID
Returns
<none>
address
The address of wRWA
<none>
uint256
Redemption amount
<none>
uint256
Batch (Cycle) Index
<none>
uint256
The specific location of this batch
getRwaRedeemInfo
Get the redemption information of a certain asset.
If wRWA does not exist, return all zeros.
function getRwaRedeemInfo(address _wRWA) external view returns (uint256[] memory, uint256, uint256, uint256, uint256);
Parameters
_wRWA
address
The address of wRWA
Returns
<none>
uint256[]
The quantities of each batch
<none>
uint256
The index of the batch to which the user's redemption application is queued
<none>
uint256
Redemption batch position application
<none>
uint256
The index of the batches of redemptions that have been processed by the official
<none>
uint256
The position of the redemption batch
getRepayInfo
Get the historical repayment data of a certain asset.
Return 0 if wRWA does not exist.
function getRepayInfo(address _wRWA) external view returns (RepayInfo[][] memory);
Parameters
_wRWA
address
The address of wRWA
Returns
<none>
RepayInfo[][]
Historical repayment data of type uint256[][]
isRedeemProcessed
This function is used to check whether the redemption of a certain NFT has been processed. True -> processed; False -> not processed.
function isRedeemProcessed(uint256 _tokenId) external view returns (bool);
Parameters
_tokenId
uint256
NFT's tokenId
getNFTTotalValue
This function is used to check how much USDT can be redeemed for a certain NFT.
When the NFT has not been processed, it returns zero.
function getNFTTotalValue(uint256 _tokenId) external view returns (uint256);
Parameters
_tokenId
uint256
NFT's tokenId
getOwnedNFT
function getOwnedNFT(address _user) external view returns (uint256[] memory tokenIds);
_getNFTManagerStorage
function _getNFTManagerStorage() private pure returns (NFTManagerStorage storage $);
_checkAzoth
function _checkAzoth() private view;
_calcNFTTotalValue
function _calcNFTTotalValue(uint256 _tokenId) private view returns (uint256);
_render
function _render(uint256 _tokenId, string memory _symbol, uint256 _amount, uint256 _epoch, uint256 _location)
internal
pure
returns (string memory);
Events
LOG_MintRedeemNFT
event LOG_MintRedeemNFT(address indexed wrwa, address to, uint256 tokenId);
Errors
NextRound
error NextRound();
NotAzoth
error NotAzoth();
NotNFTOwner
error NotNFTOwner();
InsufficientRedeemAmount
error InsufficientRedeemAmount();
NotYetProcessed
error NotYetProcessed();
RepayTooMuch
error RepayTooMuch();
Structs
NFTRedeemInfo
struct NFTRedeemInfo {
address wRWA;
uint256 amount;
uint256 batchIdx;
uint256 amountIdx;
}
RepayInfo
struct RepayInfo {
uint256 price;
uint256 amount;
}
WRWARedeemInfo
struct WRWARedeemInfo {
uint256[] batchAmount;
uint256 redeemBatchIdx;
uint256 redeemAmountIdx;
uint256 processedBatchIdx;
uint256 processedAmountIdx;
RepayInfo[][] repayInfos;
}
NFTManagerStorage
Note: storage-location: erc7201:AZOTH.storage.NFTManager
struct NFTManagerStorage {
uint256 nextTokenId;
mapping(uint256 => NFTRedeemInfo) nftRedeemInfos;
mapping(address => WRWARedeemInfo) wrwaRedeemInfos;
}
Last updated