2

I am using Stackup's bundler to send my user operations.

I want to have my own Paymaster to let the user pay in ERC20 tokens. I cloned Pimlico's ERC20 Paymaster contract and deployed it. Now the issue I am facing is that I am not able to generate the correct paymasterAndData field.

If I use pimlico's SDK to generate the data, it returns something like this 0x848efc3d7d7b01d03c9885647de70b59677a73f1000000000000000000000000000000000000000000000000000000000000061f

And this is what they do internally to generate it

 const tokenAmount = await this.calculateTokenAmount(userOp)
        const paymasterAndData = utils.hexlify(
            utils.concat([this.contract.address, utils.hexZeroPad(utils.hexlify(tokenAmount), 32)])
        )
        return paymasterAndData

But when I send this user operation the bundler returns with code: -32500 - transaction rejected by entryPoint’s simulateValidation, during wallet creation or validation

But if I use pimlico's bundler and I use the pm_sponsorUserOperation rpc call, I get back this string 0x03b9a376b6bfda6fce215614b5be52b10528df3e0000000000000000000000000000000000000000000000000000000064e9d41c0000000000000000000000000000000000000000000000000000000000000000d5d89c31fbc2c692d9d85ba1eaa737470b97944256e61f06cb7c6f0f07c180d42f101d3d03ccf2cc6958652d915fe904adf15627ee505a7f1cb6a1dd2eac40f71b And this string is accepted by Pimlico's bundler as valid paymasterAndData, but won't work if I set this as the paymasterAndData field and send to stackup's bundler.

How do I generate a paymasterAndData field just by using pure ethers.js and not depend on the bundler to do it for me?

1 Answer 1

1

I have also created a userOp with Paymaster, but I have used the Biconomy SDK for it. I have created paymasterAndData using this. paymasterAndData: hexConcat([ paymaster.address, hexZeroPad(token.address, 20), ])

I hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.