Skip links

Metamask: How to deploy Gnosis secure proxy contracts on Mumbai testnet (Polygon) using Safe Core SDK?

Here is an article based on your request:

Deploying Gnosis Safe Proxy Contracts on Mumbai Testnet using Safe Core SDK

Introduction

————-

Gnosis Safe provides a secure way to delegate and manage assets across chains. One of the key elements of this ecosystem is the secure proxy contract, which allows users to earn rewards and tokens by transferring their assets to a trusted proxy. In this article, we will show you how to deploy a Gnosis Safe proxy contract on the Mumbai testnet using the Safe Core SDK.

Prerequisites

—————-

To complete this tutorial, you will need the following:

  • A Gnosis Safe account with a valid wallet (e.g. MetaMask)
  • Safe Core SDK installed and configured on your computer
  • Mumbai testnet URL:

Step 1: Create a new wallet

-----------------------------

Before you begin, create a new wallet for the Mumbai testnet with the following command:

npx secure core wallets --network Mumbai --create-wallet --wallet-name MySafeProxyWallet

This will create a new wallet called "MySafeProxyWallet".

Step 2: Configure the Safe Core SDK

--------------------------------

In this step, we need to configure the Safe Core SDK to use our newly created wallet. Run the following command:

npx safe-core setup --network Mumbai --wallet-name MySafeProxyWallet --proxy-type gnosis --proxy-identity-id MY_SAFE_PROXY_ID

Replace MY_SAFE_PROXY_ID' with the actual ID of your proxy contract on the Mumbai testnet.

Step 3: Create a proxy contract

--------------------------------

We will create a new proxy contract using the Safe Core SDK. Run the following command:

npx create secure core contracts --network mumbai --contract-name MyProxyContract --proxy-contract-id MY_SAFE_PROXY_ID

This will create a new Gnosis Safe proxy contract, MyProxyContract, with the specified ID.

Step 4: Deploy the Proxy Contract on the Testnet

-------------------------------------

We need to deploy the proxy contract on the Mumbai testnet. Run the following command:

npx safe-core contracts deploy --network mumbai --contract-dress

Replace with the actual address of your proxy contract on the Mumbai testnet.

Step 5: Verify the Proxy Contract Installation

-------------------------------------

We can verify that our proxy contract has been properly installed by checking its status:

npx safe-core contracts --network mumbai --contract-dress

This should display the deployment details of your proxy contract.

Troubleshooting Error: Invalid Safe Proxy Factory Contract Address

If you encounter an error such as "Error: Invalid safe proxy factory contract address when switching to ...", it may indicate that your wallet or proxy ID is incorrect. To resolve this issue, make sure that:

  • Your wallet address is correct.
  • The proxy ID in the Safe Core SDK configuration matches the proxy ID used on the Mumbai testnet.

Example Use Case

-----------------

Here is an example of deploying the Gnosis Safe proxy contract on the Mumbai testnet:

`javascript

const { createProxyContract } = require('@gnosis-safe/safe-core');

// Create a new wallet and proxy ID

const walletName = 'MySafeWallet';

const proxyId = 'MY_SAFE_PROXY_ID';

// Create a new proxy contract

async function main() {

const contractAddress = await createProxyContract({

network: "mumbai",

wallet: walletName,

proxyId: proxyId,

});

console.log(Proxy contract address: ${contractAddress}`);

// Deploy the proxy contract to the testnet

await contracts.

ETHEREUM CONFIRM ADDRESS

Leave a comment

Explore
Drag