|
|
@ -1,5 +1,6 @@ |
|
|
|
const { expectThrow } = require('../helpers/expectThrow'); |
|
|
|
const { expectThrow } = require('../helpers/expectThrow'); |
|
|
|
const { EVMRevert } = require('../helpers/EVMRevert'); |
|
|
|
const { EVMRevert } = require('../helpers/EVMRevert'); |
|
|
|
|
|
|
|
const expectEvent = require('../helpers/expectEvent'); |
|
|
|
|
|
|
|
|
|
|
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; |
|
|
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; |
|
|
|
|
|
|
|
|
|
|
@ -14,7 +15,8 @@ function shouldBehaveLikeOwnable (owner, [anyone]) { |
|
|
|
|
|
|
|
|
|
|
|
it('changes owner after transfer', async function () { |
|
|
|
it('changes owner after transfer', async function () { |
|
|
|
(await this.ownable.isOwner({ from: anyone })).should.be.equal(false); |
|
|
|
(await this.ownable.isOwner({ from: anyone })).should.be.equal(false); |
|
|
|
await this.ownable.transferOwnership(anyone, { from: owner }); |
|
|
|
const { logs } = await this.ownable.transferOwnership(anyone, { from: owner }); |
|
|
|
|
|
|
|
expectEvent.inLogs(logs, 'OwnershipTransferred'); |
|
|
|
|
|
|
|
|
|
|
|
(await this.ownable.owner()).should.equal(anyone); |
|
|
|
(await this.ownable.owner()).should.equal(anyone); |
|
|
|
(await this.ownable.isOwner({ from: anyone })).should.be.equal(true); |
|
|
|
(await this.ownable.isOwner({ from: anyone })).should.be.equal(true); |
|
|
@ -29,7 +31,9 @@ function shouldBehaveLikeOwnable (owner, [anyone]) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('loses owner after renouncement', async function () { |
|
|
|
it('loses owner after renouncement', async function () { |
|
|
|
await this.ownable.renounceOwnership({ from: owner }); |
|
|
|
const { logs } = await this.ownable.renounceOwnership({ from: owner }); |
|
|
|
|
|
|
|
expectEvent.inLogs(logs, 'OwnershipTransferred'); |
|
|
|
|
|
|
|
|
|
|
|
(await this.ownable.owner()).should.equal(ZERO_ADDRESS); |
|
|
|
(await this.ownable.owner()).should.equal(ZERO_ADDRESS); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|