BondCallback
Inherits: Policy, ReentrancyGuard, IBondCallback, RolesConsumer
State Variables
approvedMarkets
mapping(address => mapping(uint256 => bool)) public approvedMarkets;
_amountsPerMarket
mapping(uint256 => uint256[2]) internal _amountsPerMarket;
priorBalances
mapping(ERC20 => uint256) public priorBalances;
wrapped
mapping(address => address) public wrapped;
TRSRY
TRSRYv1 public TRSRY;
MINTR
MINTRv1 public MINTR;
operator
Operator public operator;
aggregator
IBondAggregator public aggregator;
ohm
ERC20 public ohm;
Functions
constructor
constructor(Kernel kernel_, IBondAggregator aggregator_, ERC20 ohm_) Policy(kernel_);
configureDependencies
Define module dependencies for this policy.
function configureDependencies() external override returns (Keycode[] memory dependencies);
Returns
Name | Type | Description |
---|---|---|
dependencies | Keycode[] | - Keycode array of module dependencies. |
requestPermissions
Function called by kernel to set module function permissions.
function requestPermissions() external view override returns (Permissions[] memory requests);
Returns
Name | Type | Description |
---|---|---|
requests | Permissions[] | - Array of keycodes and function selectors for requested permissions. |
whitelist
Whitelist a teller and market ID combination
function whitelist(address teller_, uint256 id_) external override onlyRole("callback_whitelist");
Parameters
Name | Type | Description |
---|---|---|
teller_ | address | Address of the Teller contract which serves the market |
id_ | uint256 | ID of the market |
blacklist
Remove a market ID on a teller from the whitelist
Shutdown function in case there's an issue with the teller
function blacklist(address teller_, uint256 id_) external override onlyRole("callback_whitelist");
Parameters
Name | Type | Description |
---|---|---|
teller_ | address | Address of the Teller contract which serves the market |
id_ | uint256 | ID of the market to remove from whitelist |
callback
Send payout tokens to Teller while allowing market owners to perform custom logic on received or paid out tokens
Must transfer the output amount of payout tokens back to the Teller
function callback(uint256 id_, uint256 inputAmount_, uint256 outputAmount_) external override nonReentrant;
Parameters
Name | Type | Description |
---|---|---|
id_ | uint256 | ID of the market |
inputAmount_ | uint256 | Amount of quote tokens bonded to the market |
outputAmount_ | uint256 | Amount of payout tokens to be paid out to the market |
batchToTreasury
Send tokens to the TRSRY in a batch
function batchToTreasury(ERC20[] memory tokens_) external onlyRole("callback_admin");
Parameters
Name | Type | Description |
---|---|---|
tokens_ | ERC20[] | - Array of tokens to send |
setOperator
Sets the operator contract for the callback to use to report bond purchases
Must be set before the callback is used
function setOperator(Operator operator_) external onlyRole("callback_admin");
Parameters
Name | Type | Description |
---|---|---|
operator_ | Operator | - Address of the Operator contract |
useWrappedVersion
Inform whether the TRSRY holds the payout token in a naked or a wrapped version
Must be called before whitelisting to ensure a proper TRSRY withdraw approval
function useWrappedVersion(address payoutToken_, address wrappedToken_) external onlyRole("callback_admin");
Parameters
Name | Type | Description |
---|---|---|
payoutToken_ | address | Address of the payout token |
wrappedToken_ | address | Address of the token wrapper held by the TRSRY. If the TRSRY moves back to the naked token, input address(0) as the wrapped version. |
amountsForMarket
Returns the number of quote tokens received and payout tokens paid out for a market
function amountsForMarket(uint256 id_) external view override returns (uint256 in_, uint256 out_);
Parameters
Name | Type | Description |
---|---|---|
id_ | uint256 | ID of the market |
Returns
Name | Type | Description |
---|---|---|
in_ | uint256 | Amount of quote tokens bonded to the market |
out_ | uint256 | Amount of payout tokens paid out to the market |
Errors
Callback_MarketNotSupported
error Callback_MarketNotSupported(uint256 id);
Callback_TokensNotReceived
error Callback_TokensNotReceived();
Callback_InvalidParams
error Callback_InvalidParams();