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

Use the value from the LI.FI quote response data directly #281

Merged
merged 1 commit into from
Aug 15, 2023

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Aug 14, 2023

The mainnet value must be sent as it is calculated by the LI.FI API because it includes mainnet amount needed to pay for bridge fees within the smart contract.

CHANGELOG

  • Fixed: LI.FI on-chain transactions no longer revert due to missing bridge fees

Dependencies

none

Description

none

@@ -312,7 +312,7 @@ export function makeLifiPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {
spendTargets: [
{
memo: approvalData,
nativeAmount: '0',
nativeAmount: mul(transactionRequest.value, '1'),
Copy link
Member

Choose a reason for hiding this comment

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

Yikes. This is the approval transaction and should never send actual funds. This could cause a loss of funds for the user.

@@ -333,7 +333,7 @@ export function makeLifiPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {
spendTargets: [
{
memo: data,
nativeAmount: nativeAmount,
nativeAmount: mul(transactionRequest.value, '1'),
Copy link
Member

Choose a reason for hiding this comment

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

Why would this ever be different from nativeAmount. Lifi only supports from quotes, so if the user specifies that they only want to send 0.1234 of an asset, we can't send more than that.

The mainnet value must be sent as it is calculated by the LI.FI API
because it includes mainnet amount needed to pay for bridge fees within
the smart contract.
@samholmes samholmes merged commit 20bb4c3 into master Aug 15, 2023
1 check passed
@swansontec swansontec deleted the sam/lifi-fix branch September 14, 2023 21:12
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