feat: Extend Swap to hold user_data: Option<Bytes>
Took 25 minutes
This commit is contained in:
@@ -42,6 +42,7 @@ fn main() {
|
||||
// Split defines the fraction of the amount to be swapped. A value of 0 indicates 100% of
|
||||
// the amount or the total remaining balance.
|
||||
split: 0f64,
|
||||
user_data: None,
|
||||
};
|
||||
|
||||
// Then we create a solution object with the previous swap
|
||||
@@ -94,6 +95,7 @@ fn main() {
|
||||
token_in: weth.clone(),
|
||||
token_out: dai.clone(),
|
||||
split: 0.5f64,
|
||||
user_data: None,
|
||||
};
|
||||
let swap_weth_wbtc = Swap {
|
||||
component: ProtocolComponent {
|
||||
@@ -106,6 +108,7 @@ fn main() {
|
||||
// This represents the remaining 50%, but to avoid any rounding errors we set this to
|
||||
// 0 to signify "the remainder of the WETH value". It should still be very close to 50%
|
||||
split: 0f64,
|
||||
user_data: None,
|
||||
};
|
||||
let swap_dai_usdc = Swap {
|
||||
component: ProtocolComponent {
|
||||
@@ -116,6 +119,7 @@ fn main() {
|
||||
token_in: dai.clone(),
|
||||
token_out: usdc.clone(),
|
||||
split: 0f64,
|
||||
user_data: None,
|
||||
};
|
||||
let swap_wbtc_usdc = Swap {
|
||||
component: ProtocolComponent {
|
||||
@@ -126,6 +130,7 @@ fn main() {
|
||||
token_in: wbtc.clone(),
|
||||
token_out: usdc.clone(),
|
||||
split: 0f64,
|
||||
user_data: None,
|
||||
};
|
||||
let mut complex_solution = solution.clone();
|
||||
complex_solution.swaps = vec![swap_weth_dai, swap_weth_wbtc, swap_dai_usdc, swap_wbtc_usdc];
|
||||
|
||||
Reference in New Issue
Block a user