@safe-global/safe-modules-deployments 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Safe Ecosystem Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Safe Modules Deployments
2
+
3
+ [![npm version](https://badge.fury.io/js/%40safe-global%2Fsafe-modules-deployments.svg)](https://badge.fury.io/js/%40safe-global%2Fsafe-modules-deployments)
4
+
5
+ This contract contains a collection of deployments of audited contracts from the [Safe modules repository](https://github.com/safe-global/safe-modules).
6
+
7
+ 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](./src/assets/).
8
+
9
+ To add additional deployments please follow the [deployment steps in the module folder in the Safe modules repository](https://github.com/safe-global/safe-modules).
10
+
11
+ ## Install
12
+
13
+ - npm - `npm i @safe-global/safe-modules-deployments`
14
+ - yarn - `yarn add @safe-global/safe-modules-deployments`
15
+
16
+ ## Usage
17
+
18
+ It is possible to directly use the json files in the [assets folder](./src/assets/) that contain the addresses and abi definitions.
19
+
20
+ 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.
21
+
22
+ Each of the method takes an optional `DeploymentFilter` as a parameter.
23
+
24
+ ```ts
25
+ interface DeploymentFilter {
26
+ version?: string;
27
+ released?: boolean; // Defaults to true if no filter is specified
28
+ network?: string; // Chain id of the network
29
+ }
30
+ ```
31
+
32
+ The method will return a `SingletonDeployment` object or `undefined` if no deployment was found for the specified filter.
33
+
34
+ ```ts
35
+ interface SingletonDeployment {
36
+ version: string;
37
+ abi: any[];
38
+ networkAddresses: Record<string, string>; // Address of the contract by network
39
+ contractName: string;
40
+ released: boolean; // A released version was audited and has a running bug bounty
41
+ }
42
+ ```
43
+
44
+ - Allowance Module
45
+
46
+ ```ts
47
+ const allowanceModule = getAllowanceModuleDeployment();
48
+
49
+ // Returns latest contract version, even if not finally released yet
50
+ const allowanceModuleNightly = getAllowanceModuleDeployment({ released: undefined });
51
+
52
+ // Returns released contract version for specific network
53
+ const allowanceModuleGörli = getAllowanceModuleDeployment({ network: '5' });
54
+
55
+ // Returns released contract version for specific version
56
+ const allowanceModule010 = getAllowanceModuleDeployment({ version: '0.1.0' });
57
+ ```
58
+
59
+ ## Notes
60
+
61
+ A list of network information can be found at [chainid.network](https://chainid.network/)
62
+
63
+ ## License
64
+
65
+ This library is released under MIT.
@@ -0,0 +1,2 @@
1
+ import { DeploymentFilter, SingletonDeployment } from './types';
2
+ export declare const getAllowanceModuleDeployment: (filter?: DeploymentFilter | undefined) => SingletonDeployment | undefined;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAllowanceModuleDeployment = void 0;
7
+ const allowance_module_json_1 = __importDefault(require("./assets/allowance-module/v0.1.0/allowance-module.json"));
8
+ const utils_1 = require("./utils");
9
+ // The array should be sorted from the latest version to the oldest.
10
+ const ALLOWANCE_MODULE_DEPLOYMENTS = [allowance_module_json_1.default];
11
+ const getAllowanceModuleDeployment = (filter) => {
12
+ return (0, utils_1.findDeployment)((0, utils_1.applyFilterDefaults)(filter), ALLOWANCE_MODULE_DEPLOYMENTS);
13
+ };
14
+ exports.getAllowanceModuleDeployment = getAllowanceModuleDeployment;