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

@looksrare/contracts-libs

v3.5.1

Published

LooksRare contract helper libraries

Downloads

9,841

Readme

@looksrare/contracts-libs

Tests License: MIT

This repository contains a set of Solidity contracts that can be used across contracts for purposes such as verifying signatures, protecting contracts against reentrancy attacks, low-level call functions, and a library for managing the ownership of a contract.

It also contains generic contract interfaces (for EIP/ERC) that can be used.

Installation

# Yarn
yarn add @looksrare/contracts-libs

# NPM
npm install @looksrare/contracts-libs

NPM package

The NPM package contains the following:

  • Solidity smart contracts (".sol")
  • ABIs (".json")

Current contracts

| Name | Description | Type | Latest version | Audited? | | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------- | -------------- | -------- | | OwnableTwoSteps | Contract for managing ownership of a smart contract. The transfer of ownership is done in a 2-step process. | Contract | 2.5.0 | Yes | | SignatureCheckerCalldata | Contract for verifying the validity of a (calldata) signature for EOA (64-byte, 65-byte signatures) and EIP-1271. | Contract | 3.0.0 | Yes | | SignatureCheckerMemory | Contract for verifying the validity of a (memory) signature for EOA (64-byte, 65-byte signatures) and EIP-1271. | Contract | 3.0.0 | Yes | | ReentrancyGuard | Contract with a modifier to prevent reentrancy calls. | Contract | 2.4.4 | Yes | | PackedReentrancyGuard | Contract with a modifier to prevent reentrancy calls. Adapted from ReentrancyGuard. | Contract | 2.5.1 | Yes | | LowLevelETHTransfer | Low-level call function to transfer ETH | Contract | 2.4.4 | Yes | | LowLevelETHReturnETHIfAny | Low-level call function to return all ETH left | Contract | 2.4.4 | Yes | | LowLevelETHReturnETHIfAnyExceptOneWei | Low-level call function to return all ETH left except one wei | Contract | 2.4.4 | Yes | | LowLevelWETH | Low-level call functions to transfer ETH with an option to wrap to WETH if the original ETH transfer fails within a gas limit | Contract | 2.4.4 | Yes | | LowLevelERC20Approve | Low-level call functions for ERC20 approve functions | Contract | 2.4.4 | Yes | | LowLevelERC20Transfer | Low-level call functions for ERC20 transfer functions | Contract | 2.4.4 | Yes | | LowLevelERC721Transfer | Low-level call functions for ERC721 functions | Contract | 2.4.4 | Yes | | LowLevelERC1155Transfer | Low-level call functions for ERC1155 functions | Contract | 2.4.4 | Yes | | ProtocolFee | Contract for defining protocol fee recipient and basis points | Contract | 3.2.0 | No |

About this repo

Structure

It is a hybrid Hardhat repo that also requires Foundry to run Solidity tests powered by the ds-test library.

To install Foundry, please follow the instructions here.

Run tests

  • Solidity tests are included in the foundry folder in the test folder.

Example of Foundry/Forge commands

forge build
forge test
forge test -vv
forge tree

Example of other commands

npx eslint '**/*.{js,ts}'
npx eslint '**/*.{js,ts}' --fix
npx prettier '**/*.{json,sol,md}' --check
npx prettier '**/*.{json,sol,md}' --write
npx solhint 'contracts/**/*.sol'
npx solhint 'contracts/**/*.sol' --fix

Coverage

It is required to install lcov.

brew install lcov

To run the coverage report, the below command can be executed.

forge coverage --report lcov
LCOV_EXCLUDE=("test/*" "contracts/interfaces/*" "contracts/errors/*.sol")
echo $LCOV_EXCLUDE | xargs lcov --output-file lcov-filtered.info --remove lcov.info
genhtml lcov-filtered.info --output-directory out
open out/index.html