Skip to content
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a3e3bb1
Add GAIB protocol support for multiple chains with TVL calculation (#…
whereissam Jul 16, 2025
b8e1cf5
refactor: Remove commented-out code for story token and poolToken
samgaib Jul 16, 2025
414f9b9
refactor: Update mainnetContracts by removing plume and adding sty su…
whereissam Jul 23, 2025
6ed0c0c
Merge branch 'DefiLlama:main' into main
samgaib Jul 23, 2025
61b53af
Merge branch 'DefiLlama:main' into main
samgaib Aug 5, 2025
7d72736
refactor: remove sei and sty support
samgaib Aug 5, 2025
65eeaf8
refactor: simplify totalAssetsABI definition in GAIB protocol
samgaib Aug 6, 2025
f81d9c8
Merge branch 'DefiLlama:main' into main
samgaib Aug 6, 2025
96d1551
Merge branch 'DefiLlama:main' into main
samgaib Aug 21, 2025
0d85031
feat: reintroduce sei and sty support with new token configurations i…
samgaib Aug 21, 2025
ee91cd7
Merge branch 'DefiLlama:main' into main
samgaib Aug 22, 2025
4338c62
Merge branch 'DefiLlama:main' into main
samgaib Sep 24, 2025
78f3c56
Enhance GAIB protocol by adding BSC support with new token pools for …
samgaib Sep 24, 2025
4c652f5
Merge branch 'DefiLlama:main' into main
samgaib Sep 28, 2025
29ab179
Update mainnet contract tokens for USDC and USDT in GAIB protocol
samgaib Sep 28, 2025
392c509
Merge remote-tracking branch 'refs/remotes/origin/main'
samgaib Sep 28, 2025
562916f
Merge branch 'DefiLlama:main' into main
samgaib Nov 13, 2025
809768e
Merge branch 'DefiLlama:main' into main
samgaib Nov 27, 2025
31a02f3
feat: add new AID & sAID token
samgaib Nov 27, 2025
3402fad
Merge remote-tracking branch 'refs/remotes/origin/main'
samgaib Nov 27, 2025
ac7aaf4
Merge branch 'DefiLlama:main' into main
samgaib Nov 28, 2025
0f210bd
Merge branch 'DefiLlama:main' into main
samgaib Nov 28, 2025
efa00e9
feat: remove sAID
samgaib Nov 28, 2025
cff708c
Merge remote-tracking branch 'refs/remotes/origin/main'
samgaib Nov 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 58 additions & 45 deletions projects/gaib/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
const ADDRESSES = require('../helper/coreAssets.json')
const mainnetContracts = {
const ADDRESSES = require('../helper/coreAssets.json');

// AID.v0 token address (same on all chains: Ethereum, BNB Chain, Base, Arbitrum)
const AID_TOKEN = '0x18F52B3fb465118731d9e0d276d4Eb3599D57596';

// Legacy AIDa (Alpha) pool contracts
const aidaContracts = {
ethereum: [
{
token: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42', // USDC
token: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42', // AIDaUSDC token
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
},
{
token: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340', // USDT
token: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340', // AIDaUSDT token
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340' // AIDollarAlphaUSDT Pool
},
{
Expand All @@ -20,99 +25,107 @@ const mainnetContracts = {
],
arbitrum: [
{
token: ADDRESSES.arbitrum.USDC_CIRCLE, // USDC
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
token: ADDRESSES.arbitrum.USDC_CIRCLE,
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42'
},
{
token: ADDRESSES.arbitrum.USDT, // USDT
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340' // AIDollarAlphaUSDT Pool
token: ADDRESSES.arbitrum.USDT,
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340'
}
],
base: [
{
token: ADDRESSES.base.USDC, // USDC
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
token: ADDRESSES.base.USDC,
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42'
}
],
sei: [
{
token: '0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392', // USDC
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42'
},
{
token: '0x9151434b16b9763660705744891fA906F660EcC5', // USDT
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340' // AIDollarAlphaUSDT Pool
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340'
}
],
sty: [
{
token: ADDRESSES.flow.stgUSDC, // USDC
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
token: '0xF1815bd50389c46847f0Bda824eC8da914045D14', // USDC
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42'
}
],
bsc: [
{
token: ADDRESSES.bsc.USD1, // USD1
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSD1 Pool
token: '0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d', // USD1
poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42'
},
{
token: ADDRESSES.bsc.USDT, // USDT
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340' // AIDollarAlphaUSDT Pool
token: '0x55d398326f99059ff775485246999027b3197955', // USDT
poolToken: '0xDc45e7027A0489FE6C2E4A0735097d8E6952A340'
}
]
};

const totalSupplyABI = "function totalSupply() external view returns (uint256)";
const totalAssetsABI = "function totalAssets() external view returns (uint256)";
const balanceOfABI = "function balanceOf(address) external view returns (uint256)";

async function tvl(api) {
// Legacy AIDa (Alpha) pool TVL
async function aidaTvl(api) {
const chain = api.chain;
const pools = aidaContracts[chain];

const poolsForChain = mainnetContracts[chain];
if (pools && pools.length > 0) {
const totalAssetsAmounts = await api.multiCall({
abi: totalAssetsABI,
calls: pools.map(p => p.poolToken),
});

if (!poolsForChain || poolsForChain.length === 0) {
console.warn(`No configured contract data for chain: ${chain}. Skipping TVL calculation.`);
return {};
totalAssetsAmounts.forEach((amount, index) => {
api.add(pools[index].token, amount);
});
}

const calls = poolsForChain.map(poolInfo => ({
target: poolInfo.poolToken,
}));

const totalAssetsAmounts = await api.multiCall({
abi: totalAssetsABI,
calls: calls,
});
return api.getBalances();
}

totalAssetsAmounts.forEach((amount, index) => {
const underlyingToken = poolsForChain[index].token;
api.add(underlyingToken, amount);
// AID total supply on chain
async function aidSupply(api) {
const supply = await api.call({
abi: totalSupplyABI,
target: AID_TOKEN,
});

api.add(`ethereum:${AID_TOKEN}`, supply, { skipChain: true });
return api.getBalances();
}

module.exports = {
methodology: 'Counts the total underlying assets (e.g., USDC, USDT, USR, CUSDO, USD1) reported by GAIB protocol pool contracts using their `totalAssets()` function across supported mainnet chains.',
methodology: 'Tracks: 1) Legacy AIDa (Alpha) pool TVL using totalAssets(), 2) AID.v0 total supply across all chains.',
start: 1715490671,
timetravel: true,
misrepresentedTokens: false,
misrepresentedTokens: true,

ethereum: {
tvl,
tvl: aidaTvl,
ownTokens: aidSupply,
},
arbitrum: {
tvl,
tvl: aidaTvl,
ownTokens: aidSupply,
},
base: {
tvl,
tvl: aidaTvl,
ownTokens: aidSupply,
},
bsc: {
tvl: aidaTvl,
ownTokens: aidSupply,
},
sei: {
tvl,
tvl: aidaTvl,
},
sty: {
tvl,
},
bsc: {
tvl,
tvl: aidaTvl,
},
};
Loading