Skip to content

Commit

Permalink
Merge pull request #1130 from airswap/develop
Browse files Browse the repository at this point in the history
Publishing latest V4 contracts
  • Loading branch information
dmosites authored May 8, 2023
2 parents d866fdd + cf780c4 commit f8e781f
Show file tree
Hide file tree
Showing 109 changed files with 5,577 additions and 5,431 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-var-requires": 0
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/ban-ts-comment": 0
}
}
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pretty:check && yarn lint:check
yarn lint:check && yarn pretty:check
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| :------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------ | :---------------------------- |
| [`@airswap/swap`](/source/swap) | [![npm](https://img.shields.io/npm/v/@airswap/swap)](https://www.npmjs.com/package/@airswap/swap) | Atomic Token Swap |
| [`@airswap/swap-erc20`](/source/swap-erc20) | [![npm](https://img.shields.io/npm/v/@airswap/swap-erc20)](https://www.npmjs.com/package/@airswap/swap-erc20) | Atomic Token Swap (ERC20) |
| [`@airswap/maker-registry`](/source/maker-registry) | [![npm](https://img.shields.io/npm/v/@airswap/maker-registry)](https://www.npmjs.com/package/@airswap/maker-registry) | Maker Discovery |
| [`@airswap/registry`](/source/registry) | [![npm](https://img.shields.io/npm/v/@airswap/registry)](https://www.npmjs.com/package/@airswap/registry) | Server Discovery |
| [`@airswap/indexer-registry`](/source/indexer-registry) | [![npm](https://img.shields.io/npm/v/@airswap/indexer-registry)](https://www.npmjs.com/package/@airswap/indexer-registry) | Indexer Discovery |
| [`@airswap/staking`](/source/staking) | [![npm](https://img.shields.io/npm/v/@airswap/staking)](https://www.npmjs.com/package/@airswap/staking) | Staking for Participants |
| [`@airswap/pool`](/source/pool) | [![npm](https://img.shields.io/npm/v/@airswap/pool)](https://www.npmjs.com/package/@airswap/pool) | Rewards Pool for Participants |
Expand All @@ -45,6 +45,49 @@
| `yarn lint:fix` | Run eslint for all JavaScript code. |
| `yarn pretty:fix` | Run prettier for all JavaScript code. |

## Branching

Flow for contracts and associated tools:
Branch from Develop; Merge Feature → Develop → Beta → Main

Flow for tool updates (not contracts):
Branch from Main; Merge Feature → Main → Develop

## Versioning

- Major versions include breaking changes.
- Minor versions do not include breaking changes and may include additional functionality.
- Dependencies on fellow @airswap packages should use caret semver.

## Process

**Regular development process for a complete release**

1. New work and features are cut from and merged to "develop"

1. Cut feature branches from develop
2. Merge feature branches into develop (Squash and Merge)

2. Merge "develop" into "beta" to publish beta packages. (Semver: x.x.x-beta.x)

1. Merge develop into beta (Merge Commit): this will publish NPM with "beta" tag.
2. Tag beta release from beta branch. (x.x.x-beta.x)
3. Share tagged release with auditors if auditing.

3. Merge "develop" into "main" to publish latest packages. (Semver: x.x.x)

1. Merge develop into main (Merge Commit): this will publish NPM with "latest" tag.
2. Merge main into beta: this will update the beta with latest.
3. Tag release from main branch. (x.x.x)

Each `deploys.js` must be limited to contracts deployed from that package version.

**Individual package features or patches**

1. Cut a feature or fix branch from main.
2. Merge fix into main (Squash and Merge): this will publish to NPM with "latest" tag.
3. Merge main into develop.

## Deploying and Verifying

Each package has commands `yarn deploy` and `yarn verify`. Each command takes a `--network` flag. For example:
Expand Down
56 changes: 40 additions & 16 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,77 @@ require('@nomiclabs/hardhat-waffle')
require('@nomiclabs/hardhat-etherscan')
require('solidity-coverage')

const { ChainIds, apiUrls, explorerUrls } = require('@airswap/constants')

/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
networks: {
goerli: {
url: 'https://goerli.infura.io/v3/' + process.env.INFURA_API_KEY,
url: apiUrls[ChainIds.GOERLI] + process.env.INFURA_API_KEY,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
mainnet: {
url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_API_KEY,
url: apiUrls[ChainIds.MAINNET] + process.env.INFURA_API_KEY,
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
bsctestnet: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
url: apiUrls[ChainIds.BSCTESTNET],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
bsc: {
url: 'https://bsc-dataseed.binance.org/',
url: apiUrls[ChainIds.BSC],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
fuji: {
url: 'https://api.avax-test.network/ext/bc/C/rpc',
url: apiUrls[ChainIds.FUJI],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
avalanche: {
url: 'https://api.avax.network/ext/bc/C/rpc',
url: apiUrls[ChainIds.AVALANCHE],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
mumbai: {
url: 'https://rpc-mumbai.maticvigil.com',
url: apiUrls[ChainIds.MUMBAI],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
polygon: {
url: 'https://polygon-rpc.com/',
url: apiUrls[ChainIds.POLYGON],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
arbitrum: {
url: 'https://arb1.arbitrum.io/rpc',
url: apiUrls[ChainIds.ARBITRUM],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
arbitrumgoerli: {
url: 'https://goerli-rollup.arbitrum.io/rpc',
url: apiUrls[ChainIds.ARBITRUMGOERLI],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
rsk: {
url: 'https://public-node.rsk.co',
url: apiUrls[ChainIds.RSK],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
rsktestnet: {
url: 'https://public-node.testnet.rsk.co/',
url: apiUrls[ChainIds.RSKTESTNET],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
linea: {
url: apiUrls[ChainIds.LINEA],
accounts: process.env.PRIVATE_KEY ? [process.env.PRIVATE_KEY] : undefined,
},
},
solidity: {
compilers: [
{
version: '0.5.16',
settings: {
optimizer: {
enabled: true,
runs: 999999,
},
},
},
{
version: '0.8.17',
settings: {
Expand All @@ -85,22 +100,31 @@ module.exports = {
avalancheFujiTestnet: process.env.SNOWTRACE_API_KEY,
polygonMumbai: process.env.POLYGONSCAN_API_KEY,
rsk: process.env.BLOCKSCOUT_API_KEY,
linea: process.env.BLOCKSCOUT_API_KEY,
},
customChains: [
{
network: 'rsk',
chainId: 30,
urls: {
apiURL: 'https://blockscout.com/rsk/mainnet/api',
browserURL: 'https://blockscout.com/rsk/mainnet',
apiURL: apiUrls[ChainIds.RSK],
browserURL: explorerUrls[ChainIds.RSK],
},
},
{
network: 'linea',
chainId: 59140,
urls: {
apiURL: apiUrls[ChainIds.LINEA],
browserURL: explorerUrls[ChainIds.LINEA],
},
},
{
network: 'arbitrumGoerli',
chainId: 421613,
urls: {
apiURL: 'https://api-goerli.arbiscan.io/api',
browserURL: 'https://goerli.arbiscan.io',
apiURL: apiUrls[ChainIds.ARBITRUMGOERLI],
browserURL: explorerUrls[ChainIds.ARBITRUMGOERLI],
},
},
],
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"compile": "lerna run compile",
"lint:check": "yarn eslint . --ext .js,.ts",
"lint:fix": "yarn eslint . --ext .js,.ts --fix",
"test": "yarn compile && lerna run test:unit",
"test": "lerna run test:unit",
"prepare": "husky install",
"pretty:check": "prettier --check \"./**/*.sol\" \"./**/*.ts\" \"./**/*.js\"",
"pretty:fix": "prettier --write \"./**/*.sol\" \"./**/*.ts\" \"./**/*.js\""
Expand All @@ -28,8 +28,10 @@
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.5",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.45.1",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"chai": "^4.3.6",
"dotenv": "^16.0.1",
"eslint": "^8.20.0",
Expand All @@ -39,18 +41,17 @@
"ethers": "^5.6.9",
"hardhat": "^2.12.7",
"husky": "^8.0.1",
"lerna": "^5.2.0",
"nx": "^14.4.3",
"lerna": "^6.6.1",
"mocha": "^10.2.0",
"nx": "^15.9.2",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.1.2",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^4.8.4"
"typescript": "^5.0.4"
},
"engines": {
"node": ">=14"
},
"volta": {
"node": "16.15.1"
"node": ">= 14"
}
}
35 changes: 35 additions & 0 deletions source/balances/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# BalanceChecker

[AirSwap](https://www.airswap.io/) is a peer-to-peer trading network for Ethereum tokens. This package contains source code and tests for a basic ERC20 balance and allowance aggregator.

[![Discord](https://img.shields.io/discord/590643190281928738.svg)](https://discord.gg/ecQbV7H)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![Twitter Follow](https://img.shields.io/twitter/follow/airswap?style=social)

## Resources

- Docs → https://docs.airswap.io/
- Website → https://www.airswap.io/
- Blog → https://blog.airswap.io/
- Support → https://support.airswap.io/

## Usage

:warning: This package is under active development. The [BalanceChecker](./contracts/BalanceChecker.sol) contract is deployed; see [deploys.js](./deploys.js) for latest. For all AirSwap contract deployments see [Deployed Contracts](https://docs.airswap.io/system/contract-deployments).

## Commands

| Command | Description |
| :------------- | :-------------------------------------- |
| `yarn` | Install dependencies |
| `yarn clean` | Delete the contract `build` folder |
| `yarn compile` | Compile all contracts to `build` folder |
| `yarn test` | Run all contract tests in `test` folder |

## Running Tests

:bulb: Prior to testing locally, run `yarn compile` in the `airswap-protocols` project root to build required artifacts. Then run an instance of `ganache-cli` before running `yarn test` in another shell from the root repository.

```
yarn ganache
```
Loading

0 comments on commit f8e781f

Please sign in to comment.