Add AccessControlDefaultAdminRules (#4009)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Ernesto García
2023-02-24 14:48:08 -07:00
committed by GitHub
parent 2c69f9f9f5
commit dad73159df
14 changed files with 666 additions and 10 deletions

View File

@ -27,6 +27,16 @@ contract('Ownable2Step', function (accounts) {
expect(await this.ownable2Step.pendingOwner()).to.not.equal(accountA);
});
it('guards transfer against invalid user', async function () {
await this.ownable2Step.transferOwnership(accountA, { from: owner });
await expectRevert(
this.ownable2Step.acceptOwnership({ from: accountB }),
'Ownable2Step: caller is not the new owner',
);
});
});
it('renouncing ownership', async function () {
it('changes owner after renouncing ownership', async function () {
await this.ownable2Step.renounceOwnership({ from: owner });
// If renounceOwnership is removed from parent an alternative is needed ...
@ -46,12 +56,12 @@ contract('Ownable2Step', function (accounts) {
);
});
it('guards transfer against invalid user', async function () {
await this.ownable2Step.transferOwnership(accountA, { from: owner });
await expectRevert(
this.ownable2Step.acceptOwnership({ from: accountB }),
'Ownable2Step: caller is not the new owner',
);
it('allows to recover access using the internal _transferOwnership', async function () {
await this.ownable.renounceOwnership({ from: owner });
const receipt = await this.ownable.$_transferOwnership(accountA);
expectEvent(receipt, 'OwnershipTransferred');
expect(await this.ownable.owner()).to.equal(accountA);
});
});
});