#How can I reduce the number of account updates on transfer ?

6 messages · Page 1 of 1 (latest)

craggy kite
#

Hello,
I have a method that transfers tokens from the user to the smartcontract, and from the smartcontract to the user, but with all these transfers I get an error:

Error: The transaction is too expensive, try reducing the number of AccountUpdates that are attached to the transaction.
Each transaction needs to be processed by the snark workers on the network.
Certain layouts of AccountUpdates require more proving time than others, and therefore are too expensive.

It seems that a transfer generates 3 calls

craggy kite
#

I currently do a deposit and then a swap to make it work, but it would be better if I could do it in one transaction.

wintry carbon
empty quarry
#

@craggy kite looking at your transaction layout, each account update seems strictly necessary, except maybe the one created by fundNewAccount(). If you can ensure accounts exist before calling this method, you could save that one

craggy kite
empty quarry
#

tbh I'm not sure if that will edge it below the limit. definitely try it out