2022-02-14 09:35:55 +01:00
|
|
|
/* eslint-disable no-unused-vars */
|
2022-06-24 09:06:44 +02:00
|
|
|
const fs = require('fs')
|
|
|
|
let addresses = require('@oceanprotocol/contracts/addresses/address.json')
|
2022-02-14 09:35:55 +01:00
|
|
|
|
|
|
|
async function replaceContractAddresses() {
|
|
|
|
// load addresses file first
|
2022-02-17 11:59:55 +01:00
|
|
|
if (!process.argv[2]) {
|
|
|
|
console.error('Missing network..')
|
|
|
|
return
|
|
|
|
}
|
2022-02-14 09:35:55 +01:00
|
|
|
if (process.env.ADDRESS_FILE) {
|
|
|
|
console.log('Using custom ADDRESS_FILE instead of ocean-contracts npm dep')
|
|
|
|
addresses = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8'))
|
|
|
|
}
|
2022-02-17 11:59:55 +01:00
|
|
|
|
2022-02-14 09:35:55 +01:00
|
|
|
for (const network in addresses) {
|
2022-02-17 11:59:55 +01:00
|
|
|
if (process.argv[2] != network) {
|
2022-02-14 09:35:55 +01:00
|
|
|
console.log('Skipping ' + network)
|
|
|
|
continue
|
|
|
|
}
|
2022-02-17 11:59:55 +01:00
|
|
|
console.log('Creating subgraph.yaml for ' + network)
|
|
|
|
let subgraph = fs.readFileSync('./subgraph.template.yaml', 'utf8')
|
Implementing first pass of veAllocate schema, handlers, and test cove… (#490)
* Implementing first pass of veAllocate schema, handlers, and test coverage.
* Fixed compiling issues, wrote compiling & testing outline inside of veAllocate.test. More to come.
* Created documentation. Moving tests away from subgraph and into df-py.
* Expanding documentation to be thorough and cover more of the work involved.
* use barge artifacts
* use proper contracts in ci
* use barge artifacts folder
* fix replace
* use npm contracts dep
* use latest contracts for barge
* fix some lint
* Fix linter errors
* Update schema
* Finished basic integration of setAllocation event and verified queries/schema is working as intended.
* Fixing amount getter.
* Fixed remaining implementation, verified SimpleSubgraph.test is working, and fixed lint errors.
* Fixing import.
* Use .zero()
* Improve readability
* Add allocated to schema
* Update abi
* Update event handlers in the template
* Update veREADME
* Remove `AllocationRemoved` handler
* Hooking data for tx, firstContact, lastUpdate, block
* Update event abi
* Add chainId and nftAddress to schema
* Update `handleAllocationSet`
* Update abi
* Update readme
* Set initial values
* Fix math
* Missing event param
* set initial value of `lastContact`
* veOcean template
* VeOcean entity
* Handler functions - wip
* rename file
* Delegation schema
* veDelegate mapping file
* Rename
* Update template
* Update schema
* Update replaces
* Add handler for delegation
* Update schema
* getveDelegation
* Update naming
* Add deposit entity
* Update template
* Make delegation an array
* Add `handleDelegation`
* Add `handleDeposit` for veOCEAN
* Add `getveOCEAN` util function
* Add `getDeposit` util function
* Add `handleBurnBoost`
* Add `handleExtendBoost`
* Add `handleTransferBoost`
* Set default veOCEAN
* Remove unused import
* Rename Deposit to VeDeposit
* Include block number
* Remove `allocatedTotal`
* Updating schema and fixing errors due to naming changes. Let's keep the user current allocation, maybe we need to create a feature to more easily let them know whether they are fully allocated, or not..
* bump contracts to v1.1.1
* bump contracts
* bump to contracts 1.1.2
* fix script for networks without ve
* add veAllocation.sol's AllocationSetMultiple
* copy artfacts from barge for npm quickstart:barge
* fix using barge artifacts
* temp debug
* use barge artifacts
* use contracts 1.1.3
* use same approach for 'development'
* bump ocean-contracts
Co-authored-by: alexcos20 <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai@oceanprotocol.com>
Co-authored-by: trizin <25263018+trizin@users.noreply.github.com>
2022-09-05 14:07:31 +02:00
|
|
|
const subgraphVe = fs.readFileSync('./subgraph_ve.template.yaml', 'utf8')
|
|
|
|
if (addresses[network].veOCEAN) {
|
2022-09-13 14:45:03 +02:00
|
|
|
console.log('\t Adding veOCEAN')
|
Implementing first pass of veAllocate schema, handlers, and test cove… (#490)
* Implementing first pass of veAllocate schema, handlers, and test coverage.
* Fixed compiling issues, wrote compiling & testing outline inside of veAllocate.test. More to come.
* Created documentation. Moving tests away from subgraph and into df-py.
* Expanding documentation to be thorough and cover more of the work involved.
* use barge artifacts
* use proper contracts in ci
* use barge artifacts folder
* fix replace
* use npm contracts dep
* use latest contracts for barge
* fix some lint
* Fix linter errors
* Update schema
* Finished basic integration of setAllocation event and verified queries/schema is working as intended.
* Fixing amount getter.
* Fixed remaining implementation, verified SimpleSubgraph.test is working, and fixed lint errors.
* Fixing import.
* Use .zero()
* Improve readability
* Add allocated to schema
* Update abi
* Update event handlers in the template
* Update veREADME
* Remove `AllocationRemoved` handler
* Hooking data for tx, firstContact, lastUpdate, block
* Update event abi
* Add chainId and nftAddress to schema
* Update `handleAllocationSet`
* Update abi
* Update readme
* Set initial values
* Fix math
* Missing event param
* set initial value of `lastContact`
* veOcean template
* VeOcean entity
* Handler functions - wip
* rename file
* Delegation schema
* veDelegate mapping file
* Rename
* Update template
* Update schema
* Update replaces
* Add handler for delegation
* Update schema
* getveDelegation
* Update naming
* Add deposit entity
* Update template
* Make delegation an array
* Add `handleDelegation`
* Add `handleDeposit` for veOCEAN
* Add `getveOCEAN` util function
* Add `getDeposit` util function
* Add `handleBurnBoost`
* Add `handleExtendBoost`
* Add `handleTransferBoost`
* Set default veOCEAN
* Remove unused import
* Rename Deposit to VeDeposit
* Include block number
* Remove `allocatedTotal`
* Updating schema and fixing errors due to naming changes. Let's keep the user current allocation, maybe we need to create a feature to more easily let them know whether they are fully allocated, or not..
* bump contracts to v1.1.1
* bump contracts
* bump to contracts 1.1.2
* fix script for networks without ve
* add veAllocation.sol's AllocationSetMultiple
* copy artfacts from barge for npm quickstart:barge
* fix using barge artifacts
* temp debug
* use barge artifacts
* use contracts 1.1.3
* use same approach for 'development'
* bump ocean-contracts
Co-authored-by: alexcos20 <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai@oceanprotocol.com>
Co-authored-by: trizin <25263018+trizin@users.noreply.github.com>
2022-09-05 14:07:31 +02:00
|
|
|
// fix identation , due to vs auto format (subgraph_ve.template is moved to left)
|
|
|
|
const lines = subgraphVe.split('\n')
|
|
|
|
for (let line = 0; line < lines.length; line++) {
|
|
|
|
subgraph += ' ' + lines[line] + '\n'
|
|
|
|
}
|
|
|
|
}
|
2022-02-14 09:35:55 +01:00
|
|
|
|
|
|
|
subgraph = subgraph.replace(/__NETWORK__/g, network)
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__STARTBLOCK__/g,
|
|
|
|
addresses[network].startBlock
|
|
|
|
)
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__ERC721FACTORYADDRESS__/g,
|
|
|
|
"'" + addresses[network].ERC721Factory + "'"
|
|
|
|
)
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__FACTORYROUTERADDRESS__/g,
|
|
|
|
"'" + addresses[network].Router + "'"
|
|
|
|
)
|
Implementing first pass of veAllocate schema, handlers, and test cove… (#490)
* Implementing first pass of veAllocate schema, handlers, and test coverage.
* Fixed compiling issues, wrote compiling & testing outline inside of veAllocate.test. More to come.
* Created documentation. Moving tests away from subgraph and into df-py.
* Expanding documentation to be thorough and cover more of the work involved.
* use barge artifacts
* use proper contracts in ci
* use barge artifacts folder
* fix replace
* use npm contracts dep
* use latest contracts for barge
* fix some lint
* Fix linter errors
* Update schema
* Finished basic integration of setAllocation event and verified queries/schema is working as intended.
* Fixing amount getter.
* Fixed remaining implementation, verified SimpleSubgraph.test is working, and fixed lint errors.
* Fixing import.
* Use .zero()
* Improve readability
* Add allocated to schema
* Update abi
* Update event handlers in the template
* Update veREADME
* Remove `AllocationRemoved` handler
* Hooking data for tx, firstContact, lastUpdate, block
* Update event abi
* Add chainId and nftAddress to schema
* Update `handleAllocationSet`
* Update abi
* Update readme
* Set initial values
* Fix math
* Missing event param
* set initial value of `lastContact`
* veOcean template
* VeOcean entity
* Handler functions - wip
* rename file
* Delegation schema
* veDelegate mapping file
* Rename
* Update template
* Update schema
* Update replaces
* Add handler for delegation
* Update schema
* getveDelegation
* Update naming
* Add deposit entity
* Update template
* Make delegation an array
* Add `handleDelegation`
* Add `handleDeposit` for veOCEAN
* Add `getveOCEAN` util function
* Add `getDeposit` util function
* Add `handleBurnBoost`
* Add `handleExtendBoost`
* Add `handleTransferBoost`
* Set default veOCEAN
* Remove unused import
* Rename Deposit to VeDeposit
* Include block number
* Remove `allocatedTotal`
* Updating schema and fixing errors due to naming changes. Let's keep the user current allocation, maybe we need to create a feature to more easily let them know whether they are fully allocated, or not..
* bump contracts to v1.1.1
* bump contracts
* bump to contracts 1.1.2
* fix script for networks without ve
* add veAllocation.sol's AllocationSetMultiple
* copy artfacts from barge for npm quickstart:barge
* fix using barge artifacts
* temp debug
* use barge artifacts
* use contracts 1.1.3
* use same approach for 'development'
* bump ocean-contracts
Co-authored-by: alexcos20 <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai@oceanprotocol.com>
Co-authored-by: trizin <25263018+trizin@users.noreply.github.com>
2022-09-05 14:07:31 +02:00
|
|
|
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__VEALLOCATEADDRESS__/g,
|
|
|
|
"'" + addresses[network].veAllocate + "'"
|
|
|
|
)
|
|
|
|
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__VEOCEANADDRESS__/g,
|
|
|
|
"'" + addresses[network].veOCEAN + "'"
|
|
|
|
)
|
|
|
|
|
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__VEDELEGATIONADDRESS__/g,
|
|
|
|
"'" + addresses[network].veDelegation + "'"
|
|
|
|
)
|
|
|
|
|
2022-09-23 14:54:27 +02:00
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__VEFEEDISTRIBUTORNADDRESS__/g,
|
|
|
|
"'" + addresses[network].veFeeDistributor + "'"
|
|
|
|
)
|
|
|
|
|
Implementing first pass of veAllocate schema, handlers, and test cove… (#490)
* Implementing first pass of veAllocate schema, handlers, and test coverage.
* Fixed compiling issues, wrote compiling & testing outline inside of veAllocate.test. More to come.
* Created documentation. Moving tests away from subgraph and into df-py.
* Expanding documentation to be thorough and cover more of the work involved.
* use barge artifacts
* use proper contracts in ci
* use barge artifacts folder
* fix replace
* use npm contracts dep
* use latest contracts for barge
* fix some lint
* Fix linter errors
* Update schema
* Finished basic integration of setAllocation event and verified queries/schema is working as intended.
* Fixing amount getter.
* Fixed remaining implementation, verified SimpleSubgraph.test is working, and fixed lint errors.
* Fixing import.
* Use .zero()
* Improve readability
* Add allocated to schema
* Update abi
* Update event handlers in the template
* Update veREADME
* Remove `AllocationRemoved` handler
* Hooking data for tx, firstContact, lastUpdate, block
* Update event abi
* Add chainId and nftAddress to schema
* Update `handleAllocationSet`
* Update abi
* Update readme
* Set initial values
* Fix math
* Missing event param
* set initial value of `lastContact`
* veOcean template
* VeOcean entity
* Handler functions - wip
* rename file
* Delegation schema
* veDelegate mapping file
* Rename
* Update template
* Update schema
* Update replaces
* Add handler for delegation
* Update schema
* getveDelegation
* Update naming
* Add deposit entity
* Update template
* Make delegation an array
* Add `handleDelegation`
* Add `handleDeposit` for veOCEAN
* Add `getveOCEAN` util function
* Add `getDeposit` util function
* Add `handleBurnBoost`
* Add `handleExtendBoost`
* Add `handleTransferBoost`
* Set default veOCEAN
* Remove unused import
* Rename Deposit to VeDeposit
* Include block number
* Remove `allocatedTotal`
* Updating schema and fixing errors due to naming changes. Let's keep the user current allocation, maybe we need to create a feature to more easily let them know whether they are fully allocated, or not..
* bump contracts to v1.1.1
* bump contracts
* bump to contracts 1.1.2
* fix script for networks without ve
* add veAllocation.sol's AllocationSetMultiple
* copy artfacts from barge for npm quickstart:barge
* fix using barge artifacts
* temp debug
* use barge artifacts
* use contracts 1.1.3
* use same approach for 'development'
* bump ocean-contracts
Co-authored-by: alexcos20 <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai@oceanprotocol.com>
Co-authored-by: trizin <25263018+trizin@users.noreply.github.com>
2022-09-05 14:07:31 +02:00
|
|
|
subgraph = subgraph.replace(
|
|
|
|
/__DFREWARDSADDRESS__/g,
|
|
|
|
"'" + addresses[network].DFRewards + "'"
|
|
|
|
)
|
2022-02-17 11:59:55 +01:00
|
|
|
fs.writeFileSync('subgraph.yaml', subgraph, 'utf8')
|
2022-02-14 09:35:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
replaceContractAddresses()
|