This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
872 additions
and
520 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
import Logger from '../utils/Logger' | ||
import AppDirectoryDeployer from './AppDirectoryDeployer' | ||
import ImplementationDirectory from './ImplementationDirectory' | ||
import AppDirectoryProvider from "./AppDirectoryProvider"; | ||
|
||
export default class AppDirectory extends ImplementationDirectory { | ||
|
||
static async fetch(address, txParams = {}) { | ||
const provider = new AppDirectoryProvider(txParams) | ||
return provider.fetch(address) | ||
} | ||
|
||
static async deploy(stdlibAddress = 0x0, txParams = {}) { | ||
const deployer = new AppDirectoryDeployer(txParams) | ||
return deployer.deploy(stdlibAddress) | ||
} | ||
|
||
constructor(directory, txParams = {}) { | ||
const log = new Logger('AppDirectory'); | ||
super(directory, txParams, log) | ||
} | ||
|
||
async stdlib() { | ||
return this.directory.stdlib() | ||
} | ||
|
||
async setStdlib(stdlibAddress) { | ||
this.log.info(`Setting stdlib ${stdlibAddress}...`) | ||
await this.directory.setStdlib(stdlibAddress, this.txParams) | ||
this.log.info(`Stdlib ${stdlibAddress} set`) | ||
return stdlibAddress | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
import Logger from '../utils/Logger' | ||
import Contracts from '../utils/Contracts' | ||
import AppDirectory from './AppDirectory' | ||
|
||
const log = new Logger('AppDirectoryDeployer') | ||
|
||
export default class AppDirectoryDeployer { | ||
constructor(txParams = {}) { | ||
this.txParams = txParams | ||
} | ||
|
||
async deploy(stdlibAddress = 0x0) { | ||
await this._deployAppDirectory(stdlibAddress) | ||
return new AppDirectory(this.directory, this.txParams) | ||
} | ||
|
||
async _deployAppDirectory(stdlibAddress) { | ||
log.info('Deploying new AppDirectory...') | ||
const AppDirectory = Contracts.getFromLib('AppDirectory') | ||
this.directory = await AppDirectory.new(stdlibAddress, this.txParams) | ||
log.info(`App directory created at ${this.directory.address}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
import Contracts from '../utils/Contracts' | ||
import AppDirectory from './AppDirectory' | ||
|
||
export default class AppDirectoryProvider { | ||
constructor(txParams = {}) { | ||
this.txParams = txParams | ||
} | ||
|
||
async fetch(address) { | ||
this._fetchAppDirectory(address) | ||
return new AppDirectory(this.directory, this.txParams) | ||
} | ||
|
||
_fetchAppDirectory(address) { | ||
const AppDirectoryContract = Contracts.getFromLib('AppDirectory') | ||
this.directory = new AppDirectoryContract(address) | ||
} | ||
} |
Oops, something went wrong.