Minting
This documentation provides an overview of the key functions within the GEM Minting contract which is designed to facilitate the minting of GEM NFTs on the Polygon blockchain. It incorporates various features such as admin permissions, price feeds, staking integration, and premium pricing models based on the NFT's value. This contract is part of a larger ecosystem, interacting with other contracts for staking, price feeds, and NFT management.
Constructor
Initializes the contract using the addresses of the Staking, GPRO, PriceFeed and GEMNFT contracts. The deployer is set as the initial admin.
Setter Functions
mintGEMNFT
Purpose: Used for minting GEM NFTs based on a set of requirements
Access: Publicly callable
Parameters
_id: The id of the GEM NFT category
_receiver: The address that will receive the NFT
_poolID: The pool id of staked tokens
_epoch: The epoch when the staking position was matured
_index: The index of the staking position
merkleProof: A set of proofs to verify the merkle root
Notes: The function validates if a discount is applied and mints the NFT based on a discounted rate. If no discount is applied the NFT is minted on spot based on the latest epoch data.
mintSpotBatch
Purpose: Used only for on-spot minting in batch
Access: Publicly callable
Parameters
_id[]: GEM NFT category ids
_receiver: The address that will receive the NFT
merkleProof: Empty as there are no proofs for on-spot minting
Notes: This function allows anyone to mint a batch number of GEM NFTs.
withdraw
Purpose: Withdraw POL funds sent to the smart contract
Access: Only callable by the owner.
Parameters:
_to: Receiving Address
withdrawERC20
Purpose: Withdraw any ERC20 tokens sent to the smart contract
Access: Only callable by the owner.
Parameters:
_contractAddress: ERC20 token address
_to: Receiving Address
setEpochMerkleRoot
Purpose: Sets the Merkle Root for each epoch
Access: Only callable by an admin.
Parameters:
_epoch: The id of an epoch
_merkleRoot: The Merkle Root
setStakingAddress
Purpose: Sets the Staking contract address
Access: Only callable by the owner.
Parameters:
_staking: The Staking address
updatePricesContract
Purpose: Sets the PriceFeed contract address
Access: Only callable by the owner.
Parameters:
_address: The PriceFeed address
setPremium
Purpose: Sets the Premium percentages that are applied on on-spot minting.
Access: Only callable by an admin.
Parameters:
_premium1: The percentage for 1gr up to a 1kg
_premium2: The percentage above 1kg up to 5kg
_premium3: The percentage fabove 5kg
Getter Functions
getPremium
Purpose: Retrieves the premium percentage.
Parameters:
_price: The amount of gold
Returns: The percentage rate.
priceSimulation
Purpose: Retrieves the amount that will be burned and the returned amount.
Parameters:
_opt: 1 for staked positions minting, 2 for on-spot minting
_id: The id of the GEM NFT category
_poolID: The pool id of staked tokens
_epoch: The epoch when the staking position was matured
Returns: The burned and returned amount.
Last updated