Skip to content

Aut-Labs/contracts

Repository files navigation

deployed on mumbai testnet

Āut Labs - Smart Contracts

Below, you'll find a simple walkthrough to get started using Āut's Smart Contracts.

Docker Setup

Create docker network (once)

docker network create mainnet

Run local blockchain node & deploy contracts. Now the local node is accessable at http://localhost:8545 (with chainId=31337) The deployer's PK is specified in dev.env

docker-compose up --build

Run local graph node

docker-compose -f docker-compose.graph.yml up

Deploy subgraphs

(
    cd subgraphs
    yarn create-local
    yarn deploy-local
)

Here's a simple description of each contract and its function in our contracts suite.

Contracts

AutID.sol

The core contract of the protocol. All participants are required to go through the AutID contract to create an account and join hubs.

GlobalParameters.sol

Globally-defined variables used across the protocol. Variables of note are period0Start, periodDuration, constraintFactor, and penaltyFactor.

HubRegistry.sol

Central point of hubs where the hub implementation is stored and new hubs are created.

HubDomainsRegistry.sol

Each hub can register an X.hub domain, as registered through this contract.

TaskRegistry.sol

Where all taskIds are registered, to be used within a Contribution.

Hub.sol

Stores values related to the hub like admins and hub parameters. Each hub is connected to a unique TaskFactory, TaskManager, ParticipationScore, and Membership contract.

TaskFactory.sol

Location for hub admins to create Contributions and register Descriptions.

TaskManager.sol

Contract where Contributions are managed through creation and removal. Members can commit to a Contribution, and are then given the Contribution.

Membership.sol

Here, you can find the hub members, their role and commitment level for the Hub.

ParticipationScore.sol

Hub member participation scores and performance are stored within ParticipationScore.sol.

Setup

Install Foundry

Using Foundryup

Foundryup is the Foundry toolchain installer. You can find more about it here.

Open your terminal and run the following command:

curl -L https://foundry.paradigm.xyz | bash

This will install Foundryup, then simply follow the instructions on-screen, which will make the foundryup command available in your CLI.

Running foundryup by itself will install the latest (nightly) precompiled binaries: forge, cast, anvil, and chisel. See foundryup --help for more options, like installing from a specific version or commit.

Deployments

Deploy Using Forge Script

forge script  ./script/DeployAll.s.sol --rpc-url $RPC_URL --etherscan-api-key $XSCAN_TOKEN --private-key $DEPLOYER_PRIVATE_KEY --verify --broadcast 

Simulate the deployment locally first by running the command without the --broadcast (and --verify) flag.

$RPC_URL replace with the desired EVM RPC. Private RPC recommended. (Alchemy, Infura etc.)
$XSCAN_TOKEN network specific blockchain explorer API key, use to upload ABIs and verify contracts
$DEPLOYER_PRIVATE_KEY The private key of the deploying account (needs to have sufficient gas token balance)

Get Artifacts Using Forge

forge build Now all artefacts are stored in the out/ folder (repository root)

Useful commands

Foundry

forge b #build
forge t #test
forge fmt #format
forge help