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

FeesEscrow integration #68

Merged
merged 4 commits into from
Sep 7, 2022
Merged
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
4 changes: 4 additions & 0 deletions subgraphs/stakewise/config/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"address": "0x0000000000000000000000000000000000000000",
"startBlock": "21584842"
},
"feesEscrow": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": "21584842"
},
"distributorTokens": [
{
"index": 0,
Expand Down
4 changes: 4 additions & 0 deletions subgraphs/stakewise/config/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"address": "0x826f88d423440c305d9096cc1581ae751efcafb0",
"startBlock": "4468093"
},
"feesEscrow": {
"address": "0x6a9d30e05c6832e868390f155388c7d97a6faeac",
"startBlock": "7468611"
},
"roles": {
"address": "0x81aaa59d7d1000a56326bb577debc287cbd351cc",
"startBlock": "5905175"
Expand Down
4 changes: 4 additions & 0 deletions subgraphs/stakewise/config/harbour_goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"address": "0xba9ad2a3ef7a372900644abe9d82ecd3fa8cf8dd",
"startBlock": "6406075"
},
"feesEscrow": {
"address": "0xa5f6ca3b7753b5f057d6a9d8bb3d7b8d68187338",
"startBlock": "7468537"
},
"roles": {
"address": "0xc8b2f886d432081ee706af1b6174f80e5e690b81",
"startBlock": "6406072"
Expand Down
4 changes: 4 additions & 0 deletions subgraphs/stakewise/config/harbour_mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,9 @@
"address": "0xfe5947f029308f854db0cda57e68c43f6c21a207",
"startBlock": "14798542"
},
"feesEscrow": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": "14798545"
},
"distributorTokens": []
}
4 changes: 4 additions & 0 deletions subgraphs/stakewise/config/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"address": "0xe47b867b2b5b21a2022068c9ef1293783864b274",
"startBlock": "14108270"
},
"feesEscrow": {
"address": "0x0000000000000000000000000000000000000000",
"startBlock": "14108270"
},
"distributorTokens": [
{
"index": 0,
Expand Down
78 changes: 78 additions & 0 deletions subgraphs/stakewise/packages/abis/FeesEscrow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_pool",
"type": "address"
},
{
"internalType": "address",
"name": "_rewardToken",
"type": "address"
},
{
"internalType": "bytes32",
"name": "_symmetricPoolId",
"type": "bytes32"
},
{
"internalType": "contract IBalancerVault",
"name": "_symmetricVault",
"type": "address"
},
{
"internalType": "contract IWrapper",
"name": "_wrapper",
"type": "address"
},
{
"internalType": "address",
"name": "_mGnoWrapper",
"type": "address"
},
{
"internalType": "address",
"name": "_gnoToken",
"type": "address"
},
{
"internalType": "contract IERC20",
"name": "_mGnoToken",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "FeesTransferred",
"type": "event"
},
{
"inputs": [],
"name": "transferToPool",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]
10 changes: 10 additions & 0 deletions subgraphs/stakewise/src/mappings/feesEscrow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createOrLoadPool } from "../entities";
import { FeesTransferred } from "../../generated/FeesEscrow/FeesEscrow";
import { log } from "@graphprotocol/graph-ts";

export function handleFeesTransferred(event: FeesTransferred): void {
let pool = createOrLoadPool();
pool.balance = pool.balance.plus(event.params.amount);
pool.save();
log.info("[FeesEscrow] FeesTransferred amount={}", [event.params.amount.toString()]);
}
21 changes: 21 additions & 0 deletions subgraphs/stakewise/subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,27 @@ dataSources:
- event: Unpaused(address)
handler: handleUnpaused

- kind: ethereum/contract
name: FeesEscrow
network: {{ network }}
source:
address: '{{ feesEscrow.address }}'
abi: FeesEscrow
startBlock: {{ feesEscrow.startBlock }}
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/feesEscrow.ts
entities:
- Pool
abis:
- name: FeesEscrow
file: ./packages/abis/FeesEscrow.json
eventHandlers:
- event: FeesTransferred(uint256)
handler: handleFeesTransferred

- kind: ethereum/contract
name: Roles
network: {{ network }}
Expand Down