Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
5027a1d
wip: poc for ARM router
clement-ux Oct 31, 2025
4e55b29
feat: add swapExactETHForTokens function and WETH initialization
clement-ux Oct 31, 2025
9949660
feat: add swapExactTokensForTokensSimple function for simplified toke…
clement-ux Oct 31, 2025
89fade6
wip
clement-ux Oct 31, 2025
6754a15
clean up
clement-ux Oct 31, 2025
7d3c57d
add first tests
clement-ux Oct 31, 2025
af06875
add Router to gas report
clement-ux Oct 31, 2025
f559162
improve global logic
clement-ux Nov 2, 2025
2bfec2b
Add swap functionality and tests for ARMRouter
clement-ux Nov 2, 2025
5764008
add ETH swaps
clement-ux Nov 3, 2025
6422dae
update .gitignore and Makefile to include snapshots in clean targets;…
clement-ux Nov 3, 2025
81d3f82
reduce error message length
clement-ux Nov 3, 2025
baeb1c9
Add fork test for Router
clement-ux Nov 3, 2025
6d5a812
fmt
clement-ux Nov 3, 2025
8aec020
Add return values for swap functions in AbstractARM contract
clement-ux Nov 3, 2025
944c414
Add UpgradeEtherFiARMScript and update DeployManager to include it
clement-ux Nov 3, 2025
2c88e22
try to fix
clement-ux Nov 3, 2025
7374240
Increase verbosity of non-invariant tests output in CI workflow
clement-ux Nov 3, 2025
a182d00
try again
clement-ux Nov 3, 2025
bf6bbe5
Reduce verbosity of non-invariant tests output in CI workflow
clement-ux Nov 3, 2025
3b8121e
improve CIs
clement-ux Nov 3, 2025
4204daf
pause some tests
clement-ux Nov 3, 2025
eb35cdb
Add test targets for unit, fork, and smoke tests command
clement-ux Nov 3, 2025
34b311b
Add return values to swap functions in AbstractARM contract documenta…
clement-ux Nov 3, 2025
443f722
Disable gas snapshot check in foundry.toml
clement-ux Nov 3, 2025
e2268c7
Fix rounding error in amountIn calculation by adding 1 after decoding
clement-ux Nov 3, 2025
0bdc135
Rename swap functions for clarity and update parameters in Router tests
clement-ux Nov 3, 2025
6d3cdf2
Merge remote-tracking branch 'origin/main' into clement/add-returns
naddison36 Nov 4, 2025
ae5cc7c
Add return amounts to swap interfaces with no path
naddison36 Nov 4, 2025
b05ad6b
Merge branch 'main' into clement/router
clement-ux Nov 4, 2025
842646f
Merge branch 'clement/add-returns' into clement/router
clement-ux Nov 4, 2025
f911ce3
Refactor swapExactTokensForTokens call in ARMRouter and update test s…
clement-ux Nov 4, 2025
34df4dd
Remove unused imports from Shared.sol and SwapExactTokensForTokens.t.sol
clement-ux Nov 4, 2025
4abe94f
fmt
clement-ux Nov 4, 2025
ce5b2d8
Add tests for swapExactTokensForTokens reverts in ARMRouter
clement-ux Nov 4, 2025
585f131
Update error message for missing ARM configuration in ARMRouter
clement-ux Nov 4, 2025
5702451
Remove unnecessary approval for tokenB in ARMRouter
clement-ux Nov 4, 2025
fe5e0fc
Add more fork test for ARMRouter
clement-ux Nov 4, 2025
2122204
Optimize swap logic by caching next token index to reduce gas costs i…
clement-ux Nov 5, 2025
767e3d6
Optimize gas usage by caching length minus two in swap function of AR…
clement-ux Nov 5, 2025
241fa58
Optimize gas usage in _swapsForExactTokens by caching path length and…
clement-ux Nov 5, 2025
ccb8ae5
Optimize gas usage in _getAmountsIn and swap loop by caching path len…
clement-ux Nov 5, 2025
0cd5e4d
Optimize gas usage in swap function by caching last index of path and…
clement-ux Nov 5, 2025
c39d263
Optimize gas usage in swap function by caching the first amount for i…
clement-ux Nov 5, 2025
5cf186e
Optimize gas usage in swap functions by caching amounts and path lengths
clement-ux Nov 5, 2025
d2ac0c5
Optimize gas usage in swap function by caching path length and token …
clement-ux Nov 5, 2025
16697e1
Optimize gas usage in swap functions by caching last index calculatio…
clement-ux Nov 5, 2025
87b15f7
Get gas consumption for functions call on tests.
clement-ux Nov 5, 2025
231c581
Merge branch 'main' into clement/router
clement-ux Nov 5, 2025
1c955e9
Merge swap functions in a single test file
clement-ux Nov 7, 2025
33d3fce
Update optimizer runs and add solady dependency in foundry.toml
clement-ux Nov 7, 2025
64e32c0
use `get`, `set` and `malloc` assembly to reduce gas.
clement-ux Nov 7, 2025
6791a44
replace some small math calcul by assembly
clement-ux Nov 7, 2025
3e1d8f3
Refactor ARMRouter contract: reorder imports, add ownership modifier …
clement-ux Nov 7, 2025
dd49ab9
Add balance checks to swap tests for accurate token accounting
clement-ux Nov 7, 2025
5aebeef
Remove commented assertion for liquidity provider cap in initial conf…
clement-ux Nov 7, 2025
73c3417
Add DeployRouterScript for ARM Router deployment
clement-ux Nov 10, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ artifacts

# Forge
.gas-snapshot
snapshots/
dependencies/
soldeer.lock

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ install:
yarn install

clean:
@rm -rf broadcast cache out
@rm -rf broadcast cache out snapshots

clean-all:
@rm -rf broadcast cache out dependencies node_modules soldeer.lock yarn.lock lcov.info lcov.info.pruned artifacts cache_hardhat
Expand Down
7 changes: 5 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ verbosity = 3
sender = "0x0165C55EF814dEFdd658532A48Bd17B2c8356322"
tx_origin = "0x0165C55EF814dEFdd658532A48Bd17B2c8356322"
auto_detect_remappings = false
gas_reports = ["OethARM", "Proxy", "LidoARM", "OriginARM"]
gas_reports = ["OethARM", "Proxy", "LidoARM", "OriginARM", "ARMRouter"]
fs_permissions = [{ access = "read-write", path = "./build" }]
extra_output_files = ["metadata"]
ignored_warnings_from = ["src/contracts/Proxy.sol"]
optimizer = true
optimizer_runs = 200
optimizer_runs = 50000
ffi = true
gas_snapshot_check = false

# About remappings:
# - @pendle-sy use a different version of oz contracts than the one used in the rest of the project.
Expand All @@ -26,6 +27,7 @@ remappings = [
"test/=./test",
"utils/=./src/contracts/utils",
# Manage dependencies remappings
"@solady/=dependencies/solady-1.0.0/src/",
"@solmate/=dependencies/solmate-6.7.0/src/",
"forge-std/=dependencies/forge-std-1.9.7/src/",
"@pendle-sy/=dependencies/@pendle-sy-1.0.0-1.0.0/contracts/",
Expand Down Expand Up @@ -70,6 +72,7 @@ forge-std = "1.9.7"
"@openzeppelin-contracts-5.0.2" = { version = "5.0.2", git = "https://github.com/OpenZeppelin/openzeppelin-contracts.git", rev = "dbb6104ce834628e473d2173bbc9d47f81a9eec3" }
"@openzeppelin-contracts-upgradeable-4.9.3" = { version = "4.9.3", git = "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git", rev = "3d4c0d5741b131c231e558d7a6213392ab3672a5" }
"@openzeppelin-contracts-upgradeable-5.0.2" = { version = "5.0.2", git = "https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable.git", rev = "723f8cab09cdae1aca9ec9cc1cfa040c2d4b06c1" }
solady = { version = "1.0.0", git = "https://github.com/Vectorized/solady.git", rev = "73f13dd1483707ef6b4d16cb0543570b7e1715a8" }

[soldeer]
recursive_deps = false
Expand Down
2 changes: 2 additions & 0 deletions script/deploy/DeployManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {UpgradeOriginARMSetBufferScript} from "./sonic/005_UpgradeOriginARMSetBu
import {UpgradeLidoARMAssetScript} from "./mainnet/010_UpgradeLidoARMAssetScript.sol";
import {DeployEtherFiARMScript} from "./mainnet/011_DeployEtherFiARMScript.sol";
import {UpgradeEtherFiARMScript} from "./mainnet/012_UpgradeEtherFiARMScript.sol";
import {DeployRouterScript} from "./mainnet/013_DeployRouterScript.sol";

contract DeployManager is Script {
using stdJson for string;
Expand Down Expand Up @@ -86,6 +87,7 @@ contract DeployManager is Script {
_runDeployFile(new UpgradeLidoARMAssetScript());
_runDeployFile(new DeployEtherFiARMScript());
_runDeployFile(new UpgradeEtherFiARMScript());
_runDeployFile(new DeployRouterScript());
} else if (block.chainid == 17000) {
// Holesky
_runDeployFile(new DeployCoreHoleskyScript());
Expand Down
32 changes: 32 additions & 0 deletions script/deploy/mainnet/013_DeployRouterScript.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

// Foundry imports
import {console} from "forge-std/console.sol";

// Contract imports
import {ARMRouter} from "contracts/ARMRouter.sol";
import {Mainnet} from "contracts/utils/Addresses.sol";

// Deployment imports
import {GovProposal, GovSixHelper} from "contracts/utils/GovSixHelper.sol";
import {AbstractDeployScript} from "../AbstractDeployScript.sol";

contract DeployRouterScript is AbstractDeployScript {
using GovSixHelper for GovProposal;

GovProposal public govProposal;

string public constant override DEPLOY_NAME = "013_DeployRouterScript";
bool public constant override proposalExecuted = false;

function _execute() internal override {
console.log("Deploy:", DEPLOY_NAME);
console.log("------------");

// 1. Deploy ARM Router
_recordDeploy("ARM_ROUTER", address(new ARMRouter(Mainnet.WETH)));

console.log("Finished deploying", DEPLOY_NAME);
}
}
Loading
Loading