1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Merge pull request #190 from oceanprotocol/fix/faster-bootstrap

Fix/faster bootstrap
This commit is contained in:
Matthias Kretschmann 2019-04-10 15:54:43 +02:00 committed by GitHub
commit dcdfe98f81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,26 +29,40 @@ export class Keeper extends Instantiable {
// Adding keeper inside Ocean to prevent `Keeper not defined yet` error
config.ocean.keeper = keeper
const resolvedInstances = await Promise.all([
// Main contracts
Dispenser.getInstance(config),
OceanToken.getInstance(config),
DIDRegistry.getInstance(config),
// Managers
TemplateStoreManager.getInstance(config),
AgreementStoreManager.getInstance(config),
ConditionStoreManager.getInstance(config),
// Conditions
LockRewardCondition.getInstance(config),
EscrowReward.getInstance(config),
AccessSecretStoreCondition.getInstance(config),
// Conditions
EscrowAccessSecretStoreTemplate.getInstance(config),
])
// Main contracts
keeper.dispenser = await Dispenser.getInstance(config)
keeper.token = await OceanToken.getInstance(config)
keeper.didRegistry = await DIDRegistry.getInstance(config)
keeper.dispenser = resolvedInstances[0]
keeper.token = resolvedInstances[1]
keeper.didRegistry = resolvedInstances[2]
// Managers
keeper.templateStoreManager = await TemplateStoreManager.getInstance(config)
keeper.agreementStoreManager = await AgreementStoreManager.getInstance(config)
keeper.conditionStoreManager = await ConditionStoreManager.getInstance(config)
keeper.templateStoreManager = resolvedInstances[3]
keeper.agreementStoreManager = resolvedInstances[4]
keeper.conditionStoreManager = resolvedInstances[5]
// Conditions
keeper.conditions = {
lockRewardCondition: await LockRewardCondition.getInstance(config),
escrowReward: await EscrowReward.getInstance(config),
accessSecretStoreCondition: await AccessSecretStoreCondition.getInstance(config),
lockRewardCondition: resolvedInstances[6],
escrowReward: resolvedInstances[7],
accessSecretStoreCondition: resolvedInstances[8],
}
// Conditions
keeper.templates = {
escrowAccessSecretStoreTemplate: await EscrowAccessSecretStoreTemplate.getInstance(config),
escrowAccessSecretStoreTemplate: resolvedInstances[9],
}
// Utils