• Stars
    star
    1,827
  • Rank 25,408 (Top 0.6 %)
  • Language
    TypeScript
  • License
    GNU Lesser Genera...
  • Created about 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Safe allows secure management of blockchain assets.

Safe Contracts

npm version Build Status Coverage Status

⚠️ This branch contains changes that are under development To use the latest audited version make sure to use the correct commit. The tagged versions that are used by the Safe team can be found in the releases.

Usage

Install requirements with yarn:

yarn

Testing

To run the tests:

yarn build
yarn test

Optionally, if you want to run the ERC-4337 compatibility test, it uses a live bundler and node, so it contains some pre-requisites:

  1. Define the environment variables:
ERC4337_TEST_BUNDLER_URL=
ERC4337_TEST_NODE_URL=
ERC4337_TEST_SINGLETON_ADDRESS=
ERC4337_TEST_SAFE_FACTORY_ADDRESS=
MNEMONIC=
  1. Pre-fund the executor account derived from the mnemonic with some Native Token to cover the deployment of an ERC4337 module and the pre-fund of the Safe for the test operation.

Deployments

A collection of the different Safe contract deployments and their addresses can be found in the Safe deployments repository.

To add support for a new network follow the steps of the Deploy section and create a PR in the Safe deployments repository.

Deploy

⚠️ Make sure to use the correct commit when deploying the contracts. Any change (even comments) within the contract files will result in different addresses. The tagged versions that are used by the Safe team can be found in the releases.

Current version: The latest release is v1.3.0-libs.0 on the commit 767ef36

This will deploy the contracts deterministically and verify the contracts on etherscan using Solidity 0.7.6 by default.

Preparation:

  • Set MNEMONIC in .env
  • Set INFURA_KEY in .env
yarn deploy-all <network>

This will perform the following steps

yarn build
yarn hardhat --network <network> deploy
yarn hardhat --network <network> sourcify
yarn hardhat --network <network> etherscan-verify
yarn hardhat --network <network> local-verify

Custom Networks

It is possible to use the NODE_URL env var to connect to any EVM based network via an RPC endpoint. This connection then can be used with the custom network.

E.g. to deploy the Safe contract suite on that network you would run yarn deploy-all custom.

The resulting addresses should be on all networks the same.

Note: Address will vary if contract code is changed or a different Solidity version is used.

Replay protection (EIP-155)

Some networks require replay protection, making it incompatible with the default deployment process as it relies on a presigned transaction without replay protection (see https://github.com/Arachnid/deterministic-deployment-proxy).

Safe contracts use a different deterministic deployment proxy (https://github.com/safe-global/safe-singleton-factory). To make sure that the latest version of this package is installed, make sure to run yarn add @gnosis.pm/safe-singleton-factory before deployment. For more information, including how to deploy the factory to a new network, please refer to the factory repo.

Note: This will result in different addresses compared to hardhat's default deterministic deployment process.

Verify contract

This command will use the deployment artifacts to compile the contracts and compare them to the onchain code

yarn hardhat --network <network> local-verify

This command will upload the contract source to Etherescan

yarn hardhat --network <network> etherscan-verify

Documentation

Audits/ Formal Verification

Security and Liability

All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

License

All smart contracts are released under LGPL-3.0

More Repositories

1

safe-wallet-web

Safe{Wallet} – multisig EVM wallet
TypeScript
352
star
2

safe-apps-sdk

Client-side SDKs to create third-party Safe Apps
TypeScript
205
star
3

safe-core-sdk

The Safe{Core} Account Abstraction SDK allows builders to add account abstraction functionality into their apps.
TypeScript
202
star
4

safe-transaction-service

Keeps track of transactions sent via Safe contacts and confirmed transactions. It also keeps track of Ether and ERC20 token transfers to Safe contracts.
Python
184
star
5

safe-modules

A collection of modules that can be used with the Safe contract
TypeScript
140
star
6

safe-cli

Command line utility for Gnosis Safe
Python
138
star
7

safe-deployments

A collection of Safe singleton deployments
TypeScript
131
star
8

safe-eth-py

Safe-eth-py includes a set of libraries to work with Ethereum and relevant Ethereum projects
Python
118
star
9

safe-ios

Safe Multisig iOS app.
Swift
114
star
10

safe-react-apps

A repository for applications for Safe Web Interface
TypeScript
99
star
11

safe-android

πŸ” App to manage and interact with Safe
Kotlin
90
star
12

safe-singleton-factory

Singleton factory used by Safe related contracts
TypeScript
77
star
13

safe-docs

Developer Docs for building on Safe.
MDX
51
star
14

safe-react-components

Gnosis Safe component library
TypeScript
35
star
15

safe-user-allocation-reports

Python
34
star
16

account-abstraction-sdk

TypeScript
31
star
17

safe-config-service

The safe-config-service is a service that provides configuration information in the context of the Safe clients environment
Python
31
star
18

safe-client-gateway

Serves as a bridge for the Safe{Wallet} clients (Android, iOS, Web)
TypeScript
23
star
19

safe-gateway-typescript-sdk

Safe Gateway TypeScript SDK
TypeScript
20
star
20

safe-token

TypeScript
19
star
21

safe-infrastructure

One `docker-compose.yml` file to rule them all
Shell
19
star
22

safe-modules-deployments

This repo contains a collection of deployments of audited contracts from the Safe modules repository.
TypeScript
9
star
23

safe-ecosystem-database

Safe ecosystem database
HTML
6
star
24

safe-homepage

Safe homepage
TypeScript
6
star
25

safe-gelato-relay-service

The Safe Gelato Relay Service is a web service which allows relaying transactions via the Gelato Relay Service.
TypeScript
6
star
26

safe-services-status

πŸ“ˆ Uptime monitor and status page for Safe, powered by @upptime
Markdown
5
star
27

claiming-app-data

Vesting data converter and proofs generator.
Python
5
star
28

safe-dao-governance-app

The portal to Safe{DAO} governance, voting power delegation and allocation claiming.
TypeScript
3
star
29

safe-pm

Production coordination for the Safe team primarily focused on Problems that need to be solved
2
star
30

safe-locking

Safe Token Locking Contracts
TypeScript
2
star
31

safe-guardians-page

This page is dedicated to the Safe Guardians program, a program designed to reward active members of the Safe community, who use their powers to contribute positively to the ecosystem.
TypeScript
2
star
32

safecon-landing-page

Safe{Con} landing page
CSS
1
star
33

cla-signatures

CLA signatures repository
1
star
34

token-list

This repo contain the Safe default token list. This list contains tokens which appear by default in the Safe wallet interface and are not part of the imported default token lists.
Shell
1
star