1

The hardhat plugin for deploying via safe doesn't work.

I read in an old answer to use performCreate of CreateCall.sol contract to smart contracts, so I'm using this script for creating a transaction to deploy a contract

  const createCallTransaction = await (
    await safeProvider.getCreateCallContract({ safeVersion: "1.4.1" })
  ).performCreate([0n, BYTECODE], {});
  console.log("Tx", createCallTransaction)

to which I get a result

Tx {
  hash: '0xb...e31',
  options: { gasLimit: '4389740' },
  transactionResponse: ContractTransactionResponse {
    provider: JsonRpcProvider {},
    blockNumber: null,
    blockHash: null,
    index: undefined,
    hash: '0xb...e31',
    type: 0,
    to: '0x9b35Af71d77eaf8d7e40252370304687390A1A52',
    from: '0x1...81D8',
    nonce: 99,
    gasLimit: 4389740n,
    gasPrice: 1000000000n,
    maxPriorityFeePerGas: null,
    maxFeePerGas: null,
    maxFeePerBlobGas: null,
    data: '0x4c8c...'
    value: 0n,
    chainId: 476462898n,
    signature: Signature { r: "0x2...", s: "0x18...", yParity: 0, networkV: 952925831 },
    accessList: null,
    blobVersionedHashes: null
  }
}

This createCallTransaction is of type TransactionResult of safe-core-sdk. Now when I use it with apiKit.proposeTransaction() to send it for approval from other owners, it requires the transaction to be of type SafeTransactionData

await apiKit.proposeTransaction({
   safeAddress: "0xf...28",
   safeTransactionData: createCallTransaction.transactionResponse.data,
   safeTxHash: createCallTransaction.hash,
   senderAddress: "0x...D8",
   senderSignature: createCallTransaction.transactionResponse.signature,
 });

How can I deploy contracts from my Safe (and perform other smart contract calls)

1 Answer 1

2

Great question.

You would have to use createTransaction from the Safe {Core} Protocol Kit to create a Safe Transaction.

Can you give it a try and come back here?

If it works, please mark your questions answered.

1
  • Thanks, I'm able to createTransactions with this and execute them too, but I'm not able to broadcast these transactions using apiKit, will create a new Issue for this. Commented Aug 30 at 9:27

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.