add asseto token ngi+#19940
Conversation
📝 WalkthroughWalkthroughThis PR adds a new DeFiLlama adapter for the Asseto NGI+ token, defining chain-specific token configurations for ethereum, bsc, and pharos. It fetches the token price from an on-chain oracle, computes TVL using total supply, and exports a tvl function per chain plus a methodology string. ChangesAsseto NGI+ Adapter
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Adapter as tvl(api)
participant Token as NGI+ Token Contract
participant Oracle as Price Feed Oracle
Adapter->>Token: totalSupply()
Adapter->>Token: decimals()
Adapter->>Oracle: latestRoundData()
Adapter->>Oracle: decimals()
Oracle-->>Adapter: normalized price
Adapter->>Adapter: compute normalized supply × price
Adapter->>Adapter: api.addUSDValue(tvl)
Related Issues: None specified. Related PRs: None specified. Suggested labels: new-adapter Suggested reviewers: None specified. 🐰 A new token hops into view, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The adapter at projects/asseto-ngiplus exports TVL: |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
projects/asseto-ngiplus/index.js (2)
24-33: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAvoid precision loss when converting large
totalSupplyto Number.
Number(supply)converts a BigInt to a JS Number before dividing. For an 18-decimal token, any supply above ~9e15 atomic units exceedsNumber.MAX_SAFE_INTEGER, causing silent precision loss in the TVL figure. Divide with BigInt first, then convert.♻️ Proposed fix using BigInt division
async function tvl(api) { const token = config[api.chain] const [supply, tokenDecimals, price] = await Promise.all([ api.call({ target: token, abi: 'erc20:totalSupply' }), api.call({ target: token, abi: 'erc20:decimals' }), getPrice(api), ]) - api.addUSDValue((Number(supply) / 10 ** Number(tokenDecimals)) * price) + const supplyBigInt = BigInt(supply) + const divisor = 10n ** BigInt(tokenDecimals) + const tokenSupply = Number(supplyBigInt / divisor) + Number(supplyBigInt % divisor) / Number(divisor) + api.addUSDValue(tokenSupply * price) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@projects/asseto-ngiplus/index.js` around lines 24 - 33, The tvl function is converting the ERC20 total supply to a Number too early, which can silently lose precision for large balances. Update the logic in tvl to keep the api.call result as BigInt/integer math while scaling by tokenDecimals first, then convert to a JS Number only for the final USD calculation passed to api.addUSDValue. Use the existing tvl, api.call, and api.addUSDValue flow as the place to make this change.
12-22: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winNo staleness check on oracle
updatedAt.
latestRoundDatareturnsupdatedAtbut it's ignored. If the oracle feed goes stale, the adapter will report an outdated price as current TVL. Consider checking thatupdatedAtis within an acceptable window.🛡️ Suggested staleness guard
async function getPrice(api) { const ethApi = api.chain === 'ethereum' ? api : new sdk.ChainApi({ chain: 'ethereum', timestamp: api.timestamp }) - const [{ answer }, decimals] = await Promise.all([ + const [{ answer, updatedAt }, decimals] = await Promise.all([ ethApi.call({ target: priceFeed, abi: latestRoundData }), ethApi.call({ target: priceFeed, abi: 'uint8:decimals' }), ]) + const staleThreshold = 24 * 60 * 60 // 24 hours + if (api.timestamp && Number(updatedAt) < api.timestamp - staleThreshold) { + throw new Error('NGI+ oracle price is stale') + } const price = Number(answer) / 10 ** Number(decimals) if (price <= 0) throw new Error('Invalid NGI+ price') return price }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@projects/asseto-ngiplus/index.js` around lines 12 - 22, The price oracle lookup in getPrice currently ignores latestRoundData.updatedAt, so add a staleness guard before returning the NGI+ price. Update getPrice to read updatedAt alongside answer, then validate it against an acceptable freshness window and throw if the feed is stale; keep the existing price/decimals handling and use the getPrice and latestRoundData symbols to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@projects/asseto-ngiplus/index.js`:
- Around line 24-33: The tvl function is converting the ERC20 total supply to a
Number too early, which can silently lose precision for large balances. Update
the logic in tvl to keep the api.call result as BigInt/integer math while
scaling by tokenDecimals first, then convert to a JS Number only for the final
USD calculation passed to api.addUSDValue. Use the existing tvl, api.call, and
api.addUSDValue flow as the place to make this change.
- Around line 12-22: The price oracle lookup in getPrice currently ignores
latestRoundData.updatedAt, so add a staleness guard before returning the NGI+
price. Update getPrice to read updatedAt alongside answer, then validate it
against an acceptable freshness window and throw if the feed is stale; keep the
existing price/decimals handling and use the getPrice and latestRoundData
symbols to locate the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2ad04c33-d43e-4b61-9741-a0035f55cb41
📒 Files selected for processing (1)
projects/asseto-ngiplus/index.js
RohanNero
left a comment
There was a problem hiding this comment.
Apologies for the inconvenience, but we are currently changing how we list RWA tokens. Could you please fill out one of our submission forms instead?:
|
submitted. Let us know what the next steps are |
|
@Silas-Zhu Once submitted, there are no additional steps. The tokens should be live on the RWA dashboard within a couple of days. If the tokens are not listed or any information is incorrect, please let us know. |
|
@RohanNero Hi team I noticed that the token NGI+ we previously submitted (https://defillama.com/rwa/asset/NGI%2B) is now listed. We have a few questions regarding the token information:
Could you please look into the above? Thanks a lot. |
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
If you would like to add a
volume/fees/revenueadapter please submit the PR here.Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
For updating listing info Please send a mail to metadata@defillama.com
Please do not add new npm dependencies, do not edit/push
pnpm-lock.yamlfile as part of your changes(Needs to be filled only for new listings)
Name (to be shown on DefiLlama):
NGI+
Twitter Link:
https://x.com/AssetoFinance
List of audit links if any:
https://reale-assets.gitbook.io/reale/product/ngi+/appendix/ngi+-smart-contract-audit-report
Website Link:
https://asseto.finance/
Logo (High resolution, will be shown with rounded borders):
https://static.asseto.finance/asseto/2026-03-20/dh6vvhx1yf42cbi2s1.svg
Current TVL:
4.10M
Treasury Addresses (if the protocol has treasury)
Chain:
BSC,ETH,PHAROS
Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):
NGI+ is a 1:1 asset-backed token collateralized by the Partners Group Next Generation Infrastructure - Class PC USD ACC, which invests in a broadly diversified portfolio of private infrastructure investments. It intends to focus on private infrastructure direct and secondary investments with a priority on operational assets that offer strong downside protection.
Token address and ticker if any:
NGIPlus_BSC: 0x50BF2924ceE59737EAD76e881643eD8569BAe6e8
NGIPlus_ETH: 0xF252C5BD43907a6CAb079E990845a37a7C5730d9
NGIPlus_PROS: 0x85f51213A6c3F2566aF519D296BB75AD4EC6d234
Currently, the products deployed on BSC and Pharos have not yet received any subscription transactions, so their TVL is temporarily zero.
Category (full list at https://defillama.com/categories) *Please choose only one:
RWA
Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
Redstone
https://app.redstone.finance/push-feeds/NGI%252B_FUNDAMENTAL/ethereumMultiFeed
https://etherscan.io/address/0x7391452a90dda26892bc52fef3ef42f92f19fc61
Implementation Details: Briefly describe how the oracle is integrated into your project:
In our project, the oracle integration is achieved through a collaboration between our Fund Administrator (SyncNAV) and Chainlink. SyncNAV acts as the primary price provider, delivering compliant and accurate price data via an API endpoint to Redstone. Redstone then uses this verified data feed to construct the on-chain oracle.
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):
TVL is calculated by multiplying the current total token supply by the latest token price. The latest price is obtained from the oracle, ensuring that the TVL accurately reflects the real-time value of assets within the protocol.
Github org/user (Optional, if your code is open source, we can track activity):
Does this project have a referral program?
Summary by CodeRabbit