forked from DefiLlama/yield-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefiLlama#2 from sherlock-protocol/master
feat: add Sherlock Protocol
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const utils = require('../utils'); | ||
const Web3 = require('web3'); | ||
|
||
const sherlockV2ABI = require('./sherlockV2abi.json'); | ||
|
||
const SherlockV2Contract = '0x0865a889183039689034dA55c1Fd12aF5083eabF'; | ||
|
||
const apy = async () => { | ||
// Fetch APY | ||
const apyData = await utils.getData( | ||
'https://mainnet.indexer.sherlock.xyz/staking' | ||
); | ||
|
||
const web3 = new Web3(process.env.INFURA_CONNECTION); | ||
|
||
// Fetch V2 pool TVL | ||
const sherlockContract = new web3.eth.Contract( | ||
sherlockV2ABI.abi, | ||
SherlockV2Contract | ||
); | ||
const v2TVL = web3.utils.toBN( | ||
await sherlockContract.methods.totalTokenBalanceStakers().call() | ||
); | ||
|
||
const usdcPool = { | ||
pool: 'sherlock-v2-usdc', | ||
chain: utils.formatChain('ethereum'), | ||
project: 'sherlock', | ||
symbol: utils.formatSymbol('USDC'), | ||
tvlUsd: v2TVL.toNumber() / 1e6, | ||
apy: apyData.usdc_apy, | ||
}; | ||
|
||
return [usdcPool]; | ||
}; | ||
|
||
module.exports = { | ||
timetravel: false, | ||
apy, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"abi": [ | ||
{ | ||
"inputs": [], | ||
"name": "totalTokenBalanceStakers", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] | ||
} |