Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Guru Network & Equalizer protocols to Sonic #13054

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3,274 changes: 3,274 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions projects/2Thick/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { uniV3Export } = require('../helper/uniswapV3')

module.exports = uniV3Export({
fantom: { factory: '0x7Ca1dCCFB4f49564b8f13E18a67747fd428F1C40', fromBlock: 100367164 },
base : { factory: '0x7Ca1dCCFB4f49564b8f13E18a67747fd428F1C40', fromBlock: 23864326 },
sonic : { factory: '0x7Ca1dCCFB4f49564b8f13E18a67747fd428F1C40', fromBlock: 548461 },
})
13 changes: 0 additions & 13 deletions projects/Equalizer/index.js

This file was deleted.

1 change: 1 addition & 0 deletions projects/Thick/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = uniV3Export({
fantom: { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 70309749 },
arbitrum : { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 148243463 },
base : { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 6314325 },
sonic : { factory: '0xE6dA85feb3B4E0d6AEd95c41a125fba859bB9d24', fromBlock: 444927 },
})
4 changes: 3 additions & 1 deletion projects/elocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const IELOCKS = {
}

const elocks = {
fantom: "0x2f20A659601d1c161A108E0725FEF31256a907ad"
fantom: "0x2f20A659601d1c161A108E0725FEF31256a907ad",
sonic: "0xc6b515328f970ec25228a716bf91774e5bd5abc0"
}

module.exports = {
Expand All @@ -17,6 +18,7 @@ Object.keys(elocks).forEach(chain => {
tvl: async (api) => {
const data = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: IELOCKS.lockedAssets, target: elocks[api.chain], startFromOne: true, })
data.forEach(i => api.addToken(i.token, i.balance))
//data.forEach(i => console.log(chain, i.token, i.balance))
return sumTokens2({ api, resolveLP: true})
},
}
Expand Down
85 changes: 85 additions & 0 deletions projects/equalizer-base-liquidity-market/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const { sumTokens2 } = require("../helper/unwrapLPs")
const { staking } = require('../helper/staking')

const VOTER = "0x46abb88ae1f2a35ea559925d99fdc5441b592687";
const ZEROA = "0x0000000000000000000000000000000000000000";
const USDbC = "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca"
const USdec = 10**6;

async function sumAllGauges(api) {
// 1. Get Gauges Length
// 2. Get all Pools
// 3. Get all Gauges
// 4. Does its customGauge exist?
// 5. exists ? customGauge.tvl() : sum2tokens( gauge, gauge.totalSupply() )

// 1.
const leng = await api.call({ target: VOTER, abi: 'function length() public view returns(uint)' });
///console.log({ leng })

// 2.
const pools = await api.multiCall({
abi: "function pools(uint) public view returns(address)",
calls: Array.from(Array(Number(leng))).map((e,i)=>({ target: VOTER, params: [i] }) )
})
//console.log({pools})

// 3.
const gauges = await api.multiCall({
abi: "function gauges(address) public view returns(address)",
calls: pools.map((e,i)=>({ target: VOTER, params: [e] }) )
})
///console.log({gauges})

// 4.
const customGauges = await api.multiCall({
abi: "function customGauges(address) public view returns(address)",
calls: gauges.map((e,i)=>({ target: VOTER, params: [e] }) )
})
///console.log({customGauges})

// 5.
let filteredPools = [], filteredGauges = [], filteredFarmlands = [];
for(i=0;i<pools.length;i++) {
if(customGauges[i] == ZEROA) {
filteredPools.push(pools[i]);
filteredGauges.push(gauges[i]);
}
else {
filteredFarmlands.push(customGauges[i]);
}
}
///console.log({ filteredPools , filteredGauges , filteredFarmlands })

// 5.1 Default
const filteredGaugesAmounts = await api.multiCall({
abi: "function totalSupply() public view returns(uint)",
calls: filteredGauges.map((e,i)=>({ target: e }) )
})
///console.log({ filteredGaugesAmounts })

// 5.2 Custom
const filteredFarmlandsTVL = (await api.multiCall({
abi: "function tvl() public view returns(uint)",
calls: filteredFarmlands.map((e,i)=>({ target: e }) ),
permitFailure: true
}))
.map( i=> isFinite(Number(i)) ? Number(i)/1e18 : 0 )
.reduce( (i,a) => (i+a) )
///console.log({ filteredFarmlandsTVL })

// 5.3 Total
filteredGauges.forEach( (e,i) => api.addToken( filteredPools[i], filteredGaugesAmounts[i] ));
api.addToken( USDbC , USdec * filteredFarmlandsTVL )
return sumTokens2({ api, resolveLP: true })

}

module.exports = {
methodology: 'On-chain TVL Sum of only Assets Staked into Voted Equalizer Gauges & Farmlands.',
misrepresentedTokens: true,
base: {
tvl: sumAllGauges,
staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c"),
}
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const {uniTvlExport} = require('../helper/calculateUniTvl.js')
const { staking } = require('../helper/staking')

module.exports = {
misrepresentedTokens: true,
base:{
tvl: uniTvlExport("0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04", "base", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c"),
},
}
}
5 changes: 0 additions & 5 deletions projects/equalizer-cl/index.js

This file was deleted.

99 changes: 99 additions & 0 deletions projects/equalizer-fantom-liquidity-market/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
const { sumTokens2 } = require("../helper/unwrapLPs")
const { staking } = require('../helper/staking')

const VOTERv1 = "0x4bebEB8188aEF8287f9a7d1E4f01d76cBE060d5b";
const VOTERv2 = "0xE3D1A117dF7DCaC2eB0AC8219341bAd92f18dAC1";
const ZEROA = "0x0000000000000000000000000000000000000000";
const USDbC = "0x1b6382dbdea11d97f24495c9a90b7c88469134a4"
const USdec = 10**6;

async function sumAllGauges(api) {
// 1. Get Gauges Length
// 2. Get all Pools
// 3. Get all Gauges
// 4. Does its customGauge exist?
// 5. exists ? customGauge.tvl() : sum2tokens( gauge, gauge.totalSupply() )

// 1.
const lengV1 = await api.call({ target: VOTERv1, abi: 'function length() public view returns(uint)' });
const lengV2 = await api.call({ target: VOTERv2, abi: 'function length() public view returns(uint)' });
///console.log({ leng })

// 2.
const poolsV1 = await api.multiCall({
abi: "function pools(uint) public view returns(address)",
calls: Array.from(Array(Number(lengV1))).map((e,i)=>({ target: VOTERv1, params: [i] }) )
})
const poolsV2 = await api.multiCall({
abi: "function pools(uint) public view returns(address)",
calls: Array.from(Array(Number(lengV2))).map((e,i)=>({ target: VOTERv2, params: [i] }) )
})
//console.log({pools})

// 3.
const gaugesV1 = await api.multiCall({
abi: "function gauges(address) public view returns(address)",
calls: poolsV1.map((e,i)=>({ target: VOTERv1, params: [e] }) )
})
const gaugesV2 = await api.multiCall({
abi: "function gauges(address) public view returns(address)",
calls: poolsV2.map((e,i)=>({ target: VOTERv2, params: [e] }) )
})
///console.log({gauges})

// 4.
const customGauges = await api.multiCall({
abi: "function customGauges(address) public view returns(address)",
calls: gaugesV2.map((e,i)=>({ target: VOTERv2, params: [e] }) )
})
///console.log({customGauges})

// 5.
let filteredPools = [], filteredGauges = [], filteredFarmlands = [];
for(i=0;i<poolsV1.length;i++) {
filteredPools.push(poolsV1[i]);
filteredGauges.push(gaugesV1[i]);
}
for(i=0;i<poolsV2.length;i++) {
if(customGauges[i] == ZEROA) {
filteredPools.push(poolsV2[i]);
filteredGauges.push(gaugesV2[i]);
}
else {
filteredFarmlands.push(customGauges[i]);
}
}
///console.log({ filteredPools , filteredGauges , filteredFarmlands })

// 5.1 Default
const filteredGaugesAmounts = await api.multiCall({
abi: "function totalSupply() public view returns(uint)",
calls: filteredGauges.map((e,i)=>({ target: e }) )
})
///console.log({ filteredGaugesAmounts })

// 5.2 Custom
const filteredFarmlandsTVL = (await api.multiCall({
abi: "function tvl() public view returns(uint)",
calls: filteredFarmlands.map((e,i)=>({ target: e }) ),
permitFailure: true
}))
.map( i=> isFinite(Number(i)) ? Number(i)/1e18 : 0 )
.reduce( (i,a) => (i+a) )
console.log({ filteredFarmlandsTVL })

// 5.3 Total
filteredGauges.forEach( (e,i) => api.addToken( filteredPools[i], filteredGaugesAmounts[i] ));
api.addToken( USDbC , USdec * filteredFarmlandsTVL )
return sumTokens2({ api, resolveLP: true })

}

module.exports = {
methodology: 'On-chain TVL Sum of only Assets Staked into Voted Equalizer Gauges & Farmlands.',
misrepresentedTokens: true,
fantom: {
tvl: sumAllGauges,
staking: staking("0x8313f3551C4D3984FfbaDFb42f780D0c8763Ce94", "0x3Fd3A0c85B70754eFc07aC9Ac0cbBDCe664865A6"),
}
}
7 changes: 7 additions & 0 deletions projects/equalizer-fantom-svamm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const {uniTvlExport} = require('../helper/calculateUniTvl.js')
module.exports = {
misrepresentedTokens: true,
fantom:{
tvl: uniTvlExport("0xc6366EFD0AF1d09171fe0EBF32c7943BB310832a", "fantom", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
}
}
85 changes: 85 additions & 0 deletions projects/equalizer-sonic-liquidity-market/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const { sumTokens2 } = require("../helper/unwrapLPs")
const { staking } = require('../helper/staking')

const VOTER = "0x17fa9da6e01ad59513707f92033a6eb03ccb10b4";
const ZEROA = "0x0000000000000000000000000000000000000000";
const USDbC = "0x29219dd400f2Bf60E5a23d13Be72B486D4038894"
const USdec = 10**6;

async function sumAllGauges(api) {
// 1. Get Gauges Length
// 2. Get all Pools
// 3. Get all Gauges
// 4. Does its customGauge exist?
// 5. exists ? customGauge.tvl() : sum2tokens( gauge, gauge.totalSupply() )

// 1.
const leng = await api.call({ target: VOTER, abi: 'function length() public view returns(uint)' });
///console.log({ leng })

// 2.
const pools = await api.multiCall({
abi: "function pools(uint) public view returns(address)",
calls: Array.from(Array(Number(leng))).map((e,i)=>({ target: VOTER, params: [i] }) )
})
//console.log({pools})

// 3.
const gauges = await api.multiCall({
abi: "function gauges(address) public view returns(address)",
calls: pools.map((e,i)=>({ target: VOTER, params: [e] }) )
})
///console.log({gauges})

// 4.
const customGauges = await api.multiCall({
abi: "function customGauges(address) public view returns(address)",
calls: gauges.map((e,i)=>({ target: VOTER, params: [e] }) )
})
///console.log({customGauges})

// 5.
let filteredPools = [], filteredGauges = [], filteredFarmlands = [];
for(i=0;i<pools.length;i++) {
if(customGauges[i] == ZEROA) {
filteredPools.push(pools[i]);
filteredGauges.push(gauges[i]);
}
else {
filteredFarmlands.push(customGauges[i]);
}
}
///console.log({ filteredPools , filteredGauges , filteredFarmlands })

// 5.1 Default
const filteredGaugesAmounts = await api.multiCall({
abi: "function totalSupply() public view returns(uint)",
calls: filteredGauges.map((e,i)=>({ target: e }) )
})
///console.log({ filteredGaugesAmounts })

// 5.2 Custom
const filteredFarmlandsTVL = (await api.multiCall({
abi: "function tvl() public view returns(uint)",
calls: filteredFarmlands.map((e,i)=>({ target: e }) ),
permitFailure: true
}))
.map( i=> isFinite(Number(i)) ? Number(i)/1e18 : 0 )
.reduce( (i,a) => (i+a) )
///console.log({ filteredFarmlandsTVL })

// 5.3 Total
filteredGauges.forEach( (e,i) => api.addToken( filteredPools[i], filteredGaugesAmounts[i] ));
api.addToken( USDbC , USdec * filteredFarmlandsTVL )
return sumTokens2({ api, resolveLP: true })

}

module.exports = {
methodology: 'On-chain TVL Sum of only Assets Staked into Voted Equalizer Gauges & Farmlands.',
misrepresentedTokens: true,
sonic: {
tvl: sumAllGauges,
staking: staking("0x3045119766352fF250b3d45312Bd0973CBF7235a", "0xddF26B42C1d903De8962d3F79a74a501420d5F19"),
}
};
7 changes: 7 additions & 0 deletions projects/equalizer-sonic-svamm/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const {uniTvlExport} = require('../helper/calculateUniTvl.js')
module.exports = {
misrepresentedTokens: true,
sonic: {
tvl: uniTvlExport("0xDDD9845Ba0D8f38d3045f804f67A1a8B9A528FcC", "sonic", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, stablePoolSymbol: 's-'}),
}
}
Loading