The purpose of the pricing contracts is to serve as token-price data sources for ecosystem applications. The token pricers can be found in 2 different categories:
Make sure you have deployed your ERC20 and your ERC721 pricer contracts, or that your third party solutions are ready to communicate with your application.
Connect the pricer-contract set to your appManager. For this, only an account with the role of ruleAdministrator will be able to call the following functions in the appManager Handler:
Copy
Ask AI
/** * @dev sets the address of the erc20 pricing contract and loads the contract. * @param _address ERC20 Pricing Contract address. */ function setERC20PricingAddress(address _address) external ruleAdministratorOnly(appManagerAddress); /** * @dev sets the address of the nft pricing contract and loads the contract. * @param _address Nft Pricing Contract address. */ function setNFTPricingAddress(address _address) external ruleAdministratorOnly(appManagerAddress);
Pass the addresses for your pricer contracts respectively, and you’re done!
Price is in wei of US Dollars: 1 dollar is represented by 1 _ 10^18, and 1 cent is represented 1 _ 10^16 in these contracts. This is done to have precision over the price, and to account for the possibility of tokens with extremely low prices.
The price is given for a whole token:
For Fungible Tokens: just like regular market data outlets, the price will be given for a whole token without decimals. e.g 1 ETH.
For Non-Fungible-Tokens: even in the case of a fractionalized NFT, the price is still given for the whole token and not for its fractions.
Let’s say we have the ERC20 called Frankenstein which has 18 decimals (1 Frankenstein = 1 * 10^18 wei of a Frankenstein). Let’s imagine that each Frankenstein is worth exactly $0.55 US Dollars (55 ¢). In this case, the price for the token will be 55 * 10^16.
Let’s say we have the NFT collection called FrankensteinNFT. Let’s imagine that the FrankensteinNFT with Id 222 is worth exactly $500.00 US Dollars. In this case, the price for the token will be 500 * 10^18.