Skip to content

Commit

Permalink
Yellow Clearing Network
Browse files Browse the repository at this point in the history
  • Loading branch information
dimast-x committed Sep 16, 2024
1 parent fd3aea2 commit 49a22e9
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
54 changes: 54 additions & 0 deletions project_info_temp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// TEMPORARY FILE. INCLUDE YOUR SUGGESTIONS AND COMMENTS REGARDING METADATA HERE.

##### Name (to be shown on DefiLlama):
Yellow

##### Twitter Link:
https://x.com/yellow

##### List of audit links if any:
https://docs.yellow.org/legal/audit-and-kyc

##### Website Link:
https://www.yellow.org/

##### Logo (High resolution, will be shown with rounded borders):
// TODO. We will add soon

##### Current TVL:


##### Treasury Addresses (if the protocol has treasury)
https://github.com/layer-3/clearsync/blob/master/docs/deployments.md

##### Chain:
Ethereum, Polygon, Linea


##### 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):
Yellow Clearing Network is a Layer-3 P2P protocol that uses state channels to facilitate trading and settlement through smart clearing.

##### Token address and ticker if any:


##### Category (full list at https://defillama.com/categories) *Please choose only one:
Dexes

##### Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
##### Implementation Details: Briefly describe how the oracle is integrated into your project:
##### 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):
The total amount of assets locked by users in the Yellow Wallet.

##### Github org/user (Optional, if your code is open source, we can track activity):
https://github.com/layer-3
54 changes: 54 additions & 0 deletions projects/yellow/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const { getLogs } = require('../helper/cache/getLogs')

const config = {
polygon: {
vault: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
dailyClaim: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
fromBlock: 29080112,
tokens: {}
},
// linea: {
// vault: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
// dailyClaim: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
// fromBlock: 29080112,
// tokens: {}
// },
// ethereum: {
// vault: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
// dailyClaim: '0xFD1353baBf86387FcB6D009C7b74c1aB2178B304',
// fromBlock: 29080112,
// tokens: {}
// },
}

Object.keys(config).forEach(chain => {
const { vault, fromBlock } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
// TODO: Refine logic. Iterate over list of tokens allowed for staking.
// Feth locked amount and append to the responce.

const logs = await getLogs({
api,
target: vault,
eventAbi: 'event FundCreated (address indexed newFund, address comptroller, address shareToken, address vault)',
onlyArgs: true,
fromBlock,
})
const tokens = await api.multiCall({ abi: 'address[]:getAssetList', calls: logs.map(l => l.newFund) })
const ownerTokens = tokens.map((t, i) => [t, logs[i].vault])
return api.sumTokens({ ownerTokens })
// TVL EXPECTED RETURN EXAMPLE (TEMP)
// return {
// '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': '5000000000000', // 5,000,000 USDC (since USDC has 6 decimals)
// '0x0000000000000000000000000000000000000000': '2000000000000000000', // 2 ETH (in wei)
// };
},
// Custom metric.
daily_claims: async (api) => {
// logs := FilterLogs(DailyClaim, StartFrom: block24hBefore)
// return len(logs)
return 1000 // Temp placeholder.
}
}
})

0 comments on commit 49a22e9

Please sign in to comment.