Aim
Use a local script to batch transactions, after which the data field is logged and used as manual input in the Gnosis Transaction Builder UI custom data field
Context
- A list of roughly 50+ address should receive non-transferrable ERC20 tokens in varying amounts.
- The token contract uses a proxy pattern
- The owner of the token contract is the multi-sig. The token have to be "air-minted" to the addresses and the mint function is restricted to only the owner.
- I myself are not an owner or delegate of the given multi-sig so I cant propose a tx through a script, signing it locally
- The chain I'm using is Celo
Approach I'm taking
Create the transaction local with a script, copy pasting the data string in the custom data field in the Transaction Builder UI.
What works
Using the multi-sent Gnosis package, I am able to get it to work with a single transaction. After logging the data string, I just input it into the Transaction Builder UI with the correct contract address and are able to create a transaction. This is the code I'm using
// Encode transactions
const tx1: MetaTransaction = encodeSingle({
type: TransactionType.callContract,
to: '0x59578a7381a77770B4615...',
abi: deployer.token.interface.format(FormatTypes.json) as string,
value: '',
functionSignature: 'mint(address,uint256)',
inputValues: {
account: '0x62266a37cb6C4a06c10eD6...', // Address that receives the tokens
amount: parseEther('2').toString(), // Amount of tokens
},
id: '',
});
console.log(tx1.data);
What doesn't work
I tried following the same approach as above, using the MetaTransaction from the output of the encodeSingle
function as input for the encodeMulti
function. However when outputting the data field and pasting it into the custom data field, I get presetet with the error 'GS013', which basically tells me that something has gone wrong in the way I want to call the contract. I don't really have any other error log.
The code I used to generate the multi-send data field looks like this
const finalTx = encodeMulti(
[
{
to: '0x59578a7381a77770B461...',
value: parseEther('1').toString(), // This amount is not calculated but taken from the example tests: https://github.com/gnosis/ethers-multisend/blob/main/test/encodeMulti.spec.ts#L41
data: '0x40c10f1900000000000000000000000062266a37cb6c4a06c...69c7efcb70000000000000000000000000000000000000000000000001bc16d674ec80000', // Output of tx1.data
},
{
to: '0x59578a7381a77770B46153A...',
value: parseEther('1').toString(),
data: '0x40c10f19000000000000000000000000fda58254cbf6fa8ec...4cf5b7ebee35e0000000000000000000000000000000000000000000000001bc16d674ec80000', // Output of tx2.data
},
],
'0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B' // multisent contract Celo https://explorer.celo.org/mainnet/address/0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B/contracts#address-tabs
);
console.log(finalTx.data);
When batching a tx through the Gnosis Transaction Builder, it is sent to the multi-sent contract (see address in code snippet) for execution. When batching the tx, the to
value is defined as the receiver contract so I've used the multi-send contract as receiver address as well, using the custom data field to past the output of my script but same error
Any help is appreciated!