@5e9588/safe-deployments 中文文档教程
Gnosis Safe Deployments
该合约包含安全合约的合约部署集合存储库。
对于每个部署,不同网络上的地址和 abi 文件都可用。 要获得可用版本的概览,请查看可用的 json 资产。
要添加其他部署,请遵循安全合约存储库中的部署步骤。
Install
- npm -
npm i @gnosis.pm/safe-deployments
- yarn -
yarn add @gnosis.pm/safe-deployments
Usage
可以直接使用 assets 文件夹 中包含地址和 abi 定义的 json 文件。
另一种方法是使用 JavaScript 库方法来查询正确的部署。 该库支持不同的方法来获取特定合约的部署。
每个方法都采用可选的 DeploymentFilter
作为参数。
interface DeploymentFilter {
version?: string,
released?: boolean, // Defaults to true if no filter is specified
network?: string // Chain id of the network
}
该方法将返回一个 SingletonDeployment
对象,如果没有找到指定过滤器的部署,则返回 undefined
。
interface SingletonDeployment {
defaultAddress: string, // Address the contract was deployed to by the Gnosis team
version: string,
abi: any[],
networkAddresses: Record<string, string>, // Address of the contract by network
contractName: string,
released: boolean // A released version was audited and has a running bug bounty
}
- Gnosis Safe
const safeSingleton = getSafeSingletonDeployment()
// Returns latest contract version, even if not finally released yet
const safeSingletonNightly = getSafeSingletonDeployment({ released: undefined })
// Returns released contract version for specific network
const safeSingletonGörli = getSafeSingletonDeployment({ network: "5" })
// Returns released contract version for specific version
const safeSingleton100 = getSafeSingletonDeployment({ version: "1.0.0" })
// Version with additional events used on L2 networks
const safeL2Singleton = getSafeL2SingletonDeployment()
- Factories
const proxyFactory = getProxyFactoryDeployment()
- Libraries
const multiSendLib = getMultiSendDeployment()
const multiSendCallOnlyLib = getMultiSendCallOnlyDeployment()
const createCallLib = getCreateCallDeployment()
- Handler
// Returns recommended handler
const fallbackHandler = getFallbackHandlerDeployment()
const callbackHandler = getDefaultCallbackHandlerDeployment()
const compatHandler = getCompatibilityFallbackHandlerDeployment()
Notes
可以在 chainid.network 找到网络信息列表。
License
这个库是在 MIT 下发布的。
Gnosis Safe Deployments
This contract contains a collection of deployments of the contract of the Safe contracts repository.
For each deployment the address on the different networks and the abi files are available. To get an overview of the available versions check the available json assets.
To add additional deployments please follow the deployment steps in the Safe contract repository.
Install
- npm -
npm i @gnosis.pm/safe-deployments
- yarn -
yarn add @gnosis.pm/safe-deployments
Usage
It is possible to directly use the json files in the assets folder that contain the addresses and abi definitions.
An alternative is to use the JavaScript library methods to query the correct deployment. The library supports different methods to get the deployment of a specific contract.
Each of the method takes an optional DeploymentFilter
as a parameter.
interface DeploymentFilter {
version?: string,
released?: boolean, // Defaults to true if no filter is specified
network?: string // Chain id of the network
}
The method will return a SingletonDeployment
object or undefined
if no deployment was found for the specified filter.
interface SingletonDeployment {
defaultAddress: string, // Address the contract was deployed to by the Gnosis team
version: string,
abi: any[],
networkAddresses: Record<string, string>, // Address of the contract by network
contractName: string,
released: boolean // A released version was audited and has a running bug bounty
}
- Gnosis Safe
const safeSingleton = getSafeSingletonDeployment()
// Returns latest contract version, even if not finally released yet
const safeSingletonNightly = getSafeSingletonDeployment({ released: undefined })
// Returns released contract version for specific network
const safeSingletonGörli = getSafeSingletonDeployment({ network: "5" })
// Returns released contract version for specific version
const safeSingleton100 = getSafeSingletonDeployment({ version: "1.0.0" })
// Version with additional events used on L2 networks
const safeL2Singleton = getSafeL2SingletonDeployment()
- Factories
const proxyFactory = getProxyFactoryDeployment()
- Libraries
const multiSendLib = getMultiSendDeployment()
const multiSendCallOnlyLib = getMultiSendCallOnlyDeployment()
const createCallLib = getCreateCallDeployment()
- Handler
// Returns recommended handler
const fallbackHandler = getFallbackHandlerDeployment()
const callbackHandler = getDefaultCallbackHandlerDeployment()
const compatHandler = getCompatibilityFallbackHandlerDeployment()
Notes
A list of network information can be found at chainid.network
License
This library is released under MIT.