Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Commit

Permalink
Merge 8086ac9 into 32a757d
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Jun 27, 2018
2 parents 32a757d + 8086ac9 commit 1945984
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/package/Package.js
Expand Up @@ -71,4 +71,11 @@ export default class Package {
log.info(` Implementation set: ${implementation.address}`)
return implementation
}

async unsetImplementation (version, contractName) {
log.info(`Unsetting implementation of ${contractName} in version ${version}...`)
const release = await this.getRelease(version)
await release.unsetImplementation(contractName, this.txParams)
log.info(`Implementation unset for ${contractName} in version ${version}`)
};
}
5 changes: 5 additions & 0 deletions src/release/Release.js
Expand Up @@ -46,4 +46,9 @@ export default class Release {
log.info(`Setting ${contractName} implementation ${implementationAddress}`)
return await this._release.setImplementation(contractName, implementationAddress, this.txParams)
}

async unsetImplementation(contractName) {
log.info(`Unsetting ${contractName} implementation`)
return await this._release.unsetImplementation(contractName, this.txParams)
}
}
6 changes: 6 additions & 0 deletions test/src/package/Package.test.js
Expand Up @@ -81,6 +81,12 @@ contract('Package', function ([_, owner]) {
const implementation = await this.package.getImplementation(initialVersion, contractName)
implementation.should.eq(this.implementation.address)
})

it('should unset the implementation', async function () {
await this.package.unsetImplementation(initialVersion, contractName)
const implementation = await this.package.getImplementation(initialVersion, contractName)
parseInt(implementation).should.eq(0)
});
})

describe('while frozen', function() {
Expand Down
11 changes: 11 additions & 0 deletions test/src/release/Release.test.js
Expand Up @@ -39,6 +39,17 @@ contract('Release', ([_, owner]) => {
it('includes the given contracts', async function () {
(await this.release.getImplementation('DummyImplementation')).should.not.be.zero
})

it('sets another implementation', async function() {
const address = await this.release.getImplementation('DummyImplementation');
await this.release.setImplementation('AnotherDummy', address);
(await this.release.getImplementation('AnotherDummy')).should.eq(address);
});

it('unsets an implementation', async function() {
await this.release.unsetImplementation('DummyImplementation')
parseInt(await this.release.getImplementation('DummyImplementation')).should.be.zero
});
})

describe('deployDependency', function () {
Expand Down

0 comments on commit 1945984

Please sign in to comment.