π¨βπ¬Tech deep dive: Interest Bearing {asset} token
An interest Bearing collateralised, streamable token earning yield via all Strategies involved in the Liquidity Direction Protocol of Alluo.
The Interest Bearing {asset} token is developed and used by Alluo to run deposit farms
.
Currently, there are 4 Interest Bearing tokens on Polygon and Ethereum: IbAlluoUSD, IbAlluoEUR, IbAlluoBTC and IbAlluoETH.
How is it interest-bearing?
We have a value growingRatio
that increases overtime at the interestPerSecond
rate that is set biweekly by the DAO through governance votes. This growingRatio is routinely called by a gelato resolver and updateRatio()
is also called before any movement of IbAlluo to ensure that users get the correct values
/// @notice Updates the growingRatio
/// @dev If more than the updateTimeLimit has passed, call changeRatio from interestHelper to get correct index
/// Then update the index and set the lastInterestCompound date.
function updateRatio() public whenNotPaused {
if (block.timestamp >= lastInterestCompound + updateTimeLimit) {
growingRatio = changeRatio(
growingRatio,
interestPerSecond,
lastInterestCompound
);
lastInterestCompound = block.timestamp;
}
}
An example can be seen below, where if a user wants to transfer exactly $100 USD worth of IbAlluoUSD (keep in mind that 100 IbAlluoUSD is worth 100 * growingRatio > 1
), the function ensures that the ratio is up to date when transferring $100 worth.
/**
* @dev See {IERC20-transfer} but it transfers amount of tokens
* which represents asset value
*/
function transferAssetValue(address to, uint256 amount)
public
whenNotPaused
returns (bool)
{
address owner = _msgSender();
updateRatio();
uint256 adjustedAmount = (amount * multiplier) / growingRatio;
_transfer(owner, to, adjustedAmount);
emit TransferAssetValue(owner, to, adjustedAmount, amount, growingRatio);
return true;
}
Key functionality:
The next few subpages will touch upon some key functionalities in the IbAlluo contract, including:
DepositingWithdrawalsIbAlluo on different chainsStIbAlluo and SuperfluidLiquidity Handler and adaptersLast updated