Skip to content

Commit c22cad5

Browse files
authored
Merge pull request #10 from xdecentralix/merge/upstream-main-2025-08-18
Merge/upstream main 2025 08 18
2 parents 8961878 + 925cd02 commit c22cad5

File tree

66 files changed

+1360
-524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1360
-524
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/autopilot/src/infra/blockchain/contracts.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use {crate::domain, chain::Chain, ethcontract::dyns::DynWeb3, primitive_types::H
33
#[derive(Debug, Clone)]
44
pub struct Contracts {
55
settlement: contracts::GPv2Settlement,
6+
signatures: contracts::support::Signatures,
67
weth: contracts::WETH9,
8+
balances: contracts::support::Balances,
79
chainalysis_oracle: Option<contracts::ChainalysisOracle>,
810
trampoline: contracts::HooksTrampoline,
911

@@ -17,7 +19,9 @@ pub struct Contracts {
1719
#[derive(Debug, Clone)]
1820
pub struct Addresses {
1921
pub settlement: Option<H160>,
22+
pub signatures: Option<H160>,
2023
pub weth: Option<H160>,
24+
pub balances: Option<H160>,
2125
pub trampoline: Option<H160>,
2226
}
2327

@@ -37,11 +41,27 @@ impl Contracts {
3741
),
3842
);
3943

44+
let signatures = contracts::support::Signatures::at(
45+
web3,
46+
address_for(
47+
contracts::support::Signatures::raw_contract(),
48+
addresses.signatures,
49+
),
50+
);
51+
4052
let weth = contracts::WETH9::at(
4153
web3,
4254
address_for(contracts::WETH9::raw_contract(), addresses.weth),
4355
);
4456

57+
let balances = contracts::support::Balances::at(
58+
web3,
59+
address_for(
60+
contracts::support::Balances::raw_contract(),
61+
addresses.balances,
62+
),
63+
);
64+
4565
let trampoline = contracts::HooksTrampoline::at(
4666
web3,
4767
address_for(
@@ -72,7 +92,9 @@ impl Contracts {
7292

7393
Self {
7494
settlement,
95+
signatures,
7596
weth,
97+
balances,
7698
chainalysis_oracle,
7799
settlement_domain_separator,
78100
authenticator,
@@ -84,6 +106,14 @@ impl Contracts {
84106
&self.settlement
85107
}
86108

109+
pub fn balances(&self) -> &contracts::support::Balances {
110+
&self.balances
111+
}
112+
113+
pub fn signatures(&self) -> &contracts::support::Signatures {
114+
&self.signatures
115+
}
116+
87117
pub fn trampoline(&self) -> &contracts::HooksTrampoline {
88118
&self.trampoline
89119
}

crates/autopilot/src/run.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ pub async fn run(args: Arguments) {
194194
let url = ethrpc.url().clone();
195195
let contracts = infra::blockchain::contracts::Addresses {
196196
settlement: args.shared.settlement_contract_address,
197+
signatures: args.shared.signatures_contract_address,
197198
weth: args.shared.native_token_address,
199+
balances: args.shared.balances_contract_address,
198200
trampoline: args.shared.hooks_contract_address,
199201
};
200202
let eth = ethereum(
@@ -244,15 +246,17 @@ pub async fn run(args: Arguments) {
244246
let signature_validator = signature_validator::validator(
245247
&web3,
246248
signature_validator::Contracts {
247-
settlement: eth.contracts().settlement().address(),
249+
settlement: eth.contracts().settlement().clone(),
250+
signatures: eth.contracts().signatures().clone(),
248251
vault_relayer,
249252
},
250253
);
251254

252255
let balance_fetcher = account_balances::cached(
253256
&web3,
254257
account_balances::Contracts {
255-
settlement: eth.contracts().settlement().address(),
258+
settlement: eth.contracts().settlement().clone(),
259+
balances: eth.contracts().balances().clone(),
256260
vault_relayer,
257261
vault: vault.as_ref().map(|contract| contract.address()),
258262
},

crates/chain/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub enum Chain {
2323
Avalanche = 43114,
2424
Optimism = 10,
2525
Polygon = 137,
26+
Lens = 232,
2627
}
2728

2829
impl Chain {
@@ -47,6 +48,7 @@ impl Chain {
4748
Self::Avalanche => "Avalanche",
4849
Self::Optimism => "Optimism",
4950
Self::Polygon => "Polygon",
51+
Self::Lens => "Lens",
5052
}
5153
}
5254

@@ -60,7 +62,7 @@ impl Chain {
6062
| Self::Base
6163
| Self::Bnb
6264
| Self::Optimism => 10u128.pow(17).into(),
63-
Self::Gnosis | Self::Avalanche => 10u128.pow(18).into(),
65+
Self::Gnosis | Self::Avalanche | Self::Lens => 10u128.pow(18).into(),
6466
Self::Polygon => 10u128.pow(20).into(),
6567
Self::Hardhat => {
6668
panic!("unsupported chain for default amount to estimate native prices with")
@@ -82,6 +84,7 @@ impl Chain {
8284
Self::Avalanche => Duration::from_millis(2_000),
8385
Self::Optimism => Duration::from_millis(2_000),
8486
Self::Polygon => Duration::from_millis(2_000),
87+
Self::Lens => Duration::from_millis(2_000),
8588
}
8689
}
8790

@@ -110,6 +113,7 @@ impl TryFrom<u64> for Chain {
110113
x if x == Self::Avalanche as u64 => Self::Avalanche,
111114
x if x == Self::Optimism as u64 => Self::Optimism,
112115
x if x == Self::Polygon as u64 => Self::Polygon,
116+
x if x == Self::Lens as u64 => Self::Lens,
113117
_ => Err(ChainIdNotSupported)?,
114118
};
115119
Ok(network)

crates/contracts/artifacts/Balances.json

Lines changed: 99 additions & 1 deletion
Large diffs are not rendered by default.

crates/contracts/artifacts/Signatures.json

Lines changed: 80 additions & 1 deletion
Large diffs are not rendered by default.

crates/contracts/artifacts/UniswapV3SwapRouter.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"abi":[{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"}]}

0 commit comments

Comments
 (0)