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

Soldeer Packaging #222

Merged
merged 35 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9d76410
Merge pull request #218 from Axis-Fi/develop
Oighty Jul 11, 2024
9bb4bed
Add forge-std 1.9.1 as a dependency using soldeer. Updated from 1.7.1…
0xJem Jul 12, 2024
73546ba
Remove unused prb-math dependency
0xJem Jul 12, 2024
a1b7d3f
Shift to solmate 6.7.0 from soldeer. Adds ERC6909 contract not includ…
0xJem Jul 12, 2024
27fc801
Remove solmate from installation script
0xJem Jul 12, 2024
243461c
Shift to using solady 0.0.124 package in soldeer (same version).
0xJem Jul 12, 2024
e3cf82c
Shift to openzeppelin 4.9.2 package in soldeer (includes the upgradea…
0xJem Jul 12, 2024
8d7a0b5
Remove openzeppelin from install script
0xJem Jul 12, 2024
332252d
Shift to uniswap-v2-core 1.0.1 package in soldeer (same version)
0xJem Jul 12, 2024
e74a7bb
Install soldeer dependencies in install script
0xJem Jul 12, 2024
b2e1a6f
fix: use implicit imports on interfaces
Oighty Jul 12, 2024
4f2be43
fix: don't inherit 6909 docs for LIV
Oighty Jul 12, 2024
191384e
chore: remove unused import
Oighty Jul 12, 2024
e5b7b18
test: update salts
Oighty Jul 12, 2024
76e4b84
Merge pull request #223 from Axis-Fi/implicit-imports
Oighty Jul 12, 2024
bdff393
chore: linting
0xJem Jul 12, 2024
d80f2b2
Update salts
0xJem Jul 12, 2024
14a5d4a
Install uniswap-v3 core 1.0.1 (same version) from soldeer. Removed re…
0xJem Jul 15, 2024
8edc2e8
Update salts
0xJem Jul 15, 2024
a02557a
chore: linting
0xJem Jul 15, 2024
72e003a
Update salts
0xJem Jul 15, 2024
cde033c
Merge branch 'master' into soldeer
0xJem Jul 15, 2024
8cc3540
Update salts
0xJem Jul 15, 2024
baf4a2f
Simplify first-run scripts and CI build
0xJem Jul 15, 2024
4c024a4
Document use of soldeer
0xJem Jul 15, 2024
63d8635
Document minimum version of soldeer
0xJem Jul 15, 2024
610ee34
Pin solmate to git commit in order to include ERC6909.
0xJem Jul 15, 2024
7171cfc
Bring LinearVesting under the size limit
0xJem Jul 15, 2024
43c46cd
WIP publish script
0xJem Jul 15, 2024
05034c5
Finalise publish script
0xJem Jul 15, 2024
30732b7
Add changelog
0xJem Jul 15, 2024
c7c46a3
Remove redundant MockERC6909
0xJem Jul 15, 2024
948a293
Shift to soldeer-provided clones-with-immutable-args
0xJem Jul 16, 2024
e553691
Adjust version of clones-with-immutable-args to be the same commit as…
0xJem Jul 16, 2024
46102ff
chore: change license in package.json to match
Oighty Jul 17, 2024
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
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
3 changes: 2 additions & 1 deletion 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 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
4 changes: 2 additions & 2 deletions script/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pragma solidity 0.8.19;

// Scripting libraries
import {Script, console2} from "forge-std/Script.sol";
import {stdJson} from "forge-std/StdJson.sol";
import {Script, console2} from "@forge-std-1.9.1/Script.sol";
import {stdJson} from "@forge-std-1.9.1/StdJson.sol";
import {WithEnvironment} from "script/deploy/WithEnvironment.s.sol";
import {WithSalts} from "script/salts/WithSalts.s.sol";

Expand Down
Loading
Loading