or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Introduction
API
Base url: https://api.homora.alphaventuredao.io/
Swagger: https://api.homora.alphaventuredao.io/doc
Data Types
Pool
key
string
name
string
tokens
string[]
lpTokenAddress
string
poolAddress?
string
wTokenAddress
string
exchange
IExchange
type
PoolType
wTokenType
WTokenType
pid?
number
wTokenType === WTokenType.WLiquidityGauge
gid?
number
rewardSymbol?
string
exchange.reward.tokenName
rewardAddress?
string
exchange.reward.rewardTokenAddress
isFarmingDisabled?
boolean
status?
'delisting' | 'delisted'
delisting
= A pool that's going to be delisted soon.delisted
= A pool that's been delisted. For both of the statuses, we'd recommend users to close their position.stakingAddress?
string
spellAddress?
string
spellAddress
fromexchange.spellAddress
migrateTo?
string
uniswapV3Info
UniswapV3Pool
IExchange
name
Exchange
logo
string
spellAddress?
string
stakingAddress?
string
reward
IExchangeReward
IExchangeReward
tokenName
string
rewardTokenAddress
string
Safebox
address
string
safeboxAddress
string
cyTokenAddress
string
PoolAPY
totalAPY
string
tradingFeeAPY
string
farminigAPY
string
TokenDetails
name
string
logo
string
decimals
number
UniswapV3Pool
priceRatioBps
[number, number, number]
poolFeeBps
number
tickSpacing
number
(1 / 10 / 60 / 200)
UniswapV3PriceRangeInfo
lastUpdatedTimestamp
number
lastUpdatedTick
number
priceRanges
[PriceRange, PriceRange, PriceRange]
PriceRange
apr
number
lower
TickInfo
upper
TickInfo
TickInfo
tick
number
price0
string
price1
string
UniswapV3Position
positionId
string
tickLower
number
tickUpper
number
liquidity
string
apr
number
Enum
PoolType
Exchange
WTokenType
API Endpoint
Farm Pools
To get all of the farming pools of each chain.
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/pools
Example: https://api.homora.alphaventuredao.io/v2/43114/pools
return type: Pool[]
Lend Pools
To get all of the lending pools of each chain
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/safeboxes
Example: https://api.homora.alphaventuredao.io/v2/43114/safeboxes
return type: Safebox[]
APYs
To get all of the farming pool's APYs of each chain (except for UniswapV3 Pools)
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/apys
Example: https://api.homora.alphaventuredao.io/v2/43114/apys
return type: Record<string, PoolAPY> //
Record<Pool's key, PoolAPY>
Token Details
To get all of the token details with the name and decimals of each chain
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/tokens
Example: https://api.homora.alphaventuredao.io/v2/43114/tokens
return type: Record<string, TokenDetails> //
Record<Token's address, TokenDetails>
All Positions
To get all of the positions sorted by highest to lowest debt ratio of each chain. Only use with liquidation page only.
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/positions
Example: https://api.homora.alphaventuredao.io/v2/43114/positions
(UniswapV3) Pool's price range & APR
To get all of the Uniswap V3 pool's price ranges and APRs
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/uniswapv3/price-range
Example: https://api.homora.alphaventuredao.io/v2/10/uniswapv3/price-range
return type: Record<string, UniswapV3PriceRangeInfo> //
Record<Pool's key, UniswapV3PriceRangeInfo>
(UniswapV3) Positions Info
To get user's Uniswap V3 position info
Endpoint:
https://api.homora.alphaventuredao.io/v2/[chainId]/uniswapv3/positions
Example: https://api.homora.alphaventuredao.io/v2/10/uniswapv3/positions
return type: Record<string, UniswapV3Position> //
Record<Homora position ID, UniswapV3Position>
Subgraph
Endpoint
Query
Data
id
: Position IDowner
: Position owner addresscollateralSize
: The size of the collateral (if 0 then the position is closed because there's no collateral left)collateralToken - token
: Wrap token contract address. It's an ERC-1155 contract that keep user positions.collateralToken - token
: Token ID that determine the position info like LP address or PID.Calculation
Pool's Best Leverage
The pool's best leverage is calculated by borrowing each token to the maximum borrowing amount and check that which one gives the best APY, then use that leverage as the pool's max leverage.
*Please note that the pool best leverage showing in the Homora V2's UI aren't always the pool max leverage because in some situation, the borrow APY is quite high from high utilization of the lending pool so the UI won't suggest that leverage.
tokenMaxLeverage
or the max leverage of each borrowing token is calculated as:*Default
cappedDebtRatio
is set to0.95
Read more about collateral and borrow credit.
The total APY of that
tokenMaxLeverage
is calculated as:*The rewardAPY and borrowAPY is multiplied by (maxLeverage-1) because the interest only happens when the leverage is >1
Then compared totalAPY of each borrowing token (also with the totalAPY if has no leverage) to see which one gives the best APY.
Contracts
https://hackmd.io/@PhhCdDESRme9EK6zwT-9Pw/BJsYdyrw9