Skip to content

Commit

Permalink
Hashnote update (#12689)
Browse files Browse the repository at this point in the history
Co-authored-by: twothirtyfive <[email protected]>
  • Loading branch information
g1nt0ki and twothirtyfive authored Dec 12, 2024
1 parent 8bca827 commit 3f1c023
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
29 changes: 22 additions & 7 deletions projects/hashnote/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
const { call } = require('../helper/chain/near')
const { get } = require("../helper/http");

const NEAR = '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b'
const USYC = '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b'

const CONFIG = {
canto: '0xfb8255f0de21acebf490f1df6f0bdd48cc1df03b',
ethereum: NEAR,
near: 'usyc.near'
ethereum: USYC,
near: 'usyc.near',
noble: 'uusyc'
}

const evmTvl = async (api, token) => {
const supply = await api.call({ target: token, abi: 'erc20:totalSupply' })
api.add(NEAR, supply, { skipChain: true })
api.add(USYC, supply, { skipChain: true })
}

const nonEvmTvl = async (api, token) => {
const supply = await call(token, 'ft_total_supply', {});
api.add(NEAR, supply, { skipChain: true })
api.add(USYC, supply, { skipChain: true });
}

const nobleTvl = async (api, token) => {
const res = await get(`https://rest.cosmos.directory/noble/cosmos/bank/v1beta1/supply/by_denom?denom=${token}`);
api.add(USYC, parseInt(res.amount.amount), { skipChain: true });
}

Object.entries(CONFIG).forEach(([chain, address]) => {
module.exports[chain] = {
tvl: async (api) => (chain === 'near' ? nonEvmTvl(api, address) : evmTvl(api, address))
tvl: async (api) => {
if (chain === 'near') {
return nonEvmTvl(api, address);
} else if (chain === 'noble') {
return nobleTvl(api, address);
} else {
return evmTvl(api, address);
}
}
};
});
});
1 change: 0 additions & 1 deletion projects/helper/coreAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,6 @@
"noble": {
"USDC": "uusdc",
"USDY": "ausdy",
"uusdc": "uusdc",
"ausdy": "ausdy"
},
"ripple": {
Expand Down

0 comments on commit 3f1c023

Please sign in to comment.