ocean-subgraph/scripts/generatebargesubgraph.js
Alex Coseru f47ec9bb09
add dispenser (#106)
* add dispenser


Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>
Co-authored-by: Jamie Hewitt <jamie.hewitt15@gmail.com>
2021-05-13 09:19:21 +03:00

63 lines
1.6 KiB
JavaScript

/* eslint-disable no-unused-vars */
var fs = require('fs')
async function replaceContractAddresses() {
// load barge addresses first
try {
const data = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8'))
const {
DTFactory,
// eslint-disable-next-line no-unused-vars
BFactory,
// eslint-disable-next-line no-unused-vars
FixedRateExchange,
// eslint-disable-next-line no-unused-vars
Metadata,
// eslint-disable-next-line no-unused-vars
Dispenser
} = data.development
let subgraph = fs.readFileSync('subgraph.yaml', 'utf8')
if (!data) {
return false
}
// BFactory
subgraph = subgraph.replace(
/0xbe0083053744ECb871510C88dC0f6b77Da162706/g,
BFactory
)
// dt factory
subgraph = subgraph.replace(
/0x57317f97E9EA49eBd19f7c9bB7c180b8cDcbDeB9/g,
DTFactory
)
// metadata
subgraph = subgraph.replace(
/0x1a4b70d8c9DcA47cD6D0Fb3c52BB8634CA1C0Fdf/g,
Metadata
)
// fixed rate exchgage
subgraph = subgraph.replace(
/0x608d05214E42722B94a54cF6114d4840FCfF84e1/g,
FixedRateExchange
)
// dispenser
subgraph = subgraph.replace(
/0xDEfD0018969cd2d4E648209F876ADe184815f038/g,
Dispenser
)
// network
subgraph = subgraph.replace(/network: mainnet/g, 'network: barge')
// startBlocks
subgraph = subgraph.replace(/startBlock:[ 0-9].*/g, 'startBlock: 0')
fs.writeFileSync('subgraph.barge.yaml', subgraph, 'utf8')
} catch (e) {
console.error('Failed to load address.json')
console.error(e)
process.exit(1)
}
}
replaceContractAddresses()