generated from citydaoproject/contracts-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from citydaoproject/mnorman-issue13
feat: [#13] added Ownable
- Loading branch information
Showing
8 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const { buildParcelNFTInitFunction } = require('../dist/src/contracts/parcelNFT'); | ||
module.exports = [ | ||
'0xc0cA359c8ce6De21B98fC6c7921a08703f453Fe9', | ||
'0xEB667659b19dfc8B6b3b6FaAFaE3b5D7661dcB68', | ||
buildParcelNFTInitFunction({ | ||
name: 'ParcelNFT Test 2022-05-07-02', | ||
symbol: 'PT050702', | ||
name: 'CityDAO Parcel-0', | ||
symbol: 'CityDAO-P0', | ||
}), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { expect } from 'chai'; | ||
import { ZERO_ADDRESS } from '../../../src/constants/accounts'; | ||
import { INITIALIZER, USER1 } from '../../helpers/Accounts'; | ||
import { createParcelNFT } from '../../helpers/contracts/ParcelNFTHelper'; | ||
|
||
describe('Owner initialized with zero address', () => { | ||
it('should set caller as super admin', async () => { | ||
const parcelNFT = await createParcelNFT({ superAdmin: ZERO_ADDRESS }); | ||
expect(await parcelNFT.owner()).to.eq(INITIALIZER.address); | ||
}); | ||
}); | ||
|
||
describe('Owner initialized with another address', () => { | ||
it('should set caller as super admin', async () => { | ||
const parcelNFT = await createParcelNFT({ superAdmin: USER1.address }); | ||
expect(await parcelNFT.owner()).to.eq(USER1.address); | ||
}); | ||
}); | ||
|
||
describe('transferOwnership', () => { | ||
it('should transfer ownership', async () => { | ||
const parcelNFT = await createParcelNFT({ superAdmin: ZERO_ADDRESS }); | ||
await parcelNFT.transferOwnership(USER1.address); | ||
|
||
expect(await parcelNFT.owner()).to.eq(USER1.address); | ||
}); | ||
|
||
it('should fail to transfer ownership when not owner', async () => { | ||
const parcelNFT = await createParcelNFT({ superAdmin: ZERO_ADDRESS }); | ||
await expect(parcelNFT.connect(USER1).transferOwnership(USER1.address)).to.be.revertedWith( | ||
'caller is not the owner', | ||
); | ||
|
||
expect(await parcelNFT.owner()).to.eq(INITIALIZER.address); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters