Skip to content

Commit

Permalink
Merge pull request DefiLlama#1360 from HipoFinance/master
Browse files Browse the repository at this point in the history
Update Hipo to v2
  • Loading branch information
dtmkeng authored Mar 27, 2024
2 parents 91adbe7 + 80fc444 commit 63eae52
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions fees/hipo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CHAIN } from '../../helpers/chains'
import { postURL } from '../../utils/fetchURL'
import * as sdk from '@defillama/sdk'

const address = 'EQBNo5qAG8I8J6IxGaz15SfQVB-kX98YhKV_mT36Xo5vYxUa'
const address = 'EQCLyZHP4Xe8fpchQz76O-_RmUhaVc_9BAoGyJrwJrcbz2eZ'

export default {
adapter: {
Expand All @@ -12,49 +12,42 @@ export default {
meta: {
hallmarks: [
[1698685200, 'Hipo Launch'],
[1710821940, 'Hipo v2'],
],
methodology: {
UserFees: 'Stakers pay no fees for using Hipo.',
ProtocolRevenue: 'Hipo receives a small fee before distributing rewards to stakers.',
SupplySideRevenue: 'Stakers receive the rest of the rewards, after deducting validators share and protocol fee.',
HoldersRevenue: 'Currently there is not government token.',
HoldersRevenue: 'Currently there is no governance token.',
Revenue: 'All generated revenue is from protocol fee.',
Fees: 'The total reward is calculated after deducting validators share, so it is the stakers revenue plus protocol revenue.',
},
},
fetch: async () => {
const response1 = await postURL('https://toncenter.com/api/v2/runGetMethod', {
const getTreasuryState = await postURL('https://toncenter.com/api/v3/runGetMethod', {
address,
method: 'get_treasury_state',
stack: [],
})
if (!response1.ok) {
throw new Error('Error in calling toncenter.com/api/v2/runGetMethod')
}
const getTreasuryState = response1.result
if (getTreasuryState.exit_code !== 0) {
throw new Error('Expected a zero exit code, but got ' + getTreasuryState.exit_code)
}

const response2 = await postURL('https://toncenter.com/api/v2/runGetMethod', {
const getTimes = await postURL('https://toncenter.com/api/v3/runGetMethod', {
address,
method: 'get_times',
stack: [],
})
if (!response2.ok) {
throw new Error('Error in calling toncenter.com/api/v2/runGetMethod')
}
const getTimes = response2.result
if (getTimes.exit_code !== 0) {
throw new Error('Expected a zero exit code, but got ' + getTimes.exit_code)
}

const lastStaked = Number(getTreasuryState.stack[5][1])
const lastRecovered = Number(getTreasuryState.stack[6][1])
const governanceFee = Number(getTreasuryState.stack[16][1])
const lastStaked = Number(getTreasuryState.stack[11].value)
const lastRecovered = Number(getTreasuryState.stack[12].value)
const governanceFee = Number(getTreasuryState.stack[16].value)

const currentRoundSince = Number(getTimes.stack[0][1])
const nextRoundSince = Number(getTimes.stack[3][1])
const currentRoundSince = Number(getTimes.stack[0].value)
const nextRoundSince = Number(getTimes.stack[3].value)

const duration = nextRoundSince - currentRoundSince
const normalize = normalizer(duration)
Expand Down

0 comments on commit 63eae52

Please sign in to comment.