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 Gro protocol adapter #502

Open
wants to merge 2 commits into
base: staging
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
28 changes: 28 additions & 0 deletions projects/gro/abi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"totalAssets": {
"inputs": [],
"name": "totalAssets",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
"totalSupply": {
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
}
36 changes: 36 additions & 0 deletions projects/gro/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Adapter for Gro Protocol : https://gro.xyz

const sdk = require("../../sdk");
const groTokenAbi = require("./abi.json");

// Gro Protocol Token Addresses
const GVT = "0x3ADb04E127b9C0a5D36094125669d4603AC52a0c";
const PWRD = "0xf0a93d4994b3d98fb5e3a2f90dbc2d69073cb86b";


async function tvl(timestamp, ethBlock) {
let balances = {};

for (const token of [PWRD, GVT]) {
const current = await sdk.api.abi.call({
target: token,
abi: groTokenAbi["totalSupply"],
block: ethBlock,
});
sdk.util.sumSingleBalance(balances, token, current.output);
}

return balances;
}


module.exports = {
name: 'Gro Protocol',
category: 'Assets',
token: 'GRO',
website: 'https://www.gro.xyz',
chain: 'ethereum',
start: 1622204347, // 28-05-2021 12:19:07 (UTC)
tvl,
};