Skip to content

Commit 06fd651

Browse files
committed
Add contract deploy address
1 parent a1d2d46 commit 06fd651

14 files changed

+79
-3
lines changed

config/arbitrum.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"beefyClassicBoostFactoryAddress": "0x2951c806a75b19954ce0bed477676a54f3c1c200",
1616
"beefyClassicBoostFactoryStartBlock": 131261823,
1717

18+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
19+
"beefyContractDeployerStartBlock": 119462875,
20+
1821
"clmManagerFactoryAddress_2": "0xB45B92C318277d57328fE09DD5cF6Bd53F4F269B",
1922
"clmManagerFactoryStartBlock_2": 198239651,
2023
"clmStrategyFactoryAddress_2": "0xB37c7C935CcE547Eb858Fc8F2d8C3B48597f4aE9",

config/base.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"beefyClassicBoostFactoryAddress": "0x9a313205f50e1192da6d71d1e32dad3487230c55",
1616
"beefyClassicBoostFactoryStartBlock": 12323814,
1717

18+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
19+
"beefyContractDeployerStartBlock": 2366590,
20+
1821
"vaultInitializedEvent": "Initialized(uint8)"
1922
}

config/bsc.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0xe596eC590DE52C09c8D1C7A1294B32F957A7c94e",
1414
"beefyClassicVaultFactoryStartBlock": 24729526,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 30681124,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/fraxtal.json

+3
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"beefyClassicVaultFactoryAddress": "0x91BB303E972995EbE5f593BCddBb6F5Ef49Dbcbd",
88
"beefyClassicVaultFactoryStartBlock": 2366784,
99

10+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
11+
"beefyContractDeployerStartBlock": 2365710,
12+
1013
"vaultInitializedEvent": "Initialized(uint8)"
1114
}

config/linea.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0xD19ab62F83380908D65E344567378cF104cE46c2",
1414
"beefyClassicVaultFactoryStartBlock": 1123332,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 1111015,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/manta.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0xfc69704cC3cAac545cC7577009Ea4AA04F1a61Eb",
1414
"beefyClassicVaultFactoryStartBlock": 2501033,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 2501238,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/mantle.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0xfc69704cC3cAac545cC7577009Ea4AA04F1a61Eb",
1414
"beefyClassicVaultFactoryStartBlock": 66470986,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 40156729,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/mode.json

+3
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"beefyClassicVaultFactoryAddress": "0xBC4a342B0c057501E081484A2d24e576E854F823",
88
"beefyClassicVaultFactoryStartBlock": 7558107,
99

10+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
11+
"beefyContractDeployerStartBlock": 7587005,
12+
1013
"vaultInitializedEvent": "Initialized(uint8)"
1114
}

config/moonbeam.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0x6f6ce0f48481962599ddc6fdb0358c5849f06350",
1414
"beefyClassicVaultFactoryStartBlock": 6347542,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 4171397,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/optimism.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"beefyClassicBoostFactoryAddress": "0xf0a7626eccbee00af144bb1f77cd187af85bbf41",
1616
"beefyClassicBoostFactoryStartBlock": 106819558,
1717

18+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
19+
"beefyContractDeployerStartBlock": 107961256,
20+
1821
"vaultInitializedEvent": "Initialized(uint8)"
1922
}

config/polygon.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0x5a7Bdd60d6004aaED4C06cA16434f4b657d76C3D",
1414
"beefyClassicVaultFactoryStartBlock": 58270050,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 46067822,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}

config/sei.json

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
"beefyClassicVaultFactoryAddress": "0x91BB303E972995EbE5f593BCddBb6F5Ef49Dbcbd",
1414
"beefyClassicVaultFactoryStartBlock": 92535412,
1515

16+
"beefyContractDeployerAddress": "0xcc536552A6214d6667fBC3EC38965F7f556A6391",
17+
"beefyContractDeployerStartBlock": 93106093,
18+
1619
"vaultInitializedEvent": "Initialized(uint8)"
1720
}
+28
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
import { BeefyERC20Product as BeefyERC20ProductTemplate } from "../../../generated/templates"
22
import { ContractDeployed as ContractDeployedEvent } from "../../../generated/ContractDeployer/ContractDeployer"
3+
import { IERC20 as IERC20Contract } from "../../../generated/templates/BeefyERC20Product/IERC20"
4+
import { fetchAndSaveTokenData } from "../utils/token"
5+
import { Address, log } from "@graphprotocol/graph-ts"
36

47
export function handleContractDeployedWithDeployer(event: ContractDeployedEvent): void {
58
const address = event.params.deploymentAddress
9+
10+
// detect if we are creating an erc20 token
11+
const tokenContract = IERC20Contract.bind(Address.fromBytes(address))
12+
13+
const tokenDecimalsRes = tokenContract.try_decimals()
14+
if (tokenDecimalsRes.reverted) {
15+
log.info("Contract {} is not an ERC20 token, decimals() reverted", [address.toHexString()])
16+
return
17+
}
18+
19+
const tokenNameRes = tokenContract.try_name()
20+
if (tokenNameRes.reverted) {
21+
log.info("Contract {} is not an ERC20 token, name() reverted", [address.toHexString()])
22+
return
23+
}
24+
25+
const tokenSymbolRes = tokenContract.try_symbol()
26+
if (tokenSymbolRes.reverted) {
27+
log.info("Contract {} is not an ERC20 token, symbol() reverted", [address.toHexString()])
28+
return
29+
}
30+
31+
log.debug("Creating BeefyERC20Product template for {} from contract-deployer", [address.toHexString()])
32+
33+
fetchAndSaveTokenData(address)
634
BeefyERC20ProductTemplate.create(address)
735
}

subgraph.template.yaml

+15-3
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,35 @@ dataSources:
182182
address: "{{beefyContractDeployerAddress}}"
183183
abi: ContractDeployer
184184
startBlock: {{beefyContractDeployerStartBlock}}
185-
mapping:
185+
mapping: &contractDeployerMapping
186186
kind: ethereum/events
187187
apiVersion: 0.0.7 # 0xgraph's version
188188
language: wasm/assemblyscript
189189
file: ./src/common/mapping/contract-deployer.ts
190-
entities:
190+
entities: &contractDeployerEntities
191191
- Token
192192
- Account
193193
- TokenBalance
194-
abis:
194+
abis: &contractDeployerAbis
195195
- name: ContractDeployer
196196
file: ./abis/beefy/ContractDeployer.json
197197
eventHandlers:
198198
- event: ContractDeployed(indexed bytes32,address)
199199
handler: handleContractDeployedWithDeployer
200200
{{/beefyContractDeployerAddress}}
201201

202+
{{#beefyContractDeployerAddress_2}}
203+
- kind: ethereum/contract
204+
name: ContractDeployer2
205+
network: {{network}}
206+
source:
207+
address: "{{beefyContractDeployerAddress_2}}"
208+
abi: ContractDeployer
209+
startBlock: {{beefyContractDeployerStartBlock_2}}
210+
mapping: *contractDeployerMapping
211+
{{/beefyContractDeployerAddress_2}}
212+
213+
202214
templates:
203215
{{#clmManagerFactoryAddress}}
204216
- name: ClmManager

0 commit comments

Comments
 (0)