Skip to main content

Deploy a Gnosis Safe on Your Subnet-EVM

warning

This document has been deprecated and may contain incorrect/obsolete information.

Introduction

This article shows how to deploy and interact with a Gnosis Safe programmatically on any Subnet-EVM.

If you are looking for more information regarding the Gnosis Safe protocol, please check out these developer docs.

Prerequisites

This tutorial assumes that:

  • A Subnet and EVM blockchain has been created. Avalanche tools allow users to do this on Mainnet, Fuji or a Local network.
  • Your node is currently validating your target Subnet.
  • Your wallet has a balance of the Subnet native token (specified under alloc in your Genesis File).

The entirety of this tutorial will require you to work with 3 projects (4 if running locally)

Custom Network Workflow

Setup Network

In order for the gnosis-safe repo to successfully deploy these contracts, ensure that you have jq and yarn installed.

On Ubuntu, run sudo apt install jq, sudo apt install yarn. On Linux, run brew install jq, brew install yarn.

Next, clone the library. Change .env.example to .env and set the variable,MNEMONIC to the seed phrase of the wallet you intend to deploy the contracts with. Set ADDRESS to the public key of the same wallet. Finally, set NODE_URL to the URL of your Subnet's RPC.

note

This address you choose must be funded as the transactions will include a gas fee.

Example:

export MNEMONIC="foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar"
export ADDRESS="0xA028036b2aaAED2487654B2B042C2AA9FA5Ef6b8"
export NODE_URL="https://api.avax-test.network/ext/bc/C/rpc"

Deploy the Safe Contracts

After setting up the .env file and installing jq, simply run ./deploy.sh.

deploying "SimulateTxAccessor" (tx: 0xb2104e7067e35e1d2176ee53f6030bbcef4a12051505daca603d097d87ebd3e2)...: deployed at 0x52C84043CD9c865236f11d9Fc9F56aa003c1f922 with 237301 gas
deploying "GnosisSafeProxyFactory" (tx: 0x8faec24dda341141e02d1b898ceefe445b2893b3f600f1f79a5e04e3a91396cd)...: deployed at 0x17aB05351fC94a1a67Bf3f56DdbB941aE6c63E25 with 865918 gas
deploying "DefaultCallbackHandler" (tx: 0xa1a48e8869c71cb10e9ca5f2ce20420c44ce09dc32aa13efbd2ebc3796bcf145)...: deployed at 0x5aa01B3b5877255cE50cc55e8986a7a5fe29C70e with 541390 gas
deploying "CompatibilityFallbackHandler" (tx: 0x05d1f9ef7cafd2dbc5d4b9621d15e15f2416e6917371355718e6194d6e39871a)...: deployed at 0x5DB9A7629912EBF95876228C24A848de0bfB43A9 with 1235752 gas
deploying "CreateCall" (tx: 0xbb40c1594dc5cdb1a37b8890e2a0e610c0339af157d094d008e8eebcf3eb3275)...: deployed at 0x4Ac1d98D9cEF99EC6546dEd4Bd550b0b287aaD6D with 294075 gas
deploying "MultiSend" (tx: 0x075067ca5e4755c31e8dbe5e16cd597f86fb141f45de254d39b050568ef2a3a6)...: deployed at 0xA4cD3b0Eb6E5Ab5d8CE4065BcCD70040ADAB1F00 with 189518 gas
deploying "MultiSendCallOnly" (tx: 0xa237e18fb2561c2081341f3621ff559063bd07c6b9f77aefdaf103f976751353)...: deployed at 0xa4DfF80B4a1D748BF28BC4A271eD834689Ea3407 with 141745 gas
deploying "SignMessageLib" (tx: 0x1cc1322268015fee470529682dbc9bfc8aa068554df841de824524cdfb8bc2e8)...: deployed at 0xe336d36FacA76840407e6836d26119E1EcE0A2b4 with 261758 gas
deploying "GnosisSafeL2" (tx: 0x341ec664d3a5c2c98f1c3f5862651ba82e0c2d12875d69ad3bdf8d1d5e3e074b)...: deployed at 0x95CA0a568236fC7413Cd2b794A7da24422c2BBb6 with 5268965 gas
deploying "GnosisSafe" (tx: 0x10dcf8c5f53ae698c77d7f60d6756b4b24f2f8224e14e21658c421e158a84cd4)...: deployed at 0x789a5FDac2b37FCD290fb2924382297A6AE65860 with 5086960 gas
✨ Done in 26.90s.

Not all contracts will deploy, but that is expected behavior. If you see this output, everything worked as expected:

Verification status for CompatibilityFallbackHandler: SUCCESS
Verification status for CreateCall: SUCCESS
Verification status for DefaultCallbackHandler: SUCCESS
Verification status for GnosisSafe: SUCCESS
Verification status for GnosisSafeL2: SUCCESS
Verification status for GnosisSafeProxyFactory: SUCCESS
Verification status for MultiSend: FAILURE
Verification status for MultiSendCallOnly: SUCCESS
Verification status for SignMessageLib: SUCCESS
Verification status for SimulateTxAccessor: FAILURE

Deployment information, including contract addresses can be found in safe-contracts/deployments/custom.

note

Please record your GnosisSafeL2 and GnosisSafeProxyFactory to be able to create a Safe on your Subnet.

The deployment of the contracts is using a proxy factory, therefore the address is depending on the bytecode. If the address is the same then the deployment bytecode of the contract is also the same (assuming that the target chain follows the EVM specifications set in the Ethereum Yellow Paper).

Was this page helpful?