Skip to content

Commit

Permalink
chore: fixed delegatecall bug with CallPolicy and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
adnpark committed Jul 25, 2024
1 parent 9bc3aa7 commit 3b9ced3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions plugins/permission/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @zerodev/permissions

## 5.4.2

### Patch Changes

- Added v0.0.3 contract version for CallPolicy

## 5.4.1

### Patch Changes
Expand Down
8 changes: 8 additions & 0 deletions plugins/permission/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export const CALL_POLICY_CONTRACT_V0_0_1 =
*/
export const CALL_POLICY_CONTRACT_V0_0_2 =
"0x67Fa43ca2D689beA4d10b9F2C96828828A2Ab275"

/**
* @dev CALL_POLICY_CONTRACT_V0_0_3 updates
* - Fixed a bug with delegatecall
*/
export const CALL_POLICY_CONTRACT_V0_0_3 =
"0xB3CB5f502250360335614df1421f2AAbE98CE503"

export const GAS_POLICY_CONTRACT = "0xaeFC5AbC67FfD258abD0A3E54f65E70326F84b23"
export const RATE_LIMIT_POLICY_CONTRACT =
"0xf63d4139B25c836334edD76641356c6b74C86873"
Expand Down
2 changes: 1 addition & 1 deletion plugins/permission/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zerodev/permissions",
"version": "5.4.1",
"version": "5.4.2",
"author": "ZeroDev",
"main": "./_cjs/index.js",
"module": "./_esm/index.js",
Expand Down
6 changes: 5 additions & 1 deletion plugins/permission/policies/toCallPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { concatHex, pad } from "viem"
import {
CALL_POLICY_CONTRACT_V0_0_1,
CALL_POLICY_CONTRACT_V0_0_2,
CALL_POLICY_CONTRACT_V0_0_3,
PolicyFlags
} from "../constants.js"
import type { Policy, PolicyParams } from "../types.js"
Expand All @@ -14,7 +15,8 @@ import { CallType, type Permission } from "./types.js"

export enum CallPolicyVersion {
V0_0_1 = "0.0.1",
V0_0_2 = "0.0.2"
V0_0_2 = "0.0.2",
V0_0_3 = "0.0.3"
}

export const getCallPolicyAddress = (
Expand All @@ -27,6 +29,8 @@ export const getCallPolicyAddress = (
return CALL_POLICY_CONTRACT_V0_0_1
case CallPolicyVersion.V0_0_2:
return CALL_POLICY_CONTRACT_V0_0_2
case CallPolicyVersion.V0_0_3:
return CALL_POLICY_CONTRACT_V0_0_3
}
}

Expand Down

0 comments on commit 3b9ced3

Please sign in to comment.