Git Source

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

address private pudgyPenguin = 0xBd3531dA5CF5857e7CfAA92426877b022e612cf8;

pudgyPenguinFeed

address private pudgyPenguinFeed = 0x9f2ba149c2A0Ee76043d83558C4E79E9F3E5731B;

cryptoPunk

address private cryptoPunk = 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB;

cryptoPunkFeed

address private cryptoPunkFeed = 0x01B6710B01cF3dd8Ae64243097d91aFb03728Fdd;

azuki

address private azuki = 0xED5AF388653567Af2F388E6224dC7C4b3241C544;

azukiFeed

address private azukiFeed = 0xA8B9A447C73191744D5B79BcE864F343455E1150;

appManagerAddress

address private immutable appManagerAddress;

Functions

constructor

constructor(address _appManagerAddress);

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.*

function getNFTPrice(address nftContract, uint256 id) external view returns (uint256 price);

Parameters

NameTypeDescription
nftContractaddressis the address of the NFT contract
iduint256

Returns

NameTypeDescription
priceuint256of 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.*

function getNFTCollectionPrice(address nftContract) external view returns (uint256 price);

Parameters

NameTypeDescription
nftContractaddressis the address of the NFT contract

Returns

NameTypeDescription
priceuint256of 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.

function getChainlinkPudgyToUSDFeedPrice() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256floorPrice 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.

function getChainlinkCryptoToUSDFeedPrice() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256floorPrice 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.

function getChainlinkAzukiToUSDFeedPrice() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256floorPrice The floor price in USD for this collection according to Chainlink aggregation

setCryptoPunkAddress

This function allows appAdminstrators to set the token address

function setCryptoPunkAddress(address _address) external appAdministratorOnly(appManagerAddress);

setCryptoPunkFeedAddress

This function allows appAdminstrators to set the Chainlink price feed address

function setCryptoPunkFeedAddress(address _address) external appAdministratorOnly(appManagerAddress);

setAzukiAddress

This function allows appAdminstrators to set the token address

function setAzukiAddress(address _address) external appAdministratorOnly(appManagerAddress);

setAzuikiFeedAddress

This function allows appAdminstrators to set the Chainlink price feed address

function setAzuikiFeedAddress(address _address) external appAdministratorOnly(appManagerAddress);

setPudgyPenguinAddress

This function allows appAdminstrators to set the token address

function setPudgyPenguinAddress(address _address) external appAdministratorOnly(appManagerAddress);

setPudgyPenguinFeedAddress

This function allows appAdminstrators to set the Chainlink price feed address

function setPudgyPenguinFeedAddress(address _address) external appAdministratorOnly(appManagerAddress);

Errors

NoPriceFeed

error NoPriceFeed(address tokenAddress);