Dynamic price checker
When creating a Bond Class, you can specify a Dynamic Price Checker address, which is a contract that returns the bond's price upon request. It must implement the following interface:
interface IBondPriceCheck {
function getRewardAmountForETH(address bondToken, uint256 value) external view returns (uint256);
function getRewardAmountForToken(
address bondToken,
address paymentToken,
uint256 value
) external view returns (uint256);
}
The getRewardAmountForETH
function will be utilized if the Bond Class requires ETH for purchasing bonds. Otherwise, the getRewardAmountForToken function will be used if ERC20 tokens are used.
If a Dynamic Price Checker
is set, the Bond Contract will call one of the above functions with the following parameters during the bond purchase process:
bondToken
- the address of the reward tokenpaymentToken
- (applicable only for ERC20) the address of the payment tokenvalue
- the value of the payment token provided by the user, decreased by the protocol fee.