3.5.1 • Published 12 months ago

@looksrare/contracts-libs v3.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@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

NameDescriptionTypeLatest versionAudited?
OwnableTwoStepsContract for managing ownership of a smart contract. The transfer of ownership is done in a 2-step process.Contract2.5.0Yes
SignatureCheckerCalldataContract for verifying the validity of a (calldata) signature for EOA (64-byte, 65-byte signatures) and EIP-1271.Contract3.0.0Yes
SignatureCheckerMemoryContract for verifying the validity of a (memory) signature for EOA (64-byte, 65-byte signatures) and EIP-1271.Contract3.0.0Yes
ReentrancyGuardContract with a modifier to prevent reentrancy calls.Contract2.4.4Yes
PackedReentrancyGuardContract with a modifier to prevent reentrancy calls. Adapted from ReentrancyGuard.Contract2.5.1Yes
LowLevelETHTransferLow-level call function to transfer ETHContract2.4.4Yes
LowLevelETHReturnETHIfAnyLow-level call function to return all ETH leftContract2.4.4Yes
LowLevelETHReturnETHIfAnyExceptOneWeiLow-level call function to return all ETH left except one weiContract2.4.4Yes
LowLevelWETHLow-level call functions to transfer ETH with an option to wrap to WETH if the original ETH transfer fails within a gas limitContract2.4.4Yes
LowLevelERC20ApproveLow-level call functions for ERC20 approve functionsContract2.4.4Yes
LowLevelERC20TransferLow-level call functions for ERC20 transfer functionsContract2.4.4Yes
LowLevelERC721TransferLow-level call functions for ERC721 functionsContract2.4.4Yes
LowLevelERC1155TransferLow-level call functions for ERC1155 functionsContract2.4.4Yes
ProtocolFeeContract for defining protocol fee recipient and basis pointsContract3.2.0No

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
3.5.1

12 months ago

3.5.0

12 months ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

2.5.3

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.5.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.5.2

2 years ago

2.4.3

3 years ago

2.6.0

2 years ago

2.5.1

3 years ago

2.4.2

3 years ago

2.4.4

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago