Skip to content

gelatodigital/smartwallet-contracts

Repository files navigation

Smart Wallet Contracts

This repository contains the smart contracts for the Gelato Smart Wallet.

Prerequisites

Before you begin, ensure you have the following installed:

If you want to deploy contracts, you also need to have a SPONSOR_API_KEY which you can get here.

Alternatively, you can deploy contracts manually. For this you will need:

  • An EOA with sufficient funds for deployment on the target network
  • Access to an RPC endpoint for your target network

Setup Guide

Periphery contracts in this repository rely on several external contracts which are added as submodules in this repo.

To install submodules:

chmod +x install-submodules.sh

./install-submodules.sh

To install packages:

pnpm install

Gasless Deployment Guide (Recommended)

1. Environment Setup

  1. Create a .env file in the root directory:
cp .env.example .env
  1. Configure your environment variables in .env:
SPONSOR_API_KEY="" # https://app.gelato.network/relay
TARGET_ENV="" # either 'testnet' or 'mainnet'
ETHERSCAN_API_KEY=""
  1. Load the environment variables:
source .env

2. Network Configuration

Add your target chain to the deploy/chains.ts configuration:

  1. Open deploy/chains.ts
  2. Locate the testnets or mainnets section
  3. Add your chain object following the existing format

The chain object can be imported from viem/chains. If the chain is not exported by viem you can add it manually. An example of this is thriveTestnet and abcTestnet.

3. Deploy Contracts

Run the deployment script:

pnpm run deploy

Manual Deployment Guide

1. Environment Setup

  1. Create a .env file in the root directory:
cp .env.example .env
  1. Configure your environment variables in .env:
# Required for deployment
PRIVATE_KEY=""
RPC_URL=""
ETHERSCAN_API_KEY=""
  1. Load the environment variables:
source .env

2. Deploy Contracts

Run the deployment script using Forge:

Delegation:

forge script ./script/DeployDelegation.s.sol \
    --rpc-url $RPC_URL \
    --broadcast

SessionValidator:

forge script ./script/DeploySessionValidator.s.sol \
    --rpc-url $RPC_URL \
    --broadcast

Verify Contracts

After deployment, verify your contract on the network's block explorer:

Delegation:

forge verify-contract <DEPLOYED_ADDRESS> \
    ./src/Delegation.sol:Delegation \
    --chain-id <CHAIN_ID> \
    --verifier <etherscan|blockscout> \
    --verifier-url <VERIFIER_URL> \
    --etherscan-api-key $ETHERSCAN_API_KEY

SessionValidator:

forge verify-contract <DEPLOYED_ADDRESS> \
    ./src/validators/Session.sol:SessionValidator \
    --chain-id <CHAIN_ID> \
    --verifier <etherscan|blockscout> \
    --verifier-url <VERIFIER_URL> \
    --etherscan-api-key $ETHERSCAN_API_KEY

Support

For questions or issues, please open an issue in this repository or contact the Gelato team.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •