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

Add initial thorchain implementation #300

Merged
merged 10 commits into from
Nov 8, 2024
Merged

Add initial thorchain implementation #300

merged 10 commits into from
Nov 8, 2024

Conversation

gemcoder21
Copy link
Contributor

No description provided.

}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QuoteFees {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is struct used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to return total fees into the result quote

request.clone().from_asset,
request.to_asset.clone(),
value.to_string(),
"g1".to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a constant for this g1

@@ -15,6 +15,11 @@ impl BigNumberFormatter {
let decimal = Self::big_decimal_value(value, decimals as u32)?;
Some(decimal.to_string())
}

pub fn divide(value: &str, decimals: u32) -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe pass in BigInt instead of str, then we can handle unwrap outside

}

async fn fetch_quote_data(&self, quote: &SwapQuote, _provider: Arc<dyn AlienProvider>, _data: FetchQuoteData) -> Result<SwapQuoteData, SwapperError> {
let memo = ThorChainSwapClient::get_memo(quote.request.to_asset.clone(), quote.request.destination_address.clone(), "g1".to_string(), 50).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g1 can be a constant

provider: SwapProviderData {
name: self.name().to_string(),
routes: vec![SwapRoute {
route_type: quote.inbound_address.unwrap_or_default(),
Copy link
Collaborator

@0xh3rman 0xh3rman Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we need route_type data?, route_type is "thorchain" and route type data is "inbound address", so we can move fee_tier and gas_estimate to another type data for uniswap v3

@gemcoder21 gemcoder21 marked this pull request as ready for review November 8, 2024 00:08
@gemcoder21 gemcoder21 merged commit d011dcc into main Nov 8, 2024
6 checks passed
@gemcoder21 gemcoder21 deleted the swap-thorchain branch November 8, 2024 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants