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

maki-swap-lib

v2.1.0

Published

Maki Swap Library

Downloads

10

Readme

Maki Swap Lib

Solidity libraries that are shared across MakiSwap contracts. These libraries are focused on safety and gas efficiency.

Installing

Run yarn to install dependencies.

Testing

Run yarn test to execute the test suite.

Using

Install this in another project via yarn add maki-swap-lib

Then import the contracts via:

import "maki-swap-lib/contracts/access/Ownable.sol"; 

Test Results

  AddressStringUtil
    #toAsciiString
      ✓ zero address (63ms)
      ✓ own address
      ✓ random address
      ✓ reverts if len % 2 != 0
      ✓ reverts if len >= 40
      ✓ reverts if len == 0
      ✓ produces len characters (54ms)

  FixedPoint
    #encode
      ✓ shifts left by 112
      ✓ will not take >type(uint112).max
    #encode144
      ✓ shifts left by 112
      ✓ will not take >type(uint144).max
    #decode
      ✓ shifts right by 112
      ✓ will not take >type(uint224).max
    #decode144
      ✓ shifts right by 112
      ✓ will not take >uint256(-1)
    #div
      ✓ correct division
      ✓ throws for div by zero
    #mul
      ✓ correct multiplication
      ✓ overflow
      ✓ max of q112x112
    #fraction
      ✓ correct computation less than 1
      ✓ correct computation greater than 1
      ✓ fails with 0 denominator
    #reciprocal
      ✓ works for 0.25
      ✓ fails for 0
      ✓ works for 5
    #sqrt
      ✓ works for 25
      ✓ works with numbers less than 1
      ✓ works with 0

  PairNamer
    #pairName
      ✓ concatenation (134ms)
    #pairSymbol
      ✓ concatenation (116ms)

  SafeHRC20Namer
    #tokenName
      ✓ works with compliant (66ms)
      ✓ works with noncompliant (62ms)
      ✓ works with empty bytes32 (63ms)
      ✓ works with noncompliant full bytes32 (68ms)
      ✓ works with optional (68ms)
      ✓ works with non-code address
      ✓ works with really long strings (91ms)
      ✓ falls back to address with empty strings (67ms)
    #tokenSymbol
      ✓ works with compliant (66ms)
      ✓ works with noncompliant (61ms)
      ✓ works with empty bytes32 (59ms)
      ✓ works with noncompliant full bytes32 (68ms)
      ✓ works with optional (54ms)
      ✓ works with non-code address
      ✓ works with really long strings (93ms)
      ✓ falls back to address with empty strings (62ms)

  SafeMathTest
    #sqrt
      ✓ works for 0-99 (1088ms)
      ✓ max uint256

  TransferHelper
    #safeApprove
      ✓ succeeds with compliant with no revert and true return (103ms)
      ✓ fails with compliant with no revert and false return (76ms)
      ✓ fails with compliant with revert (63ms)
      ✓ succeeds with noncompliant (no return) with no revert (132ms)
      ✓ fails with noncompliant (no return) with revert (64ms)
    #safeTransfer
      ✓ succeeds with compliant with no revert and true return (91ms)
      ✓ fails with compliant with no revert and false return (60ms)
      ✓ fails with compliant with revert (62ms)
      ✓ succeeds with noncompliant (no return) with no revert (92ms)
      ✓ fails with noncompliant (no return) with revert (63ms)
    #safeTransferFrom
      ✓ succeeds with compliant with no revert and true return (87ms)
      ✓ fails with compliant with no revert and false return (60ms)
      ✓ fails with compliant with revert (65ms)
      ✓ succeeds with noncompliant (no return) with no revert (88ms)
      ✓ fails with noncompliant (no return) with revert (68ms)
    #safeTransferHT
      ✓ succeeds call not reverted (144ms)
      ✓ fails if call reverts (62ms)


  66 passing (5s)

✨  Done in 14.70s.