Skip to content

feat: add native token transfer support in call policy #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion policies/call-policy/src/CallPolicy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ contract CallPolicy is PolicyBase {
}

function _checkPermission(address wallet, bytes32 id, CallType callType, address target, bytes calldata data, uint256 value) internal returns(bool){
bytes32 permissionHash = keccak256(abi.encodePacked(callType, target, bytes4(data[0:4])));
bytes4 _data = data.length == 0 ? bytes4(0x0) : bytes4(data[0:4]);
bytes32 permissionHash = keccak256(abi.encodePacked(callType, target, _data));
(uint256 allowedValue, ParamRule[] memory rules) = abi.decode(encodedPermissions[id][permissionHash][wallet], (uint256, ParamRule[]));
if(value > allowedValue) {
revert CallViolatesValueRule();
Expand Down