Skip to content

Commit

Permalink
add zero value check (#1181)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev Kalra authored Dec 14, 2023
1 parent 9875bc2 commit 654c1ea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ abstract contract Entropy is IEntropy, EntropyState {
address defaultProvider,
bool prefillRequestStorage
) internal {
require(admin != address(0), "admin is zero address");
require(
defaultProvider != address(0),
"defaultProvider is zero address"
);

_state.admin = admin;
_state.accruedPythFeesInWei = 0;
_state.pythFeeInWei = pythFeeInWei;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ abstract contract EntropyGovernance is EntropyState {
* Can only be called by either admin or owner.
*/
function proposeAdmin(address newAdmin) public virtual {
require(newAdmin != address(0), "newAdmin is zero address");

_authoriseAdminAction();

_state.proposedAdmin = newAdmin;
Expand Down Expand Up @@ -78,6 +80,10 @@ abstract contract EntropyGovernance is EntropyState {
* Emits an {DefaultProviderSet} event.
*/
function setDefaultProvider(address newDefaultProvider) external {
require(
newDefaultProvider != address(0),
"newDefaultProvider is zero address"
);
_authoriseAdminAction();

address oldDefaultProvider = _state.defaultProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ contract EntropyUpgradable is
address defaultProvider,
bool prefillRequestStorage
) public initializer {
require(owner != address(0), "owner is zero address");
require(admin != address(0), "admin is zero address");
require(
defaultProvider != address(0),
"defaultProvider is zero address"
);

__Ownable_init();
__UUPSUpgradeable_init();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ contract Executor {
uint16 _ownerEmitterChainId,
bytes32 _ownerEmitterAddress
) {
require(_wormhole != address(0), "_wormhole is zero address");

wormhole = IWormhole(_wormhole);
lastExecutedSequence = _lastExecutedSequence;
chainId = _chainId;
Expand Down

0 comments on commit 654c1ea

Please sign in to comment.