npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

trable-payment

v1.0.0

Published

Enable pay in travel without trouble|Trable is a DApp application designed for overseas travel products with a focus on cryptocurrency payments.|@Web3-Club

Downloads

4

Readme

English | 中文

Introduction

With the growing Web3 ecosystem, more and more people are entering the Web3 industry, leading to an increasing number of individuals using cryptocurrencies for payments of products and services. However, the process of completing a purchase has become cumbersome, especially when it involves overseas products, requiring multiple asset conversions. This process is time-consuming and incurs high costs.

Traditional crypto payment process for overseas travel products:

Cryptocurrency - DEX - CEX - Fiat currency - Foreign fiat currency payment

Flowchart Demo

graph TD
  subgraph Multi-chain Token
    A1[main network]
    A2[Layer2 Token]
    A3[other Tokens]
  end

  B[Cross-chain Bridge]

  subgraph DEX/CEX
    C1[DEX1]
    C2[CEX1]
    C3[DEX2]
  end

  subgraph Monetary Conversion
    D[c2c domestic currency deposit and withdrawal]
    D1[Conversion of various legal currencies.]
  end

  E[Credit Card<br>visa/mastercard/China UnionPay/JCB/American Express]
  F[Payment for Overseas Products]

  A1 -->|Asset Replacement| B -->|gas consumption<br>Waiting for the payment to be credited.| C1 -->|Asset Transfer| C2 
  A2 -->|Asset Replacement| B -->|gas consumption<br>Waiting for the payment to be credited.| C2 -->|Asset Transfer| D
  A3 -->|Asset Replacement| B -->|gas consumption<br>Waiting for the payment to be credited.| C3 -->|Asset Transfer| D -->|Rate Discount| D1 --> E
  E --> |Currency Conversion Fee| F

Drawbacks:

  • ❌ DEX conversion friction costs
  • ❌ CEX transaction fees
  • ❌ Currency conversion loss during withdrawal
  • ❌ Currency conversion fees for foreign money payments

Trable's Objective:

  • ✅ One-step signing, minimal fees
graph TD
  C[The user has explicitly paid for the product.]
  subgraph User Action
    A1[main networdk]
    A2[Layer2 Token]
    A3[Multi-chain Token]
  end
  subgraph  Trable
    B[Signature confirmation]
    F[Stablecoin]
    Z[uniswap V4<br>hook pool]
    D[Payment Successful]
  end

C --> A1 --> B
C --> A2 --> B
C --> A3 --> B 
B --> Z -->F --> D

To address these challenges, our project proposes a solution that optimizes the asset conversion process and enhances users' Web3 experience. In the post-pandemic era, the travel industry is thriving, and Trable aims to enter this vast market by offering unique value propositions.

Project Introduction

Trable is an overseas travel product Dapp application for cryptocurrency payment.

This application integrates Uniswap V4 and other technologies and relies in the Solana ecosystem to effectively simplify the process for users to order overseas travel products using cryptocurrency, shorten the time required for consumers and reduce the cost of DEX/CEX currency conversion. .

Users only need to select the required payment password and complete the signature to easily book overseas travel products on this Dapp. We have solved the problems of personal foreign exchange limit limits and insufficient payment tools, and provided necessary legal currency payment support. At the same time, we monitor the flow of funds in real time on the chain to ensure the safety of funds. During the entire process, only one handling fee will be charged, providing comprehensive protection for users’ ordering experience.

Basic technical architecture

How it works?

We aim to help users who want to pay their travel fee directly through polka related asset like DOT. Thus transfering polka asset from parachain to USDC on EVM is our primary target.

We utilize acala asset router to achieve the target. The following 6 steps describe how it works in detail.

  1. In our front page, users only need to select the source and target chains, as well as the token to transfer. As we can see in the demo video. Our web extension will save order information and jump to trable payment page.
  2. The second step is get a router address on karura network. In our project, we will send a shoudRounteWormhole request.
  3. We will pop a signature request that prompts users to sign a transtraction from parachain to karura chain
  4. After the signature, we will send tokens to wormhole. In our code, the routeWormhole will achieve this.
  5. After send the token, router will be listening and waiting for VAA. After fetch it, the router interact with wormhole core contract。
  6. At the final step, user will sign a transaction with Wallet (like MetaMask) that redeems the token on the target EVM chain.

cross chain code analyze

Most of token transfer on Trable is parachain -> EVM, Thus we mainly use wormhole proctool. Here is cross chain tranfer code in WormholeRouter.sol

function routeImpl(ERC20 token) internal override {
        bool approved = token.approve(_tokenBridgeAddress, token.balanceOf(address(this)));
        require(approved, "WormholeRouter: approve failed");

        ITokenBridge(_tokenBridgeAddress).transferTokens(
            address(token),
            token.balanceOf(address(this)),
            _instructions.recipientChain,
            _instructions.recipient,
            _instructions.arbiterFee,
            _instructions.nonce
        );
  }

ITokenBridge is the core of cross chain, you could find it in https://github.com/Web3-Club/wormhole/blob/main/ethereum/contracts/bridge/interfaces/ITokenBridge.sol

Uniswap V4

In Uniswap V3, each liquidity pool is deployed with its own individual contract, resulting in higher costs for creating pools and executing multi-pool exchanges.

Uniswap V4 consolidates all liquidity pools into a single contract, thereby saving significant gas costs. This is because exchanges will no longer require the transfer of tokens between pools in different contracts.

Solidity

  • The project is built on Uniswap V3 to ensure future support for Uniswap V4. We utilized the Solidity for the project's smart contracts.

Frontend

Project frontend repository:Trable-froutend

Demo

Key Dapp Features

  • Support for fiat currency payments

  • Fast transactions anytime, anywhere

  • Save time and effort, lower loss

  • No need to consider personal foreign exchange restrictions

Testing

The project includes test cases for contract functionality, ensuring the correctness and security of each feature.

Project demo

Video

https://youtu.be/ujFpy4i8USQ

Member

GitHub: @yanboishere @Jerry @nuttt

Contect

Twitter Telegram Mail