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

35 lines
889 B
JavaScript
Raw Normal View History

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