@keep-network/sortition-pools
Advanced tools
Comparing version 1.2.0-pre.3 to 1.2.0-pre.4
// Deploys contracts using truffle artifacts and deployer. | ||
class SortitionPoolsDeployer { | ||
constructor(deployer, artifacts) { | ||
this.deployer = deployer | ||
this.artifacts = artifacts | ||
this.libs = {} | ||
} | ||
async function deployLibraries(artifacts, deployer) { | ||
const Branch = artifacts.require("Branch") | ||
const Position = artifacts.require("Position") | ||
const StackLib = artifacts.require("StackLib") | ||
const Leaf = artifacts.require("Leaf") | ||
async deployLibraries() { | ||
if (!this.libs.Branch) { | ||
this.libs.Branch = this.artifacts.require("Branch") | ||
await this.deployer.deploy(this.libs.Branch) | ||
} | ||
await deployer.deploy(Branch) | ||
await deployer.deploy(Position) | ||
await deployer.deploy(StackLib) | ||
await deployer.link(Branch, Leaf) | ||
await deployer.deploy(Leaf) | ||
} | ||
if (!this.libs.Position) { | ||
this.libs.Position = this.artifacts.require("Position") | ||
await this.deployer.deploy(this.libs.Position) | ||
} | ||
async function deploySortitionPoolFactory(artifacts, deployer) { | ||
await deployLibraries(artifacts, deployer) | ||
if (!this.libs.StackLib) { | ||
this.libs.StackLib = this.artifacts.require("StackLib") | ||
await this.deployer.deploy(this.libs.StackLib) | ||
} | ||
const Branch = artifacts.require("Branch") | ||
const Position = artifacts.require("Position") | ||
const StackLib = artifacts.require("StackLib") | ||
const Leaf = artifacts.require("Leaf") | ||
if (!this.libs.Leaf) { | ||
this.libs.Leaf = this.artifacts.require("Leaf") | ||
await this.deployer.link(this.libs.Branch, this.libs.Leaf) | ||
await this.deployer.deploy(this.libs.Leaf) | ||
} | ||
} | ||
const SortitionPoolFactory = artifacts.require("SortitionPoolFactory") | ||
async deploySortitionPoolFactory() { | ||
await this.deployLibraries() | ||
// Sortition Pool Factory | ||
await deployer.link(Branch, SortitionPoolFactory) | ||
await deployer.link(Position, SortitionPoolFactory) | ||
await deployer.link(StackLib, SortitionPoolFactory) | ||
await deployer.link(Leaf, SortitionPoolFactory) | ||
await deployer.deploy(SortitionPoolFactory) | ||
} | ||
const SortitionPoolFactory = this.artifacts.require("SortitionPoolFactory") | ||
async function deployBondedSortitionPoolFactory(artifacts, deployer) { | ||
await deployLibraries(artifacts, deployer) | ||
// Sortition Pool Factory | ||
await this.deployer.link(this.libs.Branch, SortitionPoolFactory) | ||
await this.deployer.link(this.libs.Position, SortitionPoolFactory) | ||
await this.deployer.link(this.libs.StackLib, SortitionPoolFactory) | ||
await this.deployer.link(this.libs.Leaf, SortitionPoolFactory) | ||
await this.deployer.deploy(SortitionPoolFactory) | ||
} | ||
const Branch = artifacts.require("Branch") | ||
const Position = artifacts.require("Position") | ||
const StackLib = artifacts.require("StackLib") | ||
const Leaf = artifacts.require("Leaf") | ||
async deployBondedSortitionPoolFactory() { | ||
await this.deployLibraries() | ||
const BondedSortitionPoolFactory = artifacts.require( | ||
"BondedSortitionPoolFactory", | ||
) | ||
const BondedSortitionPoolFactory = this.artifacts.require( | ||
"BondedSortitionPoolFactory", | ||
) | ||
// Bonded Sortition Pool Factory | ||
await deployer.link(Branch, BondedSortitionPoolFactory) | ||
await deployer.link(Position, BondedSortitionPoolFactory) | ||
await deployer.link(StackLib, BondedSortitionPoolFactory) | ||
await deployer.link(Leaf, BondedSortitionPoolFactory) | ||
await deployer.deploy(BondedSortitionPoolFactory) | ||
} | ||
// Bonded Sortition Pool Factory | ||
await this.deployer.link(this.libs.Branch, BondedSortitionPoolFactory) | ||
await this.deployer.link(this.libs.Position, BondedSortitionPoolFactory) | ||
await this.deployer.link(this.libs.StackLib, BondedSortitionPoolFactory) | ||
await this.deployer.link(this.libs.Leaf, BondedSortitionPoolFactory) | ||
await this.deployer.deploy(BondedSortitionPoolFactory) | ||
} | ||
async function deployFullyBackedSortitionPoolFactory(artifacts, deployer) { | ||
await deployLibraries(artifacts, deployer) | ||
async deployFullyBackedSortitionPoolFactory() { | ||
await this.deployLibraries() | ||
const Branch = artifacts.require("Branch") | ||
const Position = artifacts.require("Position") | ||
const StackLib = artifacts.require("StackLib") | ||
const Leaf = artifacts.require("Leaf") | ||
const FullyBackedSortitionPoolFactory = this.artifacts.require( | ||
"FullyBackedSortitionPoolFactory", | ||
) | ||
const FullyBackedSortitionPoolFactory = artifacts.require( | ||
"FullyBackedSortitionPoolFactory", | ||
) | ||
// Fully Backed Sortition Pool Factory | ||
await deployer.link(Branch, FullyBackedSortitionPoolFactory) | ||
await deployer.link(Position, FullyBackedSortitionPoolFactory) | ||
await deployer.link(StackLib, FullyBackedSortitionPoolFactory) | ||
await deployer.link(Leaf, FullyBackedSortitionPoolFactory) | ||
await deployer.deploy(FullyBackedSortitionPoolFactory) | ||
// Fully Backed Sortition Pool Factory | ||
await this.deployer.link(this.libs.Branch, FullyBackedSortitionPoolFactory) | ||
await this.deployer.link( | ||
this.libs.Position, | ||
FullyBackedSortitionPoolFactory, | ||
) | ||
await this.deployer.link( | ||
this.libs.StackLib, | ||
FullyBackedSortitionPoolFactory, | ||
) | ||
await this.deployer.link(this.libs.Leaf, FullyBackedSortitionPoolFactory) | ||
await this.deployer.deploy(FullyBackedSortitionPoolFactory) | ||
} | ||
} | ||
module.exports = { | ||
deploySortitionPoolFactory, | ||
deployBondedSortitionPoolFactory, | ||
deployFullyBackedSortitionPoolFactory, | ||
} | ||
module.exports = SortitionPoolsDeployer |
{ | ||
"name": "@keep-network/sortition-pools", | ||
"version": "1.2.0-pre.3", | ||
"version": "1.2.0-pre.4", | ||
"description": "", | ||
@@ -13,5 +13,2 @@ "main": "truffle-config.js", | ||
], | ||
"publishConfig": { | ||
"registry": "https://npm.pkg.github.com/" | ||
}, | ||
"scripts": { | ||
@@ -18,0 +15,0 @@ "ganache": "echo 'GANACHE IS NO LONGER USED; use buidler-vm script instead'", |
166
97203