Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding initial repo files #1

Merged
merged 10 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
audits/*
coverage*
lib/*
41 changes: 41 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 13
},
"ignorePatterns": [
"artifacts/*",
"cache/*",
"node_modules/*",
"third_party/*"
],
"rules": {
"camelcase": [
2, {
"properties": "always"
}
],
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"no-unused-vars": "warn"
}
};
50 changes: 50 additions & 0 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Workflow
on:
push:
branches:
- main
pull_request:

jobs:
build:
continue-on-error: False
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive

- name: Get a specific Node.js version such that hardhat does not hang periodically
uses: actions/setup-node@v3
with:
node-version: "18.15.0"

# Install modules
- name: Install modules
run: yarn install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

# Run linters
- name: Run ESLint
run: ./node_modules/.bin/eslint . --ext .js,.jsx,.ts,.tsx
- name: Run solhint
run: ./node_modules/.bin/solhint contracts/p1/*.sol contracts/test/*.sol

# Compile the code and run tests and deploy script(s)
- name: Compile the code
run: ./node_modules/.bin/hardhat compile
- name: Run tests
run: ./node_modules/.bin/hardhat test

# Run hardhat coverage and upload codecov report
- name: Solidity coverage summary
run: ./node_modules/.bin/hardhat coverage

# Compile the code and run foundry tests
- name: Run foundry tests
run: forge test --hh -vvv
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Object file
*.o
node_modules
.env
coverage
coverage.json
typechain
*.DS_Store
.idea

# Ada Library Information
*.ali
# Hardhat files
cache
artifacts
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/autonolas-registries"]
path = lib/autonolas-registries
url = https://github.com/valory-xyz/autonolas-registries.git
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
8 changes: 8 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
skipFiles: [
"test/ABICreator.sol",
"test/ERC20Token.sol",
"test/MockAgentMech.sol",
"test/SafeNonceLib.sol"
]
};
15 changes: 15 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "solhint:recommended",
"plugins": [],
"rules": {
"compiler-version": ["warn", ">=0.8.21"],
"func-visibility": ["warn",{"ignoreConstructors":true}],
"no-empty-blocks": "off",
"not-rely-on-time": "off",
"const-name-snakecase": "off",
"avoid-suicide": "error",
"avoid-sha3": "warn",
"var-name-mixedcase": "off",
"mark-callable-contracts": "off"
}
}
75 changes: 73 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,73 @@
# autonolas-staking-programmes
Autonolas Staking Programmes
# Autonolas Staking Programmes

## Introduction
This repository contains the Autonolas Staking Programmes set of contracts. It is built on top of a core service staking
functionality of [autonolas-staking-programmes](https://github.com/valory-xyz/autonolas-staking-programmes).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean registries here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch, it was registries before, but the renaming changed it :)

## Development

### Prerequisites
- This repository follows the standard [`Hardhat`](https://hardhat.org/tutorial/) development process.
- The code is written on Solidity `0.8.21`.
- The standard versions of Node.js along with Yarn are required to proceed further (confirmed to work with Yarn `1.22.19` and npx/npm `10.1.0` and node `v18.17.0`).

### Install the dependencies
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
```

### Core components
The contracts, deployment scripts and tests are located in the following folders respectively:
```
contracts
scripts
test
```

### Compile the code and run
Compile the code:
```
npx hardhat compile
```
Run the tests:
```
npx hardhat test
```
Run tests with forge:
```
forge test --hh -vvv
```


### Linters
- [`ESLint`](https://eslint.org) is used for JS code.
- [`solhint`](https://github.com/protofire/solhint) is used for Solidity linting.


### Github Workflows
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

## Deployment
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](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/scripts/deployment).

The finalized contract ABIs for deployment and their number of optimization passes are located here: [ABIs](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/abis).
Each folder there contains contracts compiled with the solidity version before their deployment.

### Audits
The audit is provided as development matures. The latest audit report can be found here: [audits](https://github.com/valory-xyz/autonolas-staking-programmes/blob/main/audits).


## Acknowledgements
The staking programmes contracts were inspired and based on the following sources:
- [Rari-Capital Solmate](https://github.com/Rari-Capital/solmate).
- [Autonolas Registries](https://github.com/valory-xyz/autonolas-registries).
- [Gnosis Mech](https://github.com/gnosis/mech).
- [Safe Ecosystem Safe Contracts](https://github.com/safe-global/safe-contracts).
Loading