Skip to content

unicrowio/contracts

Repository files navigation

Unicrow Contracts and Interfaces

The map below might be useful to get quick bearings

Contracts Map

Note: To make the map reasonably orderly, only the most significant relationships are displayed

Basic Setup and Types

To install the packages:

yarn install

To generate the types and compile the contracts with the new ABI:

yarn hardhat compile

To get local rpc accounts:

yarn hardhat accounts

To get the configured safe account:

yarn hardhat safe

Setup RPC Locally

Run ganache server to run a local RPC:

yarn hardhat node --no-deploy

Deploy the Contracts

Setup environment variables:

cp .env.example .env
KEY VALUE
GNOSIS_SAFE_ADDRESS Governance/fees address (can also be a normal address)
MNEMONIC Mnemonic of the wallet to be used for deployments
SAFE_SERVICE_URL Gnosis safe service url (to submit tx proposals)
UNICROW_FEE Unicrow fee (in bips)
ETHERSCAN_API_KEY Only used for contract verification
ARBISCAN_API_KEY Only used for contract verification

Deploy the Unicrow contracts (directly) on your local node:

yarn deploy:local

Deploy the Unicrow contracts (directly) on the Sepolia testnet:

yarn deploy:sepolia

Deploy the Unicrow contracts (directly) on the Arbitrum Sepolia testnet:

yarn deploy:arbitrumSepolia

Deploy the Unicrow contracts on Arbitrum One (via the Gnosis Safe):

yarn deploy:arbitrum:viasafe

Interact using a console

It is recommended running the tests (see below) to test interactions with the contracts, but it is possible to do it using the console too by running a console instance first and then attaching an address.

Open the console:

yarn hardhat console --network development

Initiate a contract:

let unicrow = ethers.getContractFactory("Unicrow") // Replace "Unicrow" for a name of any other contract
unicrow = await unicrow.attach("address_of_the_contract_here"); // address you got during the deployment

Call the contract function:

await unicrow.pay({ paramters }) 

Tests

Run the tests locally:

yarn hardhat test --network localhost