Skip to content

Commit

Permalink
Add arg check
Browse files Browse the repository at this point in the history
  • Loading branch information
ibsunhub committed Aug 19, 2022
1 parent d5223cd commit f90921f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/PriceOracle/PriceOracleProxyIB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ contract PriceOracleProxyIB is PriceOracle, Exponential, Denominations {
*/
function _setAdmin(address _admin) external {
require(msg.sender == admin, "only the admin may set new admin");
require(_admin != address(0), "invalid admin");
admin = _admin;
emit SetAdmin(admin);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/PriceOracleProxyIBTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ describe('PriceOracleProxyIB', () => {
it("fails to set admin for non-admin", async () => {
await expect(send(oracle, "_setAdmin", [accounts[0]], {from: accounts[0]})).rejects.toRevert("revert only the admin may set new admin");
});

it("fails to set admin invalid admin", async () => {
await expect(send(oracle, "_setAdmin", [address(0)])).rejects.toRevert("revert invalid admin");
});
});

describe("_setGuardian", () => {
Expand Down

0 comments on commit f90921f

Please sign in to comment.