This repository contains the Mech Marketplace set of contracts registering mechs and performing their interactions for requests delivery via the means of the Marketplace. Read docs for a detailed Mech Marketplace description.
- This repository follows the standard
Hardhat
development process. - The code is written on Solidity
0.8.28
. - The standard versions of Node.js along with Yarn are required to proceed further (confirmed to work with Yarn
1.22.19
and npx/npm10.8.2
and nodev20.18.1
).
The project has submodules to get the dependencies. Make sure you run git clone --recursive
or init the submodules yourself.
The dependency list is managed by the package.json
file, and the setup parameters are stored in the hardhat.config.js
file.
Simply run the following command to install the project:
yarn install
The contracts, deployment scripts and tests are located in the following folders respectively:
contracts
scripts
test
Compile the code:
npx hardhat compile
Run the tests:
npx hardhat test
The PR process is managed by github workflows, where the code undergoes several steps in order to be verified. Those include:
- code installation
- running linters
- running tests
The deployment of contracts to the test- and main-net is split into step-by-step series of scripts for more control and checkpoint convenience. The description of deployment procedure can be found here: deployment.
The finalized contract ABIs for deployment and their number of optimization passes are located here: ABIs. Each folder there contains contracts compiled with the solidity version before their deployment.
The list of contract addresses for different chains and their full contract configuration can be found here.
- The audit is provided as development matures. The latest audit report can be found here: audits.
The list of contract addresses for different chains and their full contract configuration can be found here.
flowchart LR
DAO -- changeMarketplaceParams --> MechMarketplace
DAO -- setMechFactoryStatuses --> MechMarketplace
DAO -- setPaymentTypeBalanceTrackers --> MechMarketplace
DAO -- setMechMarketplaceStatuses --> Karma
Account -- create --> MechMarketplace
Account -- request --> MechMarketplace
Account -- requestBatch --> MechMarketplace
MechMarketplace -- create --> MechFactory
MechFactory -- new --> Mech
MechMarketplace -- requestFromMarketplace --> Mech
MechMarketplace -- changeRequesterMechKarma --> Karma
MechMarketplace -- changeMechKarma --> Karma
MechService -- deliverToMarketplace (priority or delivery mech) --> Mech
MechService -- deliverMarketplaceWithSignatures --> Mech
Mech -- deliverMarketplace --> MechMarketplace
Mech -- deliverMarketplaceWithSignatures --> MechMarketplace
MechMarketplace -- checkAndRecordDeliveryRates --> BalanceTracker
MechMarketplace -- finalizeDeliveryRates --> BalanceTracker
MechMarketplace -- adjustMechRequesterBalances --> BalanceTracker
The core workflow of the Mech Marketplace, including the roles and interactions of key participants, as well as an overview of the smart contracts, can be found here.
The registry mech contracts were inspired and based on the following sources: