Inverse Bonding Curve
The Inverse Bonding Curve contract is responsible for handling mints and burns of ibAssets. The contract stores the balance of the relevant reserve assets, used for the mints and burns.
A Inverse Bonding Curve contract is deployed per ibAsset type. New Inverse Bonding Curve contracts are deployed through the IBC Factory contract.
Events
CurveInitialized
CurveInitializedEmitted at inverse bonding curve initialization.
event CurveInitialized(
address indexed from,
address indexed reserveTokenAddress
uint256 reserve,
uint256 supply,
uint256 initialPrice,
uint256 parameterInvariant
);from*
address
Address of initializer
reserveTokenAddress*
address
Contract address of reserve asset
reserve
uint256
Reserve value at initialization
supply
uint256
Supply value at initialization
initialPrice
uint256
ibAsset price at initialization
parameterInvariant
uint256
Curve invariant at initialization
* = indexable
LiquidityAdded
LiquidityAddedEmitted when new liquidity has been added to the inverse bonding curve.
event LiquidityAdded(
address indexed from,
address indexed recipient,
uint256 amountIn,
uint256 amountOut,
uint256 newParameterInvariant
); from*
address
Address of LP
recipient*
address
Address that received minted LP tokens
amountIn
uint256
Amount of reserve assets added
amountOut
uint256
Amount of LP tokens minted
newParameterInvariant
uint256
Curve invariant after LP addition
* = indexable
LiquidityRemoved
LiquidityRemovedEmitted when liquidity has been removed from the inverse bonding curve.
event LiquidityRemoved(
address indexed from,
address indexed recipient,
uint256 amountIn,
uint256 reserveAmountOut,
uint256 inverseTokenCredit,
uint256 inverseTokenBurned,
uint256 newParameterInvariant
); from*
address
Address of LP
recipient*
address
Address that received removed reserves
amountIn
uint256
Amount of LP tokens burnt
reserveAmountOut
uint256
Amount of reserve assets withdrawn
inverseTokenCredit
uint256
ibAsset credit of LP prior to removal
inverseTokenBurned
uint256
Amount of ibAssets burnt
newParameterInvariant
uint256
Curve invariant after LP removal
* = indexable
TokenStaked
TokenStakedEmitted when ibAssets are staked.
event TokenStaked(
address indexed from,
address indexed recipient,
uint256 amount
); from*
address
Address of staker
recipient*
address
Address to stake ibAssets to
amount
uint256
Stake amount
* = indexable
TokenUnstaked
TokenUnstakedEmitted when ibAssets are unstaked.
event TokenUnstaked(
address indexed from,
address indexed recipient,
uint256 amount
); from*
address
Address of unstaker
recipient*
address
Address to receive unstaked ibAssets
amount
uint256
Unstake amount
* = indexable
TokenBought
TokenBoughtEmitted when ibAssets are bought / minted.
event TokenBought(
address indexed from,
address indexed recipient,
uint256 amountIn,
uint256 amountOut
); from*
address
Address of buyer / minter
recipient*
address
Receiver of minted ibAssets
amountIn
uint256
Reserve asset amount used in buy
amountOut
uint256
ibAsset amount minted from buy
* = indexable
TokenSold
TokenSoldEmitted when ibAssets are sold / burnt.
event TokenSold(
address indexed from,
address indexed recipient,
uint256 amountIn,
uint256 amountOut
); from*
address
Address of seller / burner
recipient*
address
Receiver of returned reserve assets
amountIn
uint256
ibAsset amount burnt in sell
amountOut
uint256
Reserve asset amount returned in sell
* = indexable
RewardClaimed
RewardClaimedEmitted when accrued LP and ibAsset staking rewards are claimed.
event RewardClaimed(
address indexed from,
address indexed recipient,
uint256 inverseTokenAmount,
uint256 reserveAmount
); from*
address
Address of reward claimer
recipient*
address
Address receiving claimed rewards
inverseTokenAmount
uint256
Amount of rewards in ibAssets
reserveAmount
uint256
Amount of rewards in reserve assets
* = indexable
State-Changing Functions
addLiquidity
addLiquidityAdds liquidity reserves to the inverse bonding curve.
function addLiquidity(
address recipient,
uint256 reserveIn,
uint256[2] memory priceLimits
) external whenNotPaused recipient
address
Address to receive LP tokens
reserveIn
uint256
Amount of reserve assets provided for liquidity add
priceLimits
uint256[2]
Minimum and maximum ibAsset prices to conduct LP - reverts if ibAsset price is lower or higher than specified values
removeLiquidity
removeLiquidityRemoves liquidity reserves from the inverse bonding curve.
function removeLiquidity(
address recipient,
uint256 inverseTokenIn,
uint256[2] memory priceLimits
) external whenNotPaused recipient
address
Address to receive removed reserve assets
inverseTokenIn
uint256
Amount of additional ibAssets posted for LP removal
priceLimits
uint256[2]
Minimum and maximum ibAsset prices to conduct LP - reverts if ibAsset price is lower or higher than specified values
buyTokens
buyTokensBuys / mints new ibAsset tokens with provided reserve assets.
function buyTokens(
address recipient,
uint256 reserveIn,
uint256 exactAmountOut,
uint256[2] memory priceLimits,
uint256[2] memory reserveLimits
) external whenNotPaused recipient
address
Address to receive minted ibAssets
reserveIn
uint256
Amount of reserve assets provided for minting
exactAmountOut
uint256
Exact amount ibAssets to be minted
priceLimits
uint256[2]
Minimum and maximum effective ibAsset buy prices to conduct buy - reverts if buy price is lower or higher than specified values
reserveLimits
uint256[2]
Minimum and maximum curve reserve amounts to conduct buy - reverts if the curve's reserves are lower or higher than specified values
sellTokens
sellTokensSells / burns ibAsset tokens to receive reserve assets.
function sellTokens(
address recipient,
uint256 inverseTokenIn,
uint256[2] memory priceLimits,
uint256[2] memory reserveLimits
) external whenNotPaused recipient
address
Address to receive reserve assets
inverseTokenIn
uint256
Amount of ibAssets to burn
priceLimits
uint256[2]
Minimum and maximum effective ibAsset sell prices to conduct sell - reverts if sell price is lower or higher than specified values
reserveLimits
uint256[2]
Minimum and maximum curve reserve amounts to conduct sell - reverts if the curve's reserves are lower or higher than specified values
stake
stakeStakes specified amount of ibAssets.
function stake(address recipient, uint256 amount) external whenNotPaused recipient
address
Address to stake ibAssets to
amount
uint256
Amount of ibAssets to stake
unstake
unstakeUnstakes specified amount of ibAssets.
function unstake(address recipient, uint256 amount) external whenNotPaused recipient
uint256
Address to receive unstaked ibAssets
amount
uint256
Amount of ibAssets to unstake
claimReward
claimRewardClaims accrued LP and staking rewards.
function claimReward(address recipient) external whenNotPaused recipient
address
Address to receive accrued rewards
Read-Only Functions
liquidityPositionOf
liquidityPositionOfGets the LP position data for the specified address.
function liquidityPositionOf(address account) external view returns (
uint256 lpTokenAmount,
uint256 inverseTokenCredit
)account
address
Address of account to fetch LP position information
lpTokenAmount
uint256
Amount of LP Tokens owned by account
inverseTokenCredit
uint256
Amount of ibAsset credit owned by account
stakingBalanceOf
stakingBalanceOfGets the staked ibAsset amount for the specified address.
function stakingBalanceOf(address account) external view returns (uint256) account
address
Address of holder to get ibAsset staking balance
uint256
Amount of staked ibAssets
inverseTokenAddress
inverseTokenAddressGets the contract address of the relevant ibAsset token contract.
function inverseTokenAddress() external view returns (address)address
Contract address of the relevant ibAsset token contract
reserveTokenAddress
reserveTokenAddressGets the contract address of the relevant reserve asset token contract.
function reserveTokenAddress() external view returns (address)address
Contract address of the relevant reserve asset token contract
curveParameters
curveParametersGets the parameter values of the inverse bonding curve.
function curveParameters() external view returns (CurveParameter memory parameters) parameters
CurveParameter
Inverse bonding curve parameters
CurveParameters
struct CurveParameter {
uint256 reserve;
uint256 supply;
uint256 lpSupply;
uint256 price;
uint256 parameterInvariant;
}reserve
uint256
Liquidity reserve of curve
supply
uint256
ibAsset minted supply
lpSupply
uint256
Current total supply of LP tokens
price
uint256
Current spot price of ibAsset
parameterInvariant
uint256
Current curve invariant of curve
rewardOf
rewardOfGets the accrued reward amounts for the specified address.
function rewardOf(address recipient) external view returns (
uint256 inverseTokenForLp,
uint256 inverseTokenForStaking,
uint256 reserveForLp,
uint256 reserveForStaking,
)recipient
address
Address to check accrued rewards
inverseTokenForLp
uint256
Accrued ibAsset rewards for LP position
inverseTokenForStaking
uint256
Accrued ibAsset rewards for staked ibAssets
reserveForLp
uint256
Accrued reserve asset rewards for LP position
reserveForStaking
uint256
Accrued reserve asset rewards for staked ibAssets
rewardOfProtocol
rewardOfProtocolGets the accrued reward amounts of the protocol creator.
function rewardOfProtocol() external view returns (
uint256 inverseTokenReward,
uint256 reserveReward
) inverseTokenReward
uint256
Accrued ibAsset rewards to protocol creator
reserveReward
uint256
Accrued reserve asset rewards to protocol creator
totalStaked
totalStakedGets the total staked ibAsset amount.
function totalStaked() external view returns (uint256)uint256
Total amount of staked ibAssets
rewardEMAPerSecond
rewardEMAPerSecondGets the EMA-adjusted per-token per-second reward amounts for the specified reward type.
function blockRewardEMA(RewardType rewardType) external view returns (
uint256 inverseTokenReward,
uint256 reserveReward
)inverseTokenReward
uint256
Per-second amount of ibAsset rewards accrued per-token for the specified reward type
reserveReward
uint256
Per-second amount of reserve asset rewards accrued per-token for the specified reward type
rewardState
rewardStateGets the total reward information for the entire protocol.
function rewardState() external view returns (
uint256[MAX_FEE_TYPE_COUNT][MAX_FEE_STATE_COUNT] memory totalReward,
uint256[MAX_FEE_TYPE_COUNT][MAX_FEE_STATE_COUNT] memory totalPendingReward
)totalReward
uint256[MAX_FEE_TYPE_COUNT][MAX_FEE_STATE_COUNT]
Total reward amount accrued
totalPendingReward
uint256[MAX_FEE_TYPE_COUNT][MAX_FEE_STATE_COUNT]
Total reward amount accrued, but yet to be claimed
Last updated