CustomERC721Pricing
Inherits: Ownable, IApplicationEvents, IProtocolERC721Pricing, AppAdministratorOnly, IZeroAddressError
Author: @ShaneDuncan602, @oscarsernarosero, @TJ-Everett
This contract is an example of how one could implement a custom pricing solution. It uses a Chainlink Price Feed to get the token price
State Variables
pudgyPenguin
pudgyPenguinFeed
cryptoPunk
cryptoPunkFeed
azuki
azukiFeed
appManagerAddress
Functions
constructor
getNFTPrice
that the price is for the whole token and not of its atomic unit. This means that if an ERC721 with 18 decimals has a price of 2 dollars, then its atomic unit would be 2/10^18 USD. 999_999_999_999_999_999 = 0xDE0B6B3A763FFFF, 1_000_000_000_000_000_000 = DE0B6B3A7640000
_Gets the price of an NFT. It will return the Token’s specific price. This function is left here to preserve the function signature. NOTE: This is _ only the floor price at the contract level. As of create date, Chainlink does not have a tokenId based pricing solution.*
Parameters
Name | Type | Description |
---|---|---|
nftContract | address | is the address of the NFT contract |
id | uint256 |
Returns
Name | Type | Description |
---|---|---|
price | uint256 | of the Token in weis of dollars. 10^18 => $ 1.00 USD |
getNFTCollectionPrice
Chainlink only provides floor price feeds, so this function mirrors getNFTPrice() in functionality. The price is for the whole token and not of its atomic unit. This means that if an ERC721 with 18 decimals has a price of 2 dollars, then its atomic unit would be 2/10^18 USD. 999_999_999_999_999_999 = 0xDE0B6B3A763FFFF, 1_000_000_000_000_000_000 = DE0B6B3A7640000
_Gets the price of an NFT. It will return the Token’s specific price. This function is left here to preserve the function signature. NOTE: This is _ only the floor price at the contract level. As of create date, Chainlink does not have a tokenId based pricing solution.*
Parameters
Name | Type | Description |
---|---|---|
nftContract | address | is the address of the NFT contract |
Returns
Name | Type | Description |
---|---|---|
price | uint256 | of the Token in weis of dollars. 10^18 => $ 1.00 USD |
getChainlinkPudgyToUSDFeedPrice
Gets the Chainlink floor price feed for PudgyPenguins in USD. This is an example that works for any decimal denomination.
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | floorPrice The floor price in USD for this collection according to Chainlink aggregation |
getChainlinkCryptoToUSDFeedPrice
Gets the Chainlink floor price feed for Cryptopunks in USD. This is an example that works for any decimal denomination.
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | floorPrice The floor price in USD for this collection according to Chainlink aggregation |
getChainlinkAzukiToUSDFeedPrice
Gets the Chainlink floor price feed for Azuki in USD. This is an example that works for any decimal denomination.
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | floorPrice The floor price in USD for this collection according to Chainlink aggregation |
setCryptoPunkAddress
This function allows appAdminstrators to set the token address
setCryptoPunkFeedAddress
This function allows appAdminstrators to set the Chainlink price feed address
setAzukiAddress
This function allows appAdminstrators to set the token address
setAzuikiFeedAddress
This function allows appAdminstrators to set the Chainlink price feed address
setPudgyPenguinAddress
This function allows appAdminstrators to set the token address
setPudgyPenguinFeedAddress
This function allows appAdminstrators to set the Chainlink price feed address