diff --git a/subgraphs/stakewise/config/gnosis.json b/subgraphs/stakewise/config/gnosis.json index ca5087d..d15e61e 100644 --- a/subgraphs/stakewise/config/gnosis.json +++ b/subgraphs/stakewise/config/gnosis.json @@ -40,6 +40,10 @@ "address": "0x0000000000000000000000000000000000000000", "startBlock": "21584842" }, + "feesEscrow": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": "21584842" + }, "distributorTokens": [ { "index": 0, diff --git a/subgraphs/stakewise/config/goerli.json b/subgraphs/stakewise/config/goerli.json index 55bfc58..46e2971 100644 --- a/subgraphs/stakewise/config/goerli.json +++ b/subgraphs/stakewise/config/goerli.json @@ -32,6 +32,10 @@ "address": "0x826f88d423440c305d9096cc1581ae751efcafb0", "startBlock": "4468093" }, + "feesEscrow": { + "address": "0x6a9d30e05c6832e868390f155388c7d97a6faeac", + "startBlock": "7468611" + }, "roles": { "address": "0x81aaa59d7d1000a56326bb577debc287cbd351cc", "startBlock": "5905175" diff --git a/subgraphs/stakewise/config/harbour_goerli.json b/subgraphs/stakewise/config/harbour_goerli.json index 6e7f40f..bf5742f 100644 --- a/subgraphs/stakewise/config/harbour_goerli.json +++ b/subgraphs/stakewise/config/harbour_goerli.json @@ -32,6 +32,10 @@ "address": "0xba9ad2a3ef7a372900644abe9d82ecd3fa8cf8dd", "startBlock": "6406075" }, + "feesEscrow": { + "address": "0xa5f6ca3b7753b5f057d6a9d8bb3d7b8d68187338", + "startBlock": "7468537" + }, "roles": { "address": "0xc8b2f886d432081ee706af1b6174f80e5e690b81", "startBlock": "6406072" diff --git a/subgraphs/stakewise/config/harbour_mainnet.json b/subgraphs/stakewise/config/harbour_mainnet.json index 0662ea6..c92a47d 100644 --- a/subgraphs/stakewise/config/harbour_mainnet.json +++ b/subgraphs/stakewise/config/harbour_mainnet.json @@ -36,5 +36,9 @@ "address": "0xfe5947f029308f854db0cda57e68c43f6c21a207", "startBlock": "14798542" }, + "feesEscrow": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": "14798545" + }, "distributorTokens": [] } \ No newline at end of file diff --git a/subgraphs/stakewise/config/mainnet.json b/subgraphs/stakewise/config/mainnet.json index fd569d1..8ae87a5 100644 --- a/subgraphs/stakewise/config/mainnet.json +++ b/subgraphs/stakewise/config/mainnet.json @@ -40,6 +40,10 @@ "address": "0xe47b867b2b5b21a2022068c9ef1293783864b274", "startBlock": "14108270" }, + "feesEscrow": { + "address": "0x0000000000000000000000000000000000000000", + "startBlock": "14108270" + }, "distributorTokens": [ { "index": 0, diff --git a/subgraphs/stakewise/packages/abis/FeesEscrow.json b/subgraphs/stakewise/packages/abis/FeesEscrow.json new file mode 100644 index 0000000..c672d73 --- /dev/null +++ b/subgraphs/stakewise/packages/abis/FeesEscrow.json @@ -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" + } +] diff --git a/subgraphs/stakewise/src/mappings/feesEscrow.ts b/subgraphs/stakewise/src/mappings/feesEscrow.ts new file mode 100644 index 0000000..c2334f8 --- /dev/null +++ b/subgraphs/stakewise/src/mappings/feesEscrow.ts @@ -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()]); +} diff --git a/subgraphs/stakewise/subgraph.template.yaml b/subgraphs/stakewise/subgraph.template.yaml index 1f77d08..ac262ac 100644 --- a/subgraphs/stakewise/subgraph.template.yaml +++ b/subgraphs/stakewise/subgraph.template.yaml @@ -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 }}