1

Am currently using the Gnosis safe-core-sdk and safe-service-client. Am building out some functionality which batch sends varying amounts of tokens to various addresses using the multi send feature that is part of the SDK.

I have built it out so that I can build a transaction via the core sdk, and then propose it using the safe-service-client. At this point, the transaction is visible in the Gnosis Safe official UI, for the vault I have sent it too. It contains all the actions (token transfers) that were specified in the transaction that was proposed.

What am I wondering is, what happens to the transaction if one of the actions/transfers fails? My presumption is that the entire transaction reverts and none of the token transfers are completed, but would be good to confirmation of this.

Thanks in advance.

1 Answer 1

1

The MultiSend.sol library requires transactions to be successful, so yeah, if one of the underlying transactions fails, it should revert:

https://github.com/gnosis/safe-contracts/blob/main/contracts/libraries/MultiSend.sol#L58-L59

You can test if it reverts by estimating the gas for the transaction beforehand. It won't be able to estimate gas if the transaction is failing.

safe-core-sdk should throw an error if the transaction reverted too

6
  • Awesome, thanks for clarifying that. Is there a way to estimate multi-send transactions? The endpoint is only for single send right? /v2/safes/{address}/transactions/estimate/. Would you have to just loop through each action and get an estimate for each one?
    – jmulq
    Commented Jan 14, 2022 at 10:25
  • the transactions are encoded in the ethereum transaction data, so in the end, you have 1 transaction. check how it's encoded in the interface github.com/gnosis/safe-react/blob/dev/src/logic/safe/… or you can check tests in safe-contracts repository
    – mikheevm
    Commented Jan 14, 2022 at 11:19
  • You have to set the gasPrice, baseGas, and safeTxGas as part of creating the multi-send transaction though? Therefore need to hit the estimate endpoint before the transaction is created. If this is the case, then what data do you post for the transaction to the endpoint to get these gas estimates? Or am I missing something :D
    – jmulq
    Commented Jan 14, 2022 at 12:50
  • gasPrice and baseGas are relevant only if you use a relayer/want gas refunds, safeTxGas is the available gas limit for the internal transaction, if you use contracts 1.3.0 it's not really required
    – mikheevm
    Commented Jan 14, 2022 at 14:08
  • Okay so with v1.3.0 of the safe-core-sdk I can basically all of those options as part of a multi-send transaction? The issue I'm having is that v1.3.0 causes this issue github.com/gnosis/safe-core-sdk/issues/139 - which means in the official safe UI, the transaction has 0 for the gas limit, and one for the gas price. The same is true of v1.1.1
    – jmulq
    Commented Jan 14, 2022 at 14:17

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.