-
Notifications
You must be signed in to change notification settings - Fork 35
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
Multiple call policies do not work with session keys #147
Comments
@SahilVasava , doing the following got me to a point where only the first permission in the policy works. The overarching question is: Neither the SDK docs or examples show how to do this. Additionally, using an individual ERC-20 token address as the target works, but using toCallPolicy(
{
permissions: [
{
target: SEPOLIA_USDC_CONTRACT,
valueLimit: BigInt(0),
abi: erc20Abi,
functionName: "transfer",
args: [
{
condition: ParamCondition.EQUAL,
value: TEST_ADDRESS_1, // <------ sending USDC to this works
},
null,
],
},
],
},
{
permissions: [
{
target: SEPOLIA_USDC_CONTRACT,
valueLimit: BigInt(0),
abi: erc20Abi,
functionName: "transfer",
args: [
{
condition: ParamCondition.EQUAL,
value: TEST_ADDRESS_2, // <------ sending USDC to this does not work
},
null,
],
},
],
},
{
permissions: [
{
target: TEST_ADDRESS_1, // <------ sending ETH to this does not work
valueLimit: maxInt256,
},
],
},
{
permissions: [
{
target: TEST_ADDRESS_2, // <------ sending ETH to this does not work
valueLimit: maxInt256,
},
],
}); |
Hey @0xernesto, sorry for the late reply. First, if you want to set multiple permissions on the call policy, you can set like this: const callPolicy = await toCallPolicy({
permissions: [
{
abi: erc20Abi,
target: SEPOLIA_USDC_CONTRACT,
functionName: "transfer",
args: [
{
condition: ParamCondition.EQUAL,
value: TEST_ADDRESS_1
},
null
]
},
{
// This will emit type error but you can just ignore it.
abi: vaultAbi,
target: VAULT_CONTRACT,
functionName: "deposit",
args: [
{
condition: ParamCondition.EQUAL,
value: DEPOSIT_AMOUNT
},
null
]
}
]
}) In your cases, you basically want to set {
target: SEPOLIA_USDC_CONTRACT,
valueLimit: BigInt(0),
abi: erc20Abi,
functionName: "transfer",
args: [
{
condition: ParamCondition.EQUAL,
value: TEST_ADDRESS_1, // <------ sending USDC to this works
},
null,
],
},
{
target: SEPOLIA_USDC_CONTRACT,
valueLimit: BigInt(0),
abi: erc20Abi,
functionName: "transfer",
args: [
{
condition: ParamCondition.EQUAL,
value: TEST_ADDRESS_2, // <------ sending USDC to this does not work
},
null,
],
}, Regarding native token transfers, I could reproduce the error message when trying to set permissions for the native token transfers. The user op reverted during the simulation. I'm currently investigating the issue and will let you know as soon as it is resolved. |
Having multiple call policies for a session key does not work.
I can get the session key to work end-to-end for each individual policy below when it is the only policy in the array. When more than one policy is in the array, I get a 400 response status with the following detail:
UserOperation reverted during simulation with reason: 0x
.I also tried including the permissions associated with each policy below in the permissions array of a single call policy, but that resulted in
UserOperation reverted during simulation with reason: duplicate permissionHash
.I'm also running into issues when using
zeroAddress
as the target. Passing an actual address works, but when passingzeroAddress
, I get a 400 response status with the following detailUserOperation reverted during simulation with reason: 0x
.The
sessionKeyAgentERC20AndEth.js
script in this repo is what I was using to test.The text was updated successfully, but these errors were encountered: