tornado-subgraph/mustache/templates/proxy/create-yaml.js

35 lines
851 B
JavaScript
Raw Normal View History

2021-06-08 18:08:11 +02:00
const Contracts = require('./contracts');
module.exports = {
createYaml: (env) => {
2021-06-09 15:43:04 +02:00
const createProxyBlock = ({ name, network, address }) => ({
2021-06-08 18:08:11 +02:00
name,
2021-06-09 15:43:04 +02:00
network,
2021-06-08 18:08:11 +02:00
mappingFile: '../src/mapping-encrypted-note.ts',
2021-06-09 14:34:06 +02:00
abi: 'Proxy',
startBlock: 7941563,
2021-06-08 18:08:11 +02:00
address,
entities: ['EncryptedNote'],
abis: [
{
event: 'Proxy',
2021-06-09 16:39:13 +02:00
path: '../abis/Proxy.json',
},
2021-06-08 18:08:11 +02:00
],
events: [
{
event: 'EncryptedNote(indexed address,bytes)',
handler: 'handleEncryptedNote',
2021-06-09 16:39:13 +02:00
},
2021-06-08 18:08:11 +02:00
],
});
2021-06-09 15:43:04 +02:00
return Contracts.map(({ prod, name, network, address }) => {
2021-06-09 14:34:06 +02:00
const startBlocks = { prod };
2021-06-09 15:43:04 +02:00
if (network === env) {
2021-06-09 16:39:13 +02:00
return createProxyBlock({ name, startBlocks, network, address });
2021-06-09 15:43:04 +02:00
}
2021-06-09 16:39:13 +02:00
}).filter((e) => e !== undefined);
2021-06-08 18:08:11 +02:00
},
};