The bonding event is the second stage in the IBCO process and takes place after the user has obtained sEUROs through the bonding curve in Stage 1.
These are the functions exposed to the user in the Operator Stage 2 contract. This contract can be used to create a bond of sEURO and another token, in order to receive TST once the bond matures.
showRates()
Description: gets available bond options
Output: list of available bond options, as a yield rate and duration (in weeks)
newBond(uint256 _amountSeuro, uint256 _rate)
Description: creates a new bond for the duration that is applicable to the given rate. Transfers given sEURO amount, and an amount of the other bonding token (the amount is dictated by the requirements of the Uniswap liquidity pool at that time)
Input: amount of sEURO to bond; chosen bond rate
refreshBond(address _user)
Description: refreshes status of bond
Input: address of user creating bond
These are the functions exposed to the user in the Bonding Event contract. This contract can be used to retrieve details about the bonding event and Uniswap liquidity pool.
SEURO_ADDRESS()
OTHER_ADDRESS()
Description: the addresses of the two ERC20 tokens involved in the bonding event
getOtherAmount(uint256 _amountSEuro)
Description: calculates how much of the other token is required in order to bond with the given amount of sEURO
Input: amount of sEURO to bond
Output: required amount of other token
These are the functions exposed to the user in the Bond Storage contract. This contract can be used to retrieve data about the status of user's bond.
getActiveBonds(address_user)
Description: gets amount of active bonds for sender
getUserBonds(address_user)
Description: gets all bonds for sender
getBondAt(address_user, uint256 index)
Description: gets a single bond for sender
getProfit(address_user)
Description: gets total profit for sender's bonds
getClaimAmount(address_user)
Description: gets claimable amount of TST for sender
The contracts used in this stage are:
- BondingEvent.sol: exposes the bonding API and adds liquidity before bonding takes place
- BondStorage.sol: contains the logic of calculating the bond reward and other relevant data
- StandardTokenGateway.sol: contains the price data that determines the reward amount
The relationship between the contracts is:
- StandardTokenGateway does not import any contract
- BondStorage imports StandardTokenGateway to:
- fetch the price of TST in EUR
- get the remaining TST reward supply
- decrease the TST reward supply
- BondingEvent imports BondStorage to begin bonding