How to write an SDK adapter
Adapters 101
Basic adapter
const MINT_TOKEN_CONTRACT = '0x1f3Af095CDa17d63cad238358837321e95FC5915';
const MINT_CLUB_BOND_CONTRACT = '0x8BBac0C7583Cc146244a18863E708bFFbbF19975';
async function tvl(api) {
const collateralBalance = await api.call({
abi: 'erc20:balanceOf',
target: MINT_TOKEN_CONTRACT,
params: [MINT_CLUB_BOND_CONTRACT],
});
api.add(MINT_TOKEN_CONTRACT, collateralBalance)
}
module.exports = {
methodology: 'counts the number of MINT tokens in the Club Bonding contract.',
start: 1000235,
bsc: {
tvl,
}
}; Line 4 - Input Parameter:
Line 5 - On Chain Function Calls
Line 11 - Adding Data To The Balances Object
Line 23 - Module Exports
Testing
Submit 🎉
Last updated
Was this helpful?
