Skip to content

Commit ed53a5a

Browse files
Add CANA Holdings California Carbon Credits
1 parent 07fc4a8 commit ed53a5a

File tree

1 file changed

+86
-0
lines changed
  • projects/cana-holdings-california-carbon-credits

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
const sdk = require('@defillama/sdk');
2+
const ADDRESSES = require('../helper/coreAssets.json');
3+
4+
// CANA Holdings California Carbon Credits
5+
// Website: https://maseer.finance/
6+
// Live Token Info: https://cana.maseer.finance/
7+
// Dune Analytics: https://maseer.finance/dune
8+
// CoinGecko ID: cana-holdings-california-carbon-credits
9+
const CANA_CONTRACT_ADDRESS = "0x01995A697752266d8E748738aAa3F06464B8350B";
10+
const AUTHORIZED_ISSUER_ADDRESS = "0xb56F413dbCe352cfd71f221029CFC84580133F66";
11+
12+
async function tvl(api) {
13+
const balances = {};
14+
15+
try {
16+
// Get total supply of CANA tokens
17+
const totalSupply = await api.call({
18+
target: CANA_CONTRACT_ADDRESS,
19+
abi: "uint256:totalSupply"
20+
});
21+
22+
// Get authorized issuer balance to subtract from total supply
23+
const issuerBalance = await api.call({
24+
target: CANA_CONTRACT_ADDRESS,
25+
abi: "function balanceOf(address) view returns (uint256)",
26+
params: [AUTHORIZED_ISSUER_ADDRESS]
27+
});
28+
29+
// Get NAV price (in 6 decimal places, USDT denominated)
30+
const navPrice = await api.call({
31+
target: CANA_CONTRACT_ADDRESS,
32+
abi: "uint256:navprice"
33+
});
34+
35+
// Validate data - ensure navPrice is reasonable (> 0 and < $1M per token)
36+
if (navPrice === 0 || navPrice > 1000000 * (10 ** 6)) {
37+
console.warn(`CANA: Unusual NAV price detected: ${navPrice}`);
38+
return balances; // Return empty if price seems invalid
39+
}
40+
41+
// Calculate circulating supply (total supply minus issuer balance)
42+
const circulatingSupply = totalSupply - issuerBalance;
43+
44+
// Ensure circulating supply is positive
45+
if (circulatingSupply <= 0) {
46+
console.warn(`CANA: Invalid circulating supply: ${circulatingSupply}`);
47+
return balances;
48+
}
49+
50+
// Calculate TVL: circulatingSupply * navPrice
51+
// circulatingSupply is in 18 decimals (ERC20 standard)
52+
// navPrice is in 6 decimals (USDT terms)
53+
// Result should be in USDT base units (6 decimals)
54+
const tvlInUSDT = (circulatingSupply * navPrice) / (10 ** 18);
55+
56+
// Add to balances using USDT address
57+
sdk.util.sumSingleBalance(
58+
balances,
59+
ADDRESSES.ethereum.USDT,
60+
tvlInUSDT,
61+
api.chain
62+
);
63+
64+
} catch (error) {
65+
console.error(`CANA TVL calculation failed: ${error.message}`);
66+
// Return empty balances on error to prevent adapter from breaking
67+
}
68+
69+
return balances;
70+
}
71+
72+
73+
module.exports = {
74+
methodology: "TVL is calculated by multiplying the circulating supply of CANA tokens (total supply minus authorized issuer balance) by their NAV price (in USDT terms). CANA represents tokenized California compliance carbon credits.",
75+
doublecounted: false, // Ensures accurate TVL accounting across DeFi
76+
start: '2025-06-20', // Jun-20-2025 07:48:47 PM +UTC
77+
ethereum: {
78+
tvl: tvl
79+
},
80+
hallmarks: [
81+
[1750651727, "CANA Protocol Launch"], // Jun-20-2025 07:48:47 PM +UTC
82+
[1752217391, "First Token Issuance"], // Jul-10-2025 04:03:11 PM UTC
83+
// Add other important events in your protocol's history
84+
// Format: [timestamp, "Description"]
85+
]
86+
};

0 commit comments

Comments
 (0)