generated from TomAFrench/subgraph-template
-
Notifications
You must be signed in to change notification settings - Fork 18
EventEmitter
Fábio Mendes edited this page Dec 6, 2023
·
2 revisions
EventEmitter is a contract which is deployed to all chains and help us to inject data into the Subgraph. It's possible to use this contract to set the preferential gauge, update rewards data, set token's latest USD price, etc.
EventEmitter addresses can be found at the gauges-subgraph/networks.yaml file.
- For L1, it's the latest non-killed gauge added to the controller;
- For L2s, it's the first gauge created for a given pool.
Before going to the contracts, it's important to verify what's the current preferential gauge (if there's one) and the other liquidity gauges. You should make this query to the Gauges Subgraph:
{
pool(id: "POOL_ADDRESS_LOWERCASE") {
preferentialGauge {
id
}
gauges {
id
}
}
}
In order to set/unset a preferential gauge, you have to call the emitEvent function with the following args:
- identifier:
0x88aea7780a038b8536bb116545f59b8a089101d5e526639d3c54885508ce50e2
- message: gauge address (e.g.
0xc592c33e51a764b94db0702d8baf4035ed577aed
- all lowercase) - value:
0
if preferentialGauge is to be set false; any other value sets it to true
IMPORTANT: it's expected that a new gauge will be set as preferential after unsetting the old one.