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

feat: add deposit service #136

Merged
merged 22 commits into from
Jan 24, 2024
Merged

feat: add deposit service #136

merged 22 commits into from
Jan 24, 2024

Conversation

npty
Copy link
Member

@npty npty commented Jan 16, 2024

Description

This PR added support for wrap/unwrap deposit address generation.

Changes

  • Added getNativeWrapDepositAddress API
  • Added getNativeUnwrapDepositAddress API
  • Renamed getDepositAddress to getLinkedDepositAddress
  • Added the new getDepositAddress API. This function will return the deposit address based on three scenarios:
    • The source token is native token, then this function returns deposit address from the getNativeWrapDepositAddress function.
    • The source token is not native token and the associated asset on the destination chain has isERC20WrappedNativeGasToken = true, then this function will return the linked deposit address where the destination address for linked deposit address is unwrap deposit address. (there're two addresses generation)
    • The source token is not native token and isERC20WrappedNativeGasToken is falsy, then the function simply returns the linked deposit address

Todo

  • Validate the wrap/unwrap addresses offline to prevent man in the middle attack Skip
  • Validate if given chains are active
  • Manually check on testnet if those addresses from 3 cases are working properly.

Test Results

1. Native Wrap Address

Sending AVAX from Avalanche to Fantom should receive WAVAX at the destination chain

Parameters

{
  sourceChain: "Avalanche",
  destinationChain: "Fantom",
  destinationAddress: "0xB8Cd93C83A974649D76B1c19f311f639e62272BC"
}

Returned Address

0xcd780367774c6ff9d781f41b09a095c450ecda58

Test Result

Passed ✅

Avalanche Tx
Axelarscan Tx
Fantom Tx

2. Unwrap Address

Sending WFTM from Avalanche to Fantom should receive FTM at the destination chain

Parameters

{
     sourceChain: "Avalanche",
     destinationChain: "Fantom",
     asset: "wftm-wei",
     destinationAddress: "0xB8Cd93C83A974649D76B1c19f311f639e62272BC",
}

Returned Address

0x7C74188B53193E2513C707F26d1Ecf6d0d2765B4

Test Results

Passed ✅

Avalanche Tx
Axelarscan Tx not found
Fantom Tx

3. Simple Linked Address

Sending aUSDC from Avalanche to Fantom should receive aUSDC at the destination chain

Parameters

{
    sourceChain: "Avalanche",
    destinationChain: "Fantom",
    asset: "uasdc",
    destinationAddress: "0xB8Cd93C83A974649D76B1c19f311f639e62272BC"
}

Returned Address

0xE12F77E36745Ad1019fbd19d09f2491047f9Ee73

Test Result

Passed ✅

Avalanche Tx
Axelarscan Tx not found
Fantom Tx

Copy link

changeset-bot bot commented Jan 16, 2024

⚠️ No Changeset found

Latest commit: 8ba512c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
axelar-maestro ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 3:21am
axelar-registry ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 3:21am
axelar-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 24, 2024 3:21am

destinationChain: string;
destinationAddress: string;
environment: Environment;
asset?: string; // if not specified, it is the native asset
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about string | 'native';?

Copy link
Member Author

Choose a reason for hiding this comment

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

this doesn't work since "native" is overridden by string

Copy link
Member Author

Choose a reason for hiding this comment

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

how about we make asset to be required, not optional, but remove getNativeWrapDepositAddress from the getDepositAddress function?

So if people want to send native token, they have to use getNativeWrapDepositAddress instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nah we want to have this be built in to the same function, don't have any other ideas tho

@npty npty merged commit 306c30d into main Jan 24, 2024
6 checks passed
@npty npty deleted the feat/add-deposit-service branch January 24, 2024 03:29
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.

3 participants