gnosis-safe – How to Handle Safe-Core-SDK Multi-Send Transaction Reversion if One Action Fails

gnosis-safesafe-core-sdk

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.

Best Answer

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

Related Topic