Add brain.fun (Bittensor EVM launchpad) #18710
Add brain.fun (Bittensor EVM launchpad) #18710brain-fun wants to merge 4 commits intoDefiLlama:mainfrom
Conversation
brain.fun is a token launchpad on Bittensor EVM (chain 964) that uses constant-product bonding curves with native TAO. Each token contract holds the locked TAO in realTaoReserve. TVL = sum of all realTaoReserve across tokens deployed by the factory. Factory: 0xBa270A620cafAA69a97AbcC4d83C850297ca05B2 Website: https://brain.fun
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new Brain-Fun TVL module that queries two factory contracts (V1 and V2) for token counts, batch-resolves token addresses and their Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as TVL Caller
participant API as Adapter API
participant Factory as Factory Contracts (V1 & V2)
participant Tokens as Token Contracts
participant Agg as TVL Aggregator
Caller->>API: tvl(api)
API->>Factory: getTokenCount() [parallel]
Factory-->>API: tokenCount V1, tokenCount V2
API->>API: build batch getToken(tokenId) list
alt tokens exist
API->>Factory: getToken(tokenId...) [batch]
Factory-->>API: tokenAddresses[]
API->>Tokens: realTaoReserve() [batch, permitFailure:true]
Tokens-->>API: reserves[] (some may be null)
loop aggregate non-null
API->>Agg: addGasToken(reserve)
end
API-->>Caller: return aggregated TVL
else no tokens
API-->>Caller: return early (no tokens)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@projects/brain-fun/index.js`:
- Line 45: The timestamp assigned to the start field (start: 1742832000) does
not match the commented date; update the start value to the correct Unix
timestamp for March 31, 2026 (use 1774915200) or change the inline comment to
reflect the actual date for the existing value; locate the start field in
projects/brain-fun/index.js (the start: 1742832000 entry) and make the
timestamp/comment consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 81e0eb88-e800-4c95-a5f4-211ae3f2fcd9
📒 Files selected for processing (1)
projects/brain-fun/index.js
Good catch — fixed in 1774915200, start of day for the first deploy |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
projects/brain-fun/index.js (1)
31-34: AddpermitFailure: trueand filter nulls to prevent single-token failures from breaking TVL collection.If any token's
realTaoReserve()call reverts, the entire multiCall fails and TVL collection fails for the whole protocol. UsingpermitFailure: trueallows partial success, with failed calls returningnullin the result array.Proposed fix
const reserves = await api.multiCall({ abi: "function realTaoReserve() view returns (uint256)", calls: tokenAddresses, + permitFailure: true, }); // Sum all reserves as native gas token (TAO) reserves.forEach((reserve) => { - api.addGasToken(reserve); + if (reserve) api.addGasToken(reserve); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@projects/brain-fun/index.js` around lines 31 - 34, The multiCall to fetch reserves using api.multiCall currently fails entirely if any token's realTaoReserve() reverts; update the api.multiCall call for reserves to include permitFailure: true so partial results return null for failed calls, then after the call filter out null entries from the reserves array (or map nulls to zero) before using them with tokenAddresses to compute TVL; target the reserves variable, the api.multiCall invocation, and the realTaoReserve() results when implementing this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@projects/brain-fun/index.js`:
- Around line 31-34: The multiCall to fetch reserves using api.multiCall
currently fails entirely if any token's realTaoReserve() reverts; update the
api.multiCall call for reserves to include permitFailure: true so partial
results return null for failed calls, then after the call filter out null
entries from the reserves array (or map nulls to zero) before using them with
tokenAddresses to compute TVL; target the reserves variable, the api.multiCall
invocation, and the realTaoReserve() results when implementing this change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a4b0c192-474d-4689-969c-271b2af5080a
📒 Files selected for processing (1)
projects/brain-fun/index.js
Done — added permitFailure: true and a null guard before addGasToken. |
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
New listing — brain.fun
Name (to be shown on DefiLlama):
brain.fun
Twitter Link:
https://x.com/braintao
List of audit links if any:
https://github.com/Bitsec-AI/audit-reports (Bitsec audit — report will be published in this repository)
Website Link:
https://brain.fun
Logo (High resolution, will be shown with rounded borders):
https://brain.fun/logo.png
Current TVL:
~$24,400 (≈ 73 TAO locked in bonding curves across V1 + V2 factories at the time of writing)
Treasury Addresses (if the protocol has treasury):
N/A — brain.fun does not hold a treasury. Trading fees accrue inside each Factory contract under a pull-pattern balance and are claimed by token creators / protocol owner directly.
Chain:
Bittensor EVM (chain id 964) —
bittensor_evmon DefiLlamaCoingecko ID:
N/A — brain.fun has no project token listed on Coingecko.
Coinmarketcap ID:
N/A — brain.fun has no project token listed on Coinmarketcap.
Short Description (to be shown on DefiLlama):
Token launchpad on Bittensor EVM. Anyone can deploy an ERC-20 with a built-in constant-product bonding curve AMM in a single transaction; tokens are tradable from block one against the curve, with no external liquidity pool needed.
Token address and ticker if any:
N/A — brain.fun has no native protocol token. Only user-launched tokens exist on the platform.
Category:
Launchpad
Oracle Provider(s):
None — brain.fun uses no external oracle. Pricing is fully on-chain via the constant-product bonding curve (
x * y = kwith a virtual TAO reserve).Implementation Details:
N/A — no oracle integration. All prices are derived from the AMM state of each Token contract (
getPrice()), which is a pure function ofrealTaoReserve + virtualReserveandtokenReserve.Documentation/Proof:
0xBa270A620cafAA69a97AbcC4d83C850297ca05B20x3EDFEdaFa3dAd70a3F72EdB8be8e818d1922E04cforkedFrom:
N/A — original implementation. brain.fun is not a fork of another protocol.
methodology (what is being counted as tvl, how is tvl being calculated):
TVL is the sum of
realTaoReserve(native TAO locked in the bonding curve) across every Token deployed by both brain.fun factories (V1 + V2) on Bittensor EVM.For each factory the adapter:
getTokenCount()to learn how many tokens have been deployed.getToken(tokenId)fortokenId ∈ [1, count].realTaoReserve()from each token contract.This count represents the actual native TAO locked inside the bonding curve contracts and excludes the virtual reserve, so users see only the real, withdrawable liquidity.
Github org/user:
https://github.com/brain-fun
Does this project have a referral program?
No.
Summary by CodeRabbit