2018-10-02 10:06:26 +02:00
|
|
|
import Config from "../models/Config"
|
|
|
|
import OceanAuth from "./Auth"
|
|
|
|
import OceanMarket from "./Market"
|
|
|
|
import OceanToken from "./Token"
|
|
|
|
import Web3Helper from "./Web3Helper"
|
2018-10-01 18:10:26 +02:00
|
|
|
|
|
|
|
export default class Keeper {
|
|
|
|
|
|
|
|
public static async getInstance(config: Config, helper: Web3Helper) {
|
|
|
|
|
2018-10-02 10:06:26 +02:00
|
|
|
const contracts = new Keeper(config, helper)
|
2018-10-01 18:10:26 +02:00
|
|
|
|
2018-10-02 10:06:26 +02:00
|
|
|
contracts.market = await OceanMarket.getInstance(config, helper)
|
|
|
|
contracts.auth = await OceanAuth.getInstance(config, helper)
|
|
|
|
contracts.token = await OceanToken.getInstance(config, helper)
|
2018-10-01 18:10:26 +02:00
|
|
|
|
2018-10-02 10:06:26 +02:00
|
|
|
return contracts
|
2018-10-01 18:10:26 +02:00
|
|
|
}
|
|
|
|
|
2018-10-02 10:06:26 +02:00
|
|
|
public web3Helper: Web3Helper
|
|
|
|
public token: OceanToken
|
|
|
|
public market: OceanMarket
|
|
|
|
public auth: OceanAuth
|
2018-10-01 18:10:26 +02:00
|
|
|
|
2018-10-02 10:06:26 +02:00
|
|
|
private config: Config
|
2018-10-01 18:10:26 +02:00
|
|
|
|
|
|
|
private constructor(config: Config, helper: Web3Helper) {
|
2018-10-02 10:06:26 +02:00
|
|
|
this.config = config
|
|
|
|
this.web3Helper = helper
|
2018-10-01 18:10:26 +02:00
|
|
|
}
|
|
|
|
}
|