Skip to content

Commit

Permalink
Merge pull request #222 from Axis-Fi/soldeer
Browse files Browse the repository at this point in the history
Soldeer Packaging
  • Loading branch information
Oighty authored Jul 17, 2024
2 parents 9d7ebd5 + 46102ff commit e19ca19
Show file tree
Hide file tree
Showing 134 changed files with 439 additions and 815 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
version: 9

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -48,24 +48,25 @@ jobs:
- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Build local ecies-cli for use with testing
run: cd crates/ecies-cli && cargo build && cd ../..

- name: Repo Install Script
- name: Install Dependencies
run: |
chmod +x ./install.sh
./install.sh
pnpm install
shell: bash

- name: Run lint check
run: pnpm run lint:check

- name: Run Forge build
- name: Build Solidity Contracts
run: |
forge --version
forge build
id: build

- name: Build ECIES CLI
run: |
pnpm run build:ecies-cli
id: build-ecies-cli

- name: Run Forge tests
run: |
pnpm run test
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ node_modules/

# Bytecode
bytecode/

# soldeer
dependencies/
27 changes: 0 additions & 27 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,27 +0,0 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/prb-math"]
path = lib/prb-math
url = https://github.com/PaulRBerg/prb-math
[submodule "lib/uniswap-v3-periphery"]
path = lib/uniswap-v3-periphery
url = https://github.com/uniswap/v3-periphery
[submodule "lib/uniswap-v3-core"]
path = lib/uniswap-v3-core
url = https://github.com/uniswap/v3-core
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/openzeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/uniswap-v2-core"]
path = lib/uniswap-v2-core
url = https://github.com/uniswap/v2-core
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog

## 0.5.1

- Migrates all dependencies over to soldeer packages and away from git submodules (#222)
- Removes redundant dependencies (prb-math, uniswap-v3-periphery) (#222)
- Packages the repository as a soldeer package (#222)
- Use implicit imports in interfaces (#223)
- Improvements to constant and deployment addresses (#220)

## 0.5.0

- Adds SVG for derivative tokens deployed using the LinearVesting module (#210)
- Define the referrer fee on a per-auction basis (#216)
- Standardise percentages on 2 basis points (100% = 100e2)
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Axis is built in Solidity using Foundry as the development and test environment.
### First-Run

```shell
pnpm run full-install
pnpm install
```

### Build
Expand Down Expand Up @@ -96,4 +96,20 @@ Scripts are written in Solidity using Foundry and are divided into `deploy`, `sa

### Deployments

Deployments are listed in the [Axis documentation](https://docs.axis.finance/references/03-technical/).
Deployments are listed in the [env.json file](/script/env.json) and periodically updated in the [Axis documentation](https://axis.finance/developer/reference/contract-addresses).

### Dependencies

[soldeer](https://soldeer.xyz/) is used as the dependency manager, as it solves many of the problems inherent in forge's use of git submodules. Soldeer is integrated into `forge`, so should not require any additional installations.

### Packaging

To publish a new package version to soldeer, run the following:

```shell
pnpm run publish <version>
```

On first run, this requires authentication with soldeer: `soldeer login`

The [CHANGELOG](CHANGELOG.md) file should also be updated.
10 changes: 10 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ ignore = [
]

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

[dependencies]
forge-std = { version = "1.9.1" }
solmate = { version = "6.7.0", url = "[email protected]:transmissions11/solmate.git", commit = "c892309933b25c03d32b1b0d674df7ae292ba925" }
solady = { version = "0.0.124" }
"@openzeppelin-contracts" = { version = "4.9.2" }
"@openzeppelin-contracts-upgradeable" = { version = "4.9.2" }
"@uniswap-v2-core" = { version = "1.0.1" }
"@uniswap-v3-core" = { version = "1.0.1-solc-0.8-simulate" }
clones-with-immutable-args = { version = "1.1.1", git = "[email protected]:wighawag/clones-with-immutable-args.git", rev = "f5ca191afea933d50a36d101009b5644dc28bc99" }
56 changes: 0 additions & 56 deletions install.sh

This file was deleted.

1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from f73c73
6 changes: 3 additions & 3 deletions lib/g-uni-v1-core/contracts/GUniFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.19;

import {
IUniswapV3Factory
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/IUniswapV3Factory.sol";
import {IUniswapV3TickSpacing} from "./interfaces/IUniswapV3TickSpacing.sol";
import {IGUniFactory} from "./interfaces/IGUniFactory.sol";
import {IGUniPoolStorage} from "./interfaces/IGUniPoolStorage.sol";
Expand All @@ -12,10 +12,10 @@ import {EIP173Proxy} from "./vendor/proxy/EIP173Proxy.sol";
import {IEIP173Proxy} from "./interfaces/IEIP173Proxy.sol";
import {
IERC20Metadata
} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
} from "@openzeppelin-contracts-4.9.2/token/ERC20/extensions/IERC20Metadata.sol";
import {
EnumerableSet
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
} from "@openzeppelin-contracts-4.9.2/utils/structs/EnumerableSet.sol";

contract GUniFactory is GUniFactoryStorage, IGUniFactory {
using EnumerableSet for EnumerableSet.AddressSet;
Expand Down
10 changes: 5 additions & 5 deletions lib/g-uni-v1-core/contracts/GUniPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ pragma solidity 0.8.19;

import {
IUniswapV3MintCallback
} from "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/callback/IUniswapV3MintCallback.sol";
import {
IUniswapV3SwapCallback
} from "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/callback/IUniswapV3SwapCallback.sol";
import {GUniPoolStorage} from "./abstract/GUniPoolStorage.sol";
import {
IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/IUniswapV3Pool.sol";
import {TickMath} from "./vendor/uniswap/TickMath.sol";
import {
IERC20,
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
} from "@openzeppelin-contracts-4.9.2/token/ERC20/utils/SafeERC20.sol";
import {SafeCast} from "@openzeppelin-contracts-4.9.2/utils/math/SafeCast.sol";
import {
FullMath,
LiquidityAmounts
Expand Down
2 changes: 1 addition & 1 deletion lib/g-uni-v1-core/contracts/__mocks__/MockERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.19;

import {
ERC20Upgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
} from "@openzeppelin-contracts-upgradeable-4.9.2/token/ERC20/ERC20Upgradeable.sol";

contract MockERC20 is ERC20Upgradeable {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions lib/g-uni-v1-core/contracts/__mocks__/SwapTest.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.19;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20} from "@openzeppelin-contracts-4.9.2/token/ERC20/IERC20.sol";
import {
IUniswapV3SwapCallback
} from "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/callback/IUniswapV3SwapCallback.sol";
import {
IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/IUniswapV3Pool.sol";

contract SwapTest is IUniswapV3SwapCallback {
function swap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "contracts/lib/Initializable.sol";
import {
EnumerableSet
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
} from "@openzeppelin-contracts-4.9.2/utils/structs/EnumerableSet.sol";

// solhint-disable-next-line max-states-count
contract GUniFactoryStorage is
Expand Down
8 changes: 4 additions & 4 deletions lib/g-uni-v1-core/contracts/abstract/GUniPoolStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {Gelatofied} from "./Gelatofied.sol";
import {OwnableUninitialized} from "./OwnableUninitialized.sol";
import {
IUniswapV3Pool
} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
} from "@uniswap-v3-core-1.0.1-solc-0.8-simulate/interfaces/IUniswapV3Pool.sol";
import {IERC20} from "@openzeppelin-contracts-4.9.2/token/ERC20/IERC20.sol";
import {
ReentrancyGuardUpgradeable
} from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
} from "@openzeppelin-contracts-upgradeable-4.9.2/security/ReentrancyGuardUpgradeable.sol";
import {
ERC20Upgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
} from "@openzeppelin-contracts-upgradeable-4.9.2/token/ERC20/ERC20Upgradeable.sol";

/// @dev Single Global upgradeable state var storage base: APPEND ONLY
/// @dev Add all inherited contracts with state vars here: APPEND ONLY
Expand Down
4 changes: 2 additions & 2 deletions lib/g-uni-v1-core/contracts/abstract/Gelatofied.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.19;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Address} from "@openzeppelin-contracts-4.9.2/utils/Address.sol";
import {
IERC20,
SafeERC20
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
} from "@openzeppelin-contracts-4.9.2/token/ERC20/utils/SafeERC20.sol";

/// @dev DO NOT ADD STATE VARIABLES - APPEND THEM TO GelatoUniV3PoolStorage
/// @dev DO NOT ADD BASE CONTRACTS WITH STATE VARS - APPEND THEM TO GelatoUniV3PoolStorage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity >=0.5.0;

import {FullMath} from "./FullMath.sol";
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
import "@uniswap-v3-core-1.0.1-solc-0.8-simulate/libraries/FixedPoint96.sol";

/// @title Liquidity amount functions
/// @notice Provides functions for computing liquidity amounts from token amounts and prices
Expand Down
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from d6b63a
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from dda497
1 change: 0 additions & 1 deletion lib/prb-math
Submodule prb-math deleted from 9dc065
1 change: 0 additions & 1 deletion lib/solady
Submodule solady deleted from 2ba1cc
1 change: 0 additions & 1 deletion lib/solmate
Submodule solmate deleted from c89230
1 change: 0 additions & 1 deletion lib/uniswap-v2-core
Submodule uniswap-v2-core deleted from 4dd590
2 changes: 1 addition & 1 deletion lib/uniswap-v2-periphery/contracts/UniswapV2Router02.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity >=0.6.6;

import "uniswap-v2-core/interfaces/IUniswapV2Factory.sol";
import "@uniswap-v2-core-1.0.1/interfaces/IUniswapV2Factory.sol";
import './libraries/TransferHelper.sol';

import './interfaces/IUniswapV2Router02.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity >=0.5.0;

import {IUniswapV2Pair} from "uniswap-v2-core/interfaces/IUniswapV2Pair.sol";
import {IUniswapV2Pair} from "@uniswap-v2-core-1.0.1/interfaces/IUniswapV2Pair.sol";
import "./SafeMath.sol";

library UniswapV2Library {
Expand Down
1 change: 0 additions & 1 deletion lib/uniswap-v3-core
Submodule uniswap-v3-core deleted from 6562c5
1 change: 0 additions & 1 deletion lib/uniswap-v3-periphery
Submodule uniswap-v3-periphery deleted from b325bb
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
"deploy": "./script/deploy/deploy.sh",
"fmt:check": "forge fmt --check",
"fmt": "forge fmt",
"full-install": "./install.sh",
"lint:all": "pnpm run fmt && pnpm run solhint:all",
"lint:check": "pnpm run fmt:check && pnpm run solhint:check",
"lint": "pnpm run fmt && pnpm run solhint",
"postinstall": "./script/install.sh",
"publish": "./script/publish.sh",
"salts": "./script/salts/write_salt.sh",
"size": "forge clean && forge build --sizes --skip test --skip '*/Mock*.sol'",
"solhint:all": "solhint --fix --config ./.solhint.json 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'",
Expand All @@ -26,7 +27,7 @@
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "BSL-1.1",
"dependencies": {
"solhint-community": "^3.7.0"
}
Expand Down
18 changes: 8 additions & 10 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
solady/=lib/solady/src/
solmate/=lib/solmate/src/
uniswap-v2-core/=lib/uniswap-v2-core/contracts/
uniswap-v3-core/=lib/uniswap-v3-core/contracts/
uniswap-v3-periphery/=lib/uniswap-v3-periphery/contracts/
@uniswap/v3-core/=lib/uniswap-v3-core/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
g-uni-v1-core/=lib/g-uni-v1-core/contracts/
@forge-std-1.9.1=dependencies/forge-std-1.9.1/src
@solmate-6.7.0=dependencies/solmate-6.7.0/src
@solady-0.0.124=dependencies/solady-0.0.124/src
@openzeppelin-contracts-4.9.2=dependencies/@openzeppelin-contracts-4.9.2
@openzeppelin-contracts-upgradeable-4.9.2=dependencies/@openzeppelin-contracts-upgradeable-4.9.2
@uniswap-v2-core-1.0.1=dependencies/@uniswap-v2-core-1.0.1/contracts
@uniswap-v3-core-1.0.1-solc-0.8-simulate=dependencies/@uniswap-v3-core-1.0.1-solc-0.8-simulate/contracts
@clones-with-immutable-args-1.1.1=dependencies/clones-with-immutable-args-1.1.1/src
Loading

0 comments on commit e19ca19

Please sign in to comment.