The Base Callback contract is an optional feature of the Bond system. Callbacks allow issuers (market creators) to apply custom logic on receipt and payout of tokens.
In addition to the Callback Interface, the Base Callback is also implemented to provide a secure starting point for creating a Callback contract.
The base handles permissioning of Tellers (and specific markets served by the Teller) to avoid unauthorized contracts from accessing the callback function.
Additionally, the setup and data storage for getting data from an Aggregator.
Finally, the external callback function is implemented to ensure the Teller is providing the stated amount of Quote Tokens prior to disbursing Payout Tokens. Issuer-specific logic can be implemented in the _callback
internal function which is called by the external one.
The Callback must be created prior to market creation and the address passed in as an argument. The Callback depends on the Aggregator contract for the Auctioneer that the market is created to get market data. Without a Callback contract, payout tokens are transferred directly from the market owner on each bond purchase (market owners must approve the Teller serving that market for the amount of Payout Tokens equivalent to the capacity of a market when created.
Returns the number of quote tokens received and payout tokens paid out for a market
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Send payout tokens to Teller while allowing market owners to perform custom logic on received or paid out tokensMarket ID on Teller must be whitelisted
Must transfer the output amount of payout tokens back to the TellerShould check that the quote tokens have been transferred to the contract in the _callback function
Deposit tokens to the callback and update balancesOnly callback owner
Returns the address of the current owner.
Leaves the contract without owner. It will not be possible to call onlyOwner
functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
Transfers ownership of the contract to a new account (newOwner
). Can only be called by the current owner.
Whitelist a teller and market ID combinationMust be callback owner
Withdraw tokens from the callback and update balancesOnly callback owner
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
id_
uint256
ID of the market
in_
uint256
Amount of quote tokens bonded to the market
out_
uint256
Amount of payout tokens paid out to the market
teller_
address
Address of the Teller contract
id_
uint256
ID of the market
approved
bool
Whether the Teller and Market ID combination are approved on the callback
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
token_
contract ERC20
Address of the token to deposit
amount_
uint256
Amount of tokens to deposit
owner
address
Owner of the callback with admin privileges
newOwner
address
Address to transfer ownership to
teller_
address
Address of the Teller contract which serves the market
id_
uint256
ID of the market
to_
address
Address of the recipient
token_
contract ERC20
Address of the token to withdraw
amount_
uint256
Amount of tokens to withdraw
previousOwner indexed
address
Address of previous owner
newOwner indexed
address
Address of new owner
id
uint256
ID of market