Skip to content

Commit

Permalink
Merge pull request #73 from euler-xyz/controller-required-ops
Browse files Browse the repository at this point in the history
Refactor controller operations
  • Loading branch information
dglowinski authored Mar 25, 2024
2 parents 9220c3f + 18c0913 commit b571884
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/EVault/shared/Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ abstract contract Base is EVCClient, Cache {
snapshot.set(vaultCache.cash, vaultCache.totalBorrows.toAssetsUp());
}

account = EVCAuthenticateDeferred(~CONTROLLER_REQUIRED_OPS & operation == 0);
account = EVCAuthenticateDeferred(CONTROLLER_NEUTRAL_OPS & operation == 0);

EVCRequireStatusChecks(accountToCheck == CHECKACCOUNT_CALLER ? account : accountToCheck);
}
Expand Down
5 changes: 3 additions & 2 deletions src/EVault/shared/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ uint32 constant CFG_ONLY_ASSET_CAN_DEPOSIT = 1 << 2;

// EVC authentication

// in order to perform these operations, the account must have the vault installed as a controller
uint32 constant CONTROLLER_REQUIRED_OPS = OP_BORROW | OP_LOOP | OP_PULL_DEBT | OP_LIQUIDATE;
// in order to perform these operations, the account doesn't need to have the vault installed as a controller
uint32 constant CONTROLLER_NEUTRAL_OPS = OP_DEPOSIT | OP_MINT | OP_WITHDRAW | OP_REDEEM | OP_TRANSFER | OP_SKIM
| OP_REPAY | OP_DELOOP | OP_CONVERT_FEES | OP_FLASHLOAN | OP_TOUCH | OP_ACCRUE_INTEREST;

0 comments on commit b571884

Please sign in to comment.