block-quote On this pagechevron-down
copy Copy chevron-down
π Deep DiveποΈ Integration 101Common contract integration points.
You can find deployed contracts addresses and interfaces in Deployed Addresses .
Get list of all the Dens
Copy // IndexManager.sol
struct IIndexAndStatus {
address index ;
bool verified ;
}
function allIndexes () external view returns ( IIndexAndStatus [] memory ); circle-exclamation
If the Den is not verified it's better not to interact with it, as it may have been unverified for security reasons.
Get Den Info (CBR, fees)
Copy // IndexLens.sol
struct Fees {
uint16 burn ;
uint16 bond ;
uint16 debond ;
uint16 buy ;
uint16 sell ;
}
struct DenInfoMutable {
uint cbr ;
Fees fees ;
address [] tokens ;
address pairedToken ;
[...]
}
function getIndexImmutableInfo ( address _indexAddress ) external view returns ( DenInfoImmutable memory info_ ); Returns DenInfoImmutable struct with Den info which cannot change:
cbr as a number with 18 decimals.
fees struct with all the fees except partner fee (taken on top of other fees, transparent to the user)
tokens array of underlying assets (currently Arbera supports only 1 asset Dens).
pairedToken address of the Paired LP Token (currently HONEY or WBERA).
And many more β check out IndexLens.sol verified contract code.
Calculate CBR (Manual)
To get CBR just divide underlying.balanceOf(index) by index.totalSupply() .
If totalSupply is 0 or there is no underlying token deposited it should default to 1e18.
Get amount of brTOKEN received by wrapping TOKEN
_index β address of the Den token.
_token β underlying asset of the Den.
_amount β amount of underlying _token to wrap.
Returns amounts of brTOKEN received (after fees and accounting for CBR).
Get amount of TOKEN received by unwrapping brTOKEN
_index β address of the Den token.
_amount β amount of underlying _index to unwrap.
Returns array of token addresses and array of amounts.
Wrap TOKEN into brTOKEN
token β underlying token address
amount β amount to wrap.
amountMintMin β minimum amount to receive (considdering fees and CBR).
Unwrap brTOKEN into TOKEN
amount β amount to wrap.
amountMintMin β minimum amount to receive (considering fees and CBR).
Add liquidity without fees
idxTokens β amount of Den tokens (brTOKEN).
daiTokens β amount of paired LP Token (currently DAI or WBERA).
slippage β slippage as number with 4 decimals, ie. 100 = 1%
deadline β deadline timestamp for providing liquidity.
Remove liquidity without fees
idxTokens β amount of Den tokens (brTOKEN).
daiTokens β amount of paired LP Token (currently DAI or WBERA).
slippage β slippage as number with 4 decimals, ie. 100 = 1%
deadline β deadline timestamp for providing liquidity.
Flash loan underlying tokens
You need to implement IFlashLoanRecipient interface.
Last updated 11 months ago