chore: Make objects public

Remove dead_code check and leftover file after a merge
Improve some docstrings

--- don't change below this line ---
ENG-4087 Took 1 hour 39 minutes
This commit is contained in:
Diana Carvalho
2025-01-31 18:40:59 +00:00
parent 9d32291c97
commit 1a8e0f102c
14 changed files with 32 additions and 200 deletions

View File

@@ -2,48 +2,46 @@ use num_bigint::BigUint;
use tycho_core::{dto::ProtocolComponent, Bytes};
#[derive(Clone, Default, Debug)]
#[allow(dead_code)]
pub struct Solution {
/// True if the solution is an exact output solution.
pub exact_out: bool,
/// Address of the sender.
pub sender: Bytes,
/// Address of the receiver.
pub receiver: Bytes,
/// The token being sold (exact in) or bought (exact out).
pub given_token: Bytes,
/// Amount of the given token.
pub given_amount: BigUint,
/// The token being bought (exact in) or sold (exact out).
pub checked_token: Bytes,
/// False if the solution is an exact input solution. Currently only exact input solutions are
/// supported.
pub exact_out: bool,
// If set, it will be applied to expected_amount
pub slippage: Option<f64>,
/// Expected amount of the bought token (exact in) or sold token (exact out).
pub expected_amount: BigUint,
pub expected_amount: Option<BigUint>,
/// Minimum amount to be checked for the solution to be valid.
/// If not set, the check will not be performed.
pub check_amount: Option<BigUint>,
/// Address of the sender.
pub sender: Bytes,
/// Address of the receiver.
pub receiver: Bytes,
/// List of swaps to fulfill the solution.
pub swaps: Vec<Swap>,
// If not set, then the Tycho Router will be used
pub router_address: Option<Bytes>,
// If set, the corresponding native action will be executed.
pub native_action: Option<NativeAction>,
/// If set to true, the solution will be encoded to be sent directly to the Executor and
/// skip the router. The user is responsible for managing necessary approvals and token
/// transfers.
pub direct_execution: bool,
// if not set, then the Propeller Router will be used
pub router_address: Option<Bytes>,
// if set, it will be applied to check_amount
pub slippage: Option<f64>,
// if set, the corresponding native action will be executed
pub native_action: Option<NativeAction>,
}
#[derive(Clone, PartialEq, Debug)]
#[allow(dead_code)]
pub enum NativeAction {
Wrap,
Unwrap,
}
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub struct Swap {
/// Protocol component from tycho indexer
pub component: ProtocolComponent,
@@ -51,20 +49,20 @@ pub struct Swap {
pub token_in: Bytes,
/// Token being output from the pool.
pub token_out: Bytes,
/// Percentage of the amount to be swapped in this operation.
/// Percentage of the amount to be swapped in this operation (for example, 0.5 means 50%)
pub split: f64,
}
#[allow(dead_code)]
#[derive(Clone, Debug)]
pub struct Transaction {
pub data: Vec<u8>,
// ETH value to be sent with the transaction.
pub value: BigUint,
// Address of the contract to call with the calldata
pub to: Bytes,
// ETH value to be sent with the transaction.
pub value: BigUint,
// Encoded calldata for the transaction.
pub data: Vec<u8>,
}
#[allow(dead_code)]
pub struct EncodingContext {
pub receiver: Bytes,
pub exact_out: bool,