0%

OpenZeppelin上的Solidity库列表

OpenZeppelin提供安全产品来构建、自动化部署、操作去中心化应用,同时也为头部机构的系统和产品提供安全审计服务。Openzeppelin-contracts是包含安全智能合约开发的库的仓库。Openzeppelin-contracts提供了以下功能:

  • ERC20和ERC721标准的实现
  • 弹性的基于role的权限机制
  • 提供可复用的Solidity组件,来构建自定义的合约及复杂的去中心化系统
  • 为系统提供Gas Station Network的最优继承,且无需gas费用
  • 头部安全公司的审计

A library for secure smart contract development. Build on a solid foundation of community-vetted code.

  • Implementations of standards like ERC20 and ERC721.
  • Flexible role-based permissioning scheme.
  • Reusable Solidity components to build custom contracts and complex decentralized systems.
  • First-class integration with the Gas Station Network for systems with no gas fees!
  • Audited by leading security firms (last full audit on v2.0.0).

具体功能可参考Contract文档。以下所列的合约并不是OpenZeppelin library的一部分。

参考:list-of-solidity-libraries-in-the-wild

Math

Integer 整型运算

  • math.sol, by DappHub. Mixin for inline numerical wizardry.
  • CarefulMath.sol, by Compound.
  • Math.sol, by alianse777.
  • SafeMathInt256, by Augur 1. Int256 math operations with safety checks that throw on error.
  • SafeMathUint256.sol, by Augur 1. Uint256 math operations with safety checks that throw on error.

Floating Point 浮点型运算

  • Multiprecision.sol, by alianse777.
  • ABDKMathQuad.sol, by ABDK. Smart contract library of mathematical functions operating with IEEE 754 quadruple-precision binary floating-point numbers (quadruple precision numbers). :warning: Weird license.

Fixed Point 定点小数运算

  • FixidityLib.sol, by CementDAO. This library provides fixed point arithmetic with protection against overflow.
  • SafeDecimalMath.sol, by Synthetix. Safely manipulate unsigned fixed-point decimals at a given precision level.
  • Exponential.sol, by Compound. Exponential module for storing fixed-precision decimals.
  • ABDKMath64x64, by ABDK. Smart contract library of mathematical functions operating with signed 64.64-bit fixed point numbers. :warning: Weird license.
  • FixedPoint.sol, by UMA . Library for fixed point arithmetic on uints with 18 digit precision.
  • RealMath.sol, by Macroverse.
  • BNum.sol, by Balancer. Library for fixed point arithmetic with 18 digit precision.

Fractions 有理数

  • FractionUtil.sol, by Celo.

Random 随机

  • UniformRandomNumber.sol, by PoolTogether. A library that eliminates modulo bias when bounding random numbers to a smaller range.
  • Random.sol, by alianse777. “random” numbers generator (not cryptographicaly secure).

Bytes 字节数组

  • BytesLib.sol, by Gonçalo Sá . Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
  • LibBytes.sol, by Augur .

Arrays 数组

  • Array.sol, by alianse777.

Type conversion 类型转换

  • UintToString.sol, by Augur. Uint operations to convert to string.
  • BytesToString.sol, by Augur. Bytes operations to convert to string and remove null characters.
  • Convert.sol, by alianse777.

Memory 内存

  • Memory.sol, by alianse777.

Proxy 代理

  • MinimalProxy.sol, by Ripio.
  • ProxyFactory.sol, by GNOSIS.

Wallet 钱包

MultiSig 多签

  • MultiSigWallet.sol, by GNOSIS. Allows multiple parties to agree on transactions before execution.
  • MultiSigWalletWithTimeLock.sol, by 0x. Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.

Data Structures 数据结构

  • LibCLL.sol, by o0ragman0o. A Solidity library for implementing a data indexing regime using a circular linked list.
  • StructuredLinkedList.sol, by Vittorio Minacori.
  • LinkedList.sol, by TechHQ.
  • DoubleLinkedList.sol, by TechHQ.
  • StateMachine.sol, by TechHQ.
  • SortitionSumTreeFactory, by Kleros. Allows values to be proportionally weighted with O(log(n)) efficiency. The linked package is actually the Kleros -codebase; ideally it should be extracted into its own library.
  • Heap.sol, by Celo. Simple heap implementation.
  • LinkedHashMap.sol, by AKA protocol.
  • HitchensOrderStatisticsTree.sol, by Rob Hitchens. A Solidity Red-Black Tree library to store and maintain a sorted data structure in a Red-Black binary search tree, with O(log 2n) insert, remove and search time (and gas, approximately).

Strings 字符串

  • strings.sol, by Arachnid. String & slice utility library for Solidity contracts.

Dates 日期

  • BokkyPooBahsDateTimeLibrary.sol, by bokkypoobah. A gas-efficient Solidity date and time library.

Serialization 序列号

  • Base64.sol, by OpenZeppelin.
  • JsmnSolLib.sol, by chrisdotn.

Encoding 编码

  • RLPEncode.sol, by OMG Network.

Cryptography 加解密

  • TypedSignature.sol, by dYdX. Library to unparse typed signatures.
  • SolRsaVerify.sol, by adria0. Verification of RSA Sha256 Pkcs1.5 Signatures.

Tokens 代币

  • ERC20DividendableEth.sol, by TechHQ.

Voting 投票

  • Voting.sol, by TechHQ.

时间锁

  • Timelock.sol, by Compound.