-
Notifications
You must be signed in to change notification settings - Fork 6
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 #11 from chimera-defi/fix/build
Fix/build
- Loading branch information
Showing
8 changed files
with
9,790 additions
and
6,197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ artifacts | |
secrets.js | ||
deploy_log.json | ||
logs.txt | ||
|
||
.env |
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
This file was deleted.
Oops, something went wrong.
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,56 @@ | ||
const {ethers} = require("hardhat"); | ||
const {expect} = require("chai"); | ||
|
||
describe("SgETH.sol", () => { | ||
let sgEth, deployer, alice; | ||
let MINTER_ROLE; | ||
|
||
beforeEach(async () => { | ||
const [owner, addr1] = await ethers.getSigners(); | ||
|
||
const SgETH = await ethers.getContractFactory("SgETH"); | ||
sgEth = await SgETH.deploy([]); | ||
await sgEth.deployed(); | ||
|
||
deployer = owner; | ||
alice = addr1; | ||
|
||
MINTER_ROLE = await sgEth.MINTER(); | ||
}); | ||
|
||
it("addMinter", async () => { | ||
await expect(sgEth.connect(alice).addMinter(alice.address)).to.be.revertedWith( | ||
`AccessControl: account ${alice.address.toLowerCase()} is missing role ${ethers.constants.HashZero}`, | ||
); | ||
await expect(sgEth.connect(deployer).addMinter(ethers.constants.AddressZero)).to.be.revertedWith( | ||
"Zero address detected", | ||
); | ||
|
||
await expect(sgEth.connect(deployer).addMinter(alice.address)) | ||
.to.be.emit(sgEth, "RoleGranted") | ||
.withArgs(MINTER_ROLE, alice.address, deployer.address); | ||
}); | ||
|
||
it("removeMinter", async () => { | ||
await sgEth.connect(deployer).addMinter(alice.address); | ||
await expect(sgEth.connect(alice).removeMinter(alice.address)).to.be.revertedWith( | ||
`AccessControl: account ${alice.address.toLowerCase()} is missing role ${ethers.constants.HashZero}`, | ||
); | ||
|
||
await expect(sgEth.connect(deployer).removeMinter(alice.address)) | ||
.to.be.emit(sgEth, "RoleRevoked") | ||
.withArgs(MINTER_ROLE, alice.address, deployer.address); | ||
}); | ||
|
||
it("transferOwnership", async () => { | ||
await expect(sgEth.connect(alice).transferOwnership(alice.address)).to.be.revertedWith( | ||
`AccessControl: account ${alice.address.toLowerCase()} is missing role ${ethers.constants.HashZero}`, | ||
); | ||
|
||
await expect(sgEth.connect(deployer).transferOwnership(alice.address)) | ||
.to.be.emit(sgEth, "RoleGranted") | ||
.withArgs(ethers.constants.HashZero, alice.address, deployer.address) | ||
.and.to.be.emit(sgEth, "RoleRevoked") | ||
.withArgs(ethers.constants.HashZero, deployer.address, deployer.address); | ||
}); | ||
}); |
Oops, something went wrong.