Skip to content

Commit

Permalink
Add check to prevent people from using the resolver without owner
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed Oct 30, 2023
1 parent e03e212 commit cb56a0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/resolvers/DelegatableResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ contract DelegatableResolver is
* @return address The owner address
*/
function owner() public view returns (address) {
require(_getArgAddress(0) != address(0), "Owner is not set");
return _getArgAddress(0);
}

Expand Down
4 changes: 4 additions & 0 deletions test/resolvers/TestDelegatableResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ contract('DelegatableResolver', function (accounts) {
})

describe('factory', async () => {
it('owner must be set', async () => {
await expect(impl.owner()).to.be.revertedWith('Owner is not set')
})

it('predicts address', async () => {
const tx = await factory.createClone2(operator)
const result = tx.logs[0].args.resolver
Expand Down

0 comments on commit cb56a0b

Please sign in to comment.