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

@debridge-finance/dln-profitability

v1.0.0

Published

Someone who fulfills order in take chain and sends sendUnlock to give chain to receive order.give amount in give chain

Downloads

7

Readme

Entities

Taker

Someone who fulfills order in take chain and sends sendUnlock to give chain to receive order.give amount in give chain

Equivalent tokens

Tokens which are considered having the same value across different chains and hence be equal one to another. For example, USDC tokens issued by the same emitent (Circle Inc) are considered having the same value on any supported blockchain, so we can simply assume that X USDC on Ethereum has the same value as X USDC on Solana. This approach allows finding the cheapest (fee-free) exchange path across supported blockchains. The only important thing to consider is their decimals.

TokensBucket

A token bucket is a basket of tokens whose value we consider to be equivalent. In this case, we configure equivalent tokens in them for different chains. This makes it easier for us to calculate profitability and reduce the number of requests to price providers

DLN fees

Fees collected by dln protocol

  • fix fee - taken in give chain during order creation
  • transferFee - taken in give chain equivalent token during order creation = bpsToAmount(equivalentTokenGiveAmount, transferFeeBps)
  • affiliateFee - optional affiliate fee, taken during order creation in equivalent token

TakerFlow

Description of how funds will be converted during swaps, order creation/fulfillment/unlock

Flow

  1. Pick equivalent tokens
  2. Calculate preSwap before order creation (if needed)
  3. Calculate and deduct dln fees
  4. Deduct taker margin
  5. Convert equivalent token amount in give chain (accounting fess and margin) into equivalent amount in take chain
  6. Calculate preSwap before fulfillment (if needed)
  7. Calculate recommended take amount and zeroBpsTakeAmount - recommended amount with takerMargin set to 0