# Package to interact with smart contracts with Gnosis Safe

For those wishing to use Gnosis safes headlessly to propose new txs or deploy contracts

## Usage

- Install the package `yarn add -D safe-wrapped-contract`
- Import in the script file `import { getSafeWrappedContract } from "safe-wrapped-contract";`
- Call the `getSafeWrappedContract` function and it will return a new contract. Simply interact with the contract and the new tx(s) will be shown on the Safe UI.

### Caveat

The tx(s) submitted are required to be successful, or a "GS013" error will be shown. See [Safe contracts](https://github.com/safe-global/safe-contracts/blob/96a4e280876c33c53a09b5ef6ee78201a101ff58/contracts/Safe.sol#L201)

## Test

The following test procedure simulates how a project uses this package

1. run `yarn link` in root
2. `cd test/project && yarn`
3. Run `yarn link safe-wrapped-contract` to link to local package, if getting cannot find module, make sure to build first in root
4. `yarn test --network <NETWORK>`
5. see the results on the Safe UI
6. (Optional) Test proxy contracts using delegate calls `yarn hardhat run scripts/testSafeWrappedDelegateCall.ts --network <NETWORK>`

- if package's code is changed, run `yarn build` in root to rebuild the package
- after testing, run `yarn unlink safe-wrapped-contract` in test/project, then `yarn unlink` in root.

## Publish

Run `yarn publish`

## Info

Goerli safe service url: https://safe-transaction-goerli.safe.global
