Skip to content

Commit

Permalink
refactor ascend #12666
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Dec 11, 2024
1 parent 6ab9c28 commit 9517c1c
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions projects/ascentyield/index.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require("../helper/solana");
const { post } = require('../helper/http');
const { sumTokensExport } = require("../helper/unwrapLPs")


const hyperliquidSubAccount = "0x75b2e5c67d2116bcf1b77c5e6444fc18bc5d38a4" // for trading at hyperliquid
const jlpholder = "9nAgg9wAnuiPv57dXkmCwoGhhbTHS1RRzvYLjnRGZtXp" // for keeping JLP and USDC(buy JLP)
const arbiusdcholder = "0xa6Ff9a77D6bD8B0a759055Cd8885e23228bc10Ec" // USDC on arbi(will bridge to solana)
const hyperliquidMainAccount = "0x7151609Fdc7E0Cac89FB9720F0957AF9d552f8f9" // will transfer USDC to sub account


module.exports = {
methodology: "Aggregate trading account margins in HyperLiquid and JLP, USDC on the solana network.",
solana: {
tvl: async (api) => {
return sumTokens2({
owner: jlpholder
});
},
},
hyperliquid: {
tvl: async (api) => {
let data = await post('https://api.hyperliquid.xyz/info', {
type: "clearinghouseState",
user: hyperliquidSubAccount
})
data = parseInt(data.marginSummary.accountValue)
api.addCGToken('usd-coin', data)
}
},
arbitrum: {
tvl: sumTokensExport({
owners: [arbiusdcholder, hyperliquidMainAccount],
tokens: [ADDRESSES.arbitrum.USDC_CIRCLE,]
})
},
misrepresentedTokens: true,
doublecounted: true,
methodology: "Aggregate trading account margins in HyperLiquid and JLP, USDC on the solana network.",
arbitrum: {
tvl
},
};


async function tvl(api) {
// hyperliquid tvl
let data = await post('https://api.hyperliquid.xyz/info', { type: "clearinghouseState", user: hyperliquidSubAccount })
data = parseInt(data.marginSummary.accountValue)
api.addCGToken('usd-coin', data)

// solana tvl
await sumTokens2({ balances: api.getBalances(), owner: jlpholder })

return api.sumTokens({ owners: [arbiusdcholder, hyperliquidMainAccount], tokens: [ADDRESSES.arbitrum.USDC_CIRCLE,] })
}

0 comments on commit 9517c1c

Please sign in to comment.