mirror of
https://github.com/cerc-io/mars-interface.git
synced 2024-12-22 12:17:45 +00:00
Merge pull request #14 from mars-protocol/hofix/farm-apr
fix: fixed the farm borrowing apr
This commit is contained in:
commit
193bb0f2d6
@ -91,7 +91,9 @@ export const useAvailableVaultsColumns = () => {
|
||||
const borrowAsset = redBankAssets.find(
|
||||
(asset) => asset.denom === row.original.denoms.secondary,
|
||||
)
|
||||
const maxBorrowRate = Number(borrowAsset?.borrowRate ?? 0) * row.original.ltv.max
|
||||
const maxBorrowRate =
|
||||
Number(borrowAsset?.borrowRate ?? 0) * (ltvToLeverage(row.original.ltv.max) - 1)
|
||||
|
||||
const minAPY = new BigNumber(row.original.apy).toNumber()
|
||||
|
||||
const maxAPY = new BigNumber(minAPY).times(maxLeverage).toNumber() - maxBorrowRate
|
||||
|
@ -209,7 +209,8 @@ export const BreakdownTable = (props: Props) => {
|
||||
const currentLeverage = props.newPosition.currentLeverage
|
||||
|
||||
const trueBorrowRate =
|
||||
(Number(secondaryRedBankAsset?.borrowRate ?? 0) / 2) * (Number(currentLeverage) - 1)
|
||||
Number(secondaryRedBankAsset?.borrowRate ?? 0) * (Number(currentLeverage) - 1)
|
||||
|
||||
const apy = (props.vault.apy || 0) * currentLeverage - trueBorrowRate
|
||||
|
||||
const apyData = {
|
||||
|
@ -1,24 +1,18 @@
|
||||
@import 'src/styles/master';
|
||||
.primary,
|
||||
.secondary {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.primary {
|
||||
position: absolute;
|
||||
margin-top: space(-1);
|
||||
left: 20%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.secondary {
|
||||
position: absolute;
|
||||
margin-top: space(1);
|
||||
right: 20%;
|
||||
top: 20%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: $bpMediumLow) {
|
||||
.primary {
|
||||
top: 20%;
|
||||
}
|
||||
|
||||
.secondary {
|
||||
top: unset;
|
||||
bottom: 20%;
|
||||
}
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ export const vaultsSlice = (set: NamedSet<Store>, get: GetState<Store>): VaultsS
|
||||
const networkConfig = get().networkConfig
|
||||
if (!networkConfig) return null
|
||||
|
||||
try {
|
||||
const response = await fetch(networkConfig!.apolloAprUrl)
|
||||
|
||||
if (response.ok) {
|
||||
@ -176,6 +177,9 @@ export const vaultsSlice = (set: NamedSet<Store>, get: GetState<Store>): VaultsS
|
||||
}
|
||||
|
||||
return null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
},
|
||||
getCaps: async (options?: Options) => {
|
||||
const caps = get().caps
|
||||
@ -360,7 +364,7 @@ export const vaultsSlice = (set: NamedSet<Store>, get: GetState<Store>): VaultsS
|
||||
const borrowRate =
|
||||
redBankAssets.find((asset) => asset.denom === curr.denoms.secondary)?.borrowRate || 0
|
||||
|
||||
const trueBorrowRate = (borrowRate / 2) * (leverage - 1)
|
||||
const trueBorrowRate = (leverage - 1) * borrowRate
|
||||
|
||||
const getPositionStatus = (unlockTime?: number) => {
|
||||
if (!unlockTime) return 'active'
|
||||
|
Loading…
Reference in New Issue
Block a user