mirror of
https://github.com/Instadapp/smart-contract.git
synced 2024-07-29 22:08:07 +00:00
Merge pull request #1 from Sowmayjain/userwallet-changes
isExecutable function to modifier
This commit is contained in:
commit
e6c0d977a9
|
@ -325,9 +325,9 @@ contract InstaWallet is UserManager, UserNote {
|
|||
public
|
||||
payable
|
||||
note
|
||||
isExecutable(_target)
|
||||
returns (bytes memory response)
|
||||
{
|
||||
require(isExecutable(_target), "not-executable");
|
||||
lastActivity = block.timestamp;
|
||||
emit LogExecute(
|
||||
msg.sender,
|
||||
|
@ -359,17 +359,20 @@ contract InstaWallet is UserManager, UserNote {
|
|||
* and if the sender is owner or contract itself or manager
|
||||
* and if manager then Throws if target is default proxy address
|
||||
*/
|
||||
function isExecutable(address proxyTarget) public view returns (bool) {
|
||||
modifier isExecutable(address proxyTarget) {
|
||||
require(proxyTarget != address(0), "logic-proxy-address-required");
|
||||
(bool isLogic, bool isDefault) = isLogicAuthorised(proxyTarget);
|
||||
require(isLogic, "logic-proxy-address-not-allowed");
|
||||
bool canExecute = false;
|
||||
if (isAuth(msg.sender)) {
|
||||
return true;
|
||||
canExecute = true;
|
||||
} else if (isManager(msg.sender) && !isDefault) {
|
||||
return true;
|
||||
canExecute = true;
|
||||
} else {
|
||||
return false;
|
||||
canExecute = false;
|
||||
}
|
||||
require(canExecute, "not-executable");
|
||||
_;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user