@ayanworks/polygon-did-registry-contract 0.0.1 → 0.0.2
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/build/contracts/Migrations.json +1730 -505
- package/build/contracts/PolygonDidRegistry.json +10367 -4864
- package/contracts/PolygonDidRegistry.sol +32 -7
- package/package.json +7 -6
- package/test/polygon_did_registry_test.js +105 -9
- package/truffle-config.js +108 -108
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*Submitted for verification at polygonscan.com on 2021-12-29
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
//SPDX-License-Identifier: MIT
|
|
6
|
+
pragma solidity ^0.8.0;
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
*@title PolygonDidRegistry
|
|
5
10
|
*@dev Smart Contract for Polygon DID Method
|
|
6
11
|
*/
|
|
7
12
|
contract PolygonDidRegistry {
|
|
13
|
+
address owner;
|
|
8
14
|
struct PolyDID {
|
|
9
15
|
address controller;
|
|
10
16
|
uint256 created;
|
|
@@ -22,20 +28,40 @@ contract PolygonDidRegistry {
|
|
|
22
28
|
event DidCreated(address id, string doc);
|
|
23
29
|
event DidUpdated(address id, string doc);
|
|
24
30
|
event DidDeleted(address id);
|
|
31
|
+
event TransferOwnership(address newOwner);
|
|
32
|
+
|
|
33
|
+
constructor (){
|
|
34
|
+
owner = msg.sender;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
modifier onlyOwner(){
|
|
38
|
+
require( msg.sender == owner, "message sender is not the owner");
|
|
39
|
+
_;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function transferOwnership(address newOwner)public onlyOwner() returns (string memory){
|
|
43
|
+
if(owner != newOwner){
|
|
44
|
+
owner = newOwner;
|
|
45
|
+
emit TransferOwnership(owner);
|
|
46
|
+
return ("Ownership transffered successfully");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return ("New Owner address is equal to original owner address");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
25
52
|
|
|
26
53
|
/**
|
|
27
54
|
*@dev Register a new DID
|
|
28
55
|
*@param _id - Address that will refer the DID doc
|
|
29
56
|
*@param _doc - A string object that holds the DID Doc
|
|
30
|
-
*@return returns the controller, created and updated time stamp and DID Document
|
|
31
57
|
*/
|
|
32
58
|
function createDID(address _id, string memory _doc)
|
|
33
59
|
public
|
|
34
60
|
returns (address controller, uint256 created, uint256 updated, string memory did_doc)
|
|
35
61
|
{
|
|
36
62
|
did[_id].controller = msg.sender;
|
|
37
|
-
did[_id].created =
|
|
38
|
-
did[_id].updated =
|
|
63
|
+
did[_id].created = block.timestamp;
|
|
64
|
+
did[_id].updated = block.timestamp;
|
|
39
65
|
did[_id].did_doc = _doc;
|
|
40
66
|
emit DidCreated(_id, _doc);
|
|
41
67
|
return (did[_id].controller, did[_id].created, did[_id].updated, did[_id].did_doc);
|
|
@@ -53,14 +79,13 @@ contract PolygonDidRegistry {
|
|
|
53
79
|
*@dev To Update the DID doc
|
|
54
80
|
*@param _id - Address that refers to the DID doc
|
|
55
81
|
*@param _doc - A String that holds the DID doc
|
|
56
|
-
*@return returns the controller, created and updated time stamp and DID Document
|
|
57
82
|
*/
|
|
58
83
|
function updateDID(address _id, string memory _doc)
|
|
59
84
|
public
|
|
60
85
|
onlyController(_id) returns(address controller, uint256 created, uint256 updated, string memory did_doc)
|
|
61
86
|
{
|
|
62
87
|
did[_id].did_doc = _doc;
|
|
63
|
-
did[_id].updated =
|
|
88
|
+
did[_id].updated = block.timestamp;
|
|
64
89
|
emit DidUpdated(_id, _doc);
|
|
65
90
|
return (did[_id].controller, did[_id].created, did[_id].updated, did[_id].did_doc);
|
|
66
91
|
}
|
|
@@ -73,4 +98,4 @@ contract PolygonDidRegistry {
|
|
|
73
98
|
delete did[_id];
|
|
74
99
|
emit DidDeleted(_id);
|
|
75
100
|
}
|
|
76
|
-
}
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ayanworks/polygon-did-registry-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Smart Contract to register DID on Polygon",
|
|
5
5
|
"main": "build/contracts/PolygonDidRegistry.json",
|
|
6
6
|
"directories": {
|
|
@@ -15,21 +15,22 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"ganache-cli": "6.8.1",
|
|
17
17
|
"mocha": "^7.0.0",
|
|
18
|
-
"solc": "0.
|
|
18
|
+
"solc": "0.8.0",
|
|
19
19
|
"ethers": "^4.0.41",
|
|
20
20
|
"fs-extra": "8.1.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://
|
|
25
|
+
"url": "git+https://github.com/ayanworks/polygon-did-registry-contract"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
28
|
"did-method"
|
|
29
29
|
],
|
|
30
|
-
"author": "
|
|
30
|
+
"author": "Ajay Jadhav <ajay@ayanworks.com>",
|
|
31
|
+
"contributors": ["Anusha Garg <anusha.garg@ayanworks.com>, Shashank Kulkarni <shashank.kulkarni@ayanworks.com>"],
|
|
31
32
|
"bugs": {
|
|
32
|
-
"url": "https://
|
|
33
|
+
"url": "https://github.com/ayanworks/polygon-did-registry-contract/issues"
|
|
33
34
|
},
|
|
34
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://github.com/ayanworks/polygon-did-registry-contract#readme"
|
|
35
36
|
}
|
|
@@ -7,9 +7,10 @@ const assert = require('assert');
|
|
|
7
7
|
const provider = new ethers.providers.Web3Provider(ganache.provider({ gasLimit: 8000000 }));
|
|
8
8
|
|
|
9
9
|
// Initializing the build files
|
|
10
|
-
const PolygonDIDRegistryJSON = require('../build/
|
|
10
|
+
const PolygonDIDRegistryJSON = require('../build/PolygonDidRegistry_PolygonDidRegistry.json');
|
|
11
|
+
// const { it } = require('ethers/wordlists');
|
|
11
12
|
|
|
12
|
-
let accounts, PolygonDIDRegistryInstance;
|
|
13
|
+
let accounts, PolygonDIDRegistryInstance, PolygonDIDRegistryInstance_test;
|
|
13
14
|
|
|
14
15
|
// Describing the 1st Test
|
|
15
16
|
// This will setup Ganache with some test address
|
|
@@ -31,7 +32,6 @@ describe('Basic Contract Testing', () => {
|
|
|
31
32
|
// Describing a SubTest case
|
|
32
33
|
describe('Setting up the contract', async () => {
|
|
33
34
|
|
|
34
|
-
// 1st Test case for the SubTest case
|
|
35
35
|
it('This Deploys Polygon Smart contract from 1st account with no Parameters/Constructor', async () => {
|
|
36
36
|
|
|
37
37
|
// Creating a contract factory for deploying contract.
|
|
@@ -41,7 +41,7 @@ describe('Basic Contract Testing', () => {
|
|
|
41
41
|
provider.getSigner(accounts[0])
|
|
42
42
|
);
|
|
43
43
|
PolygonDIDRegistryInstance = await PolygonDIDRegistry.deploy();
|
|
44
|
-
|
|
44
|
+
PolygonDIDRegistryInstance_test = new ethers.Contract(PolygonDIDRegistryInstance.address, PolygonDIDRegistryJSON.abi, provider.getSigner(accounts[1]));
|
|
45
45
|
assert.ok(PolygonDIDRegistryInstance.address, 'conract address should be present');
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -50,7 +50,6 @@ describe('Basic Contract Testing', () => {
|
|
|
50
50
|
// Describing the 3rd Test case
|
|
51
51
|
describe('Checking the Create function in Contract', async () => {
|
|
52
52
|
|
|
53
|
-
// Initializing the 1st sub test
|
|
54
53
|
it('This should store the DID doc on Contract and will read and check if the value stored is correct', async () => {
|
|
55
54
|
|
|
56
55
|
// This will send the value to local ganache blockchain
|
|
@@ -70,13 +69,18 @@ describe('Basic Contract Testing', () => {
|
|
|
70
69
|
doc,
|
|
71
70
|
'value set must be able to get'
|
|
72
71
|
);
|
|
72
|
+
|
|
73
|
+
assert.notEqual(
|
|
74
|
+
currentValue,
|
|
75
|
+
null,
|
|
76
|
+
'value should not be empty'
|
|
77
|
+
);
|
|
73
78
|
});
|
|
74
79
|
});
|
|
75
80
|
|
|
76
81
|
// Describing the 4th Test case
|
|
77
82
|
describe('Checking the Update function in Contract', async () => {
|
|
78
83
|
|
|
79
|
-
// Initializing the 1st sub test
|
|
80
84
|
it('This should update the DID doc on Contract and will read and check if the value stored is correct', async () => {
|
|
81
85
|
|
|
82
86
|
// This will send the value to local ganache blockchain
|
|
@@ -99,17 +103,109 @@ describe('Basic Contract Testing', () => {
|
|
|
99
103
|
);
|
|
100
104
|
});
|
|
101
105
|
});
|
|
106
|
+
//Describing test 5 to check if test fails if we update with different controller
|
|
107
|
+
describe('Checking update with wrong controller', async () => {
|
|
108
|
+
|
|
109
|
+
it('This should not update DID doc ', async () => {
|
|
110
|
+
|
|
111
|
+
const did = '0x2f65b747440deaf596892dfc7965040be8b99100';
|
|
112
|
+
const doc = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}';
|
|
113
|
+
try {
|
|
114
|
+
assert.ifError(
|
|
115
|
+
//sending transaction using different controller
|
|
116
|
+
await PolygonDIDRegistryInstance_test.functions.updateDID(did, doc));
|
|
117
|
+
} catch (error) {
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
102
121
|
|
|
103
|
-
// Describing the
|
|
122
|
+
// Describing the 6th Test case
|
|
104
123
|
describe('Checking the Delete function in Contract', async () => {
|
|
105
124
|
|
|
106
|
-
|
|
107
|
-
it('This should delete the DID doc on Contract and will read and check if the value is now null', async () => {
|
|
125
|
+
it('This should delete the DID doc on Contract and will read and check if the value is now an empty string', async () => {
|
|
108
126
|
|
|
109
127
|
// This will send the value to local ganache blockchain
|
|
110
128
|
const did = '0x2f65b747440deaf596892dfc7965040be8b99100';
|
|
129
|
+
const tx = await PolygonDIDRegistryInstance.functions.deleteDID(did);
|
|
130
|
+
|
|
131
|
+
// Transfer confirmation
|
|
132
|
+
await tx.wait();
|
|
133
|
+
|
|
134
|
+
// Getting the set value in ganache blockchain
|
|
135
|
+
const currentValue = await PolygonDIDRegistryInstance.functions.getDID(did);
|
|
136
|
+
|
|
137
|
+
// Comparing the set value to confirm
|
|
138
|
+
assert.equal(
|
|
139
|
+
currentValue,
|
|
140
|
+
"",
|
|
141
|
+
'value should be matching'
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Describing the 7th Test case
|
|
147
|
+
describe('Checking the Create function in Contract', async () => {
|
|
148
|
+
|
|
149
|
+
it('This should store the DID doc on Contract and will read and check if the value stored is not null', async () => {
|
|
150
|
+
|
|
151
|
+
// This will send the value to local ganache blockchain
|
|
152
|
+
const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b';
|
|
153
|
+
const doc = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}';
|
|
154
|
+
const doctest = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}';
|
|
155
|
+
const tx = await PolygonDIDRegistryInstance.functions.createDID(did, doc);
|
|
156
|
+
|
|
157
|
+
// Transfer confirmation
|
|
158
|
+
await tx.wait();
|
|
159
|
+
|
|
160
|
+
// Getting the set value in ganache blockchain
|
|
161
|
+
const currentValue = await PolygonDIDRegistryInstance.functions.getDID(did);
|
|
162
|
+
|
|
163
|
+
// Checking value is not null
|
|
164
|
+
|
|
165
|
+
assert.notEqual(
|
|
166
|
+
currentValue,
|
|
167
|
+
doctest,
|
|
168
|
+
'value should not match'
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// Describing the 8th Test case
|
|
174
|
+
describe('Checking the Update function in Contract', async () => {
|
|
175
|
+
|
|
176
|
+
it('This should update the DID doc on Contract and will read and check if the value stored has changed', async () => {
|
|
177
|
+
|
|
178
|
+
// This will send the value to local ganache blockchain
|
|
179
|
+
const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b';
|
|
180
|
+
//changed the controller
|
|
111
181
|
const doc = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}';
|
|
182
|
+
const docoriginal = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}';
|
|
183
|
+
const tx = await PolygonDIDRegistryInstance.functions.updateDID(did, doc);
|
|
112
184
|
|
|
185
|
+
// Transfer confirmation
|
|
186
|
+
await tx.wait();
|
|
187
|
+
|
|
188
|
+
// Getting the set value in ganache blockchain
|
|
189
|
+
const currentValue = await PolygonDIDRegistryInstance.functions.getDID(did);
|
|
190
|
+
|
|
191
|
+
// Comparing the set value to confirm
|
|
192
|
+
assert.notEqual(
|
|
193
|
+
currentValue,
|
|
194
|
+
docoriginal,
|
|
195
|
+
'value should not match'
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
// Describing the 9th Test case
|
|
202
|
+
describe('Checking the Delete function in Contract', async () => {
|
|
203
|
+
|
|
204
|
+
it('This should delete the DID doc on Contract and will read and check if the value is now not equal to the updated doc', async () => {
|
|
205
|
+
|
|
206
|
+
// This will send the value to local ganache blockchain
|
|
207
|
+
const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b';
|
|
208
|
+
const doc = '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}';
|
|
113
209
|
const tx = await PolygonDIDRegistryInstance.functions.deleteDID(did);
|
|
114
210
|
|
|
115
211
|
// Transfer confirmation
|
package/truffle-config.js
CHANGED
|
@@ -17,111 +17,111 @@
|
|
|
17
17
|
* phrase from a file you've .gitignored so it doesn't accidentally become public.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
const HDWalletProvider = require("@truffle/hdwallet-provider");
|
|
21
|
-
|
|
22
|
-
// const HDWalletProvider = require('@truffle/hdwallet-provider');
|
|
23
|
-
// const infuraKey = "fj4jll3k.....";
|
|
24
|
-
//
|
|
25
|
-
// const fs = require('fs');
|
|
26
|
-
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
|
27
|
-
|
|
28
|
-
module.exports = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
};
|
|
20
|
+
const HDWalletProvider = require("@truffle/hdwallet-provider");
|
|
21
|
+
const mnemonic = "";
|
|
22
|
+
// const HDWalletProvider = require('@truffle/hdwallet-provider');
|
|
23
|
+
// const infuraKey = "fj4jll3k.....";
|
|
24
|
+
//
|
|
25
|
+
// const fs = require('fs');
|
|
26
|
+
// const mnemonic = fs.readFileSync(".secret").toString().trim();
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
/**
|
|
30
|
+
* Networks define how you connect to your ethereum client and let you set the
|
|
31
|
+
* defaults web3 uses to send transactions. If you don't specify one truffle
|
|
32
|
+
* will spin up a development blockchain for you on port 9545 when you
|
|
33
|
+
* run `develop` or `test`. You can ask a truffle command to use a specific
|
|
34
|
+
* network from the command line, e.g
|
|
35
|
+
*
|
|
36
|
+
* $ truffle test --network <network-name>
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
networks: {
|
|
41
|
+
|
|
42
|
+
development: {
|
|
43
|
+
host: "127.0.0.1", // Localhost (default: none)
|
|
44
|
+
port: 8545, // Standard Ethereum port (default: none)
|
|
45
|
+
network_id: "*", // Any network (default: none)
|
|
46
|
+
},
|
|
47
|
+
matic: {
|
|
48
|
+
provider: function () {
|
|
49
|
+
return new HDWalletProvider(mnemonic, "https://rpc-mumbai.matic.today");
|
|
50
|
+
},
|
|
51
|
+
network_id: '80001',
|
|
52
|
+
},
|
|
53
|
+
matic_mainnet: {
|
|
54
|
+
provider: function () {
|
|
55
|
+
return new HDWalletProvider(mnemonic, "https://rpc-mainnet.maticvigil.com/");
|
|
56
|
+
},
|
|
57
|
+
network_id: '137',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Useful for testing. The `development` name is special - truffle uses it by default
|
|
61
|
+
// if it's defined here and no other network is specified at the command line.
|
|
62
|
+
// You should run a client (like ganache-cli, geth or parity) in a separate terminal
|
|
63
|
+
// tab if you use this network and you must also set the `host`, `port` and `network_id`
|
|
64
|
+
// options below to some value.
|
|
65
|
+
//
|
|
66
|
+
// development: {
|
|
67
|
+
// host: "127.0.0.1", // Localhost (default: none)
|
|
68
|
+
// port: 8545, // Standard Ethereum port (default: none)
|
|
69
|
+
// network_id: "*", // Any network (default: none)
|
|
70
|
+
// },
|
|
71
|
+
// Another network with more advanced options...
|
|
72
|
+
// advanced: {
|
|
73
|
+
// port: 8777, // Custom port
|
|
74
|
+
// network_id: 1342, // Custom network
|
|
75
|
+
// gas: 8500000, // Gas sent with each transaction (default: ~6700000)
|
|
76
|
+
// gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei)
|
|
77
|
+
// from: <address>, // Account to send txs from (default: accounts[0])
|
|
78
|
+
// websocket: true // Enable EventEmitter interface for web3 (default: false)
|
|
79
|
+
// },
|
|
80
|
+
// Useful for deploying to a public network.
|
|
81
|
+
// NB: It's important to wrap the provider as a function.
|
|
82
|
+
// ropsten: {
|
|
83
|
+
// provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/YOUR-PROJECT-ID`),
|
|
84
|
+
// network_id: 3, // Ropsten's id
|
|
85
|
+
// gas: 5500000, // Ropsten has a lower block limit than mainnet
|
|
86
|
+
// confirmations: 2, // # of confs to wait between deployments. (default: 0)
|
|
87
|
+
// timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
|
|
88
|
+
// skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
|
|
89
|
+
// },
|
|
90
|
+
// Useful for private networks
|
|
91
|
+
// private: {
|
|
92
|
+
// provider: () => new HDWalletProvider(mnemonic, `https://network.io`),
|
|
93
|
+
// network_id: 2111, // This network is yours, in the cloud.
|
|
94
|
+
// production: true // Treats this network as if it was a public net. (default: false)
|
|
95
|
+
// }
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
// Set default mocha options here, use special reporters etc.
|
|
99
|
+
mocha: {
|
|
100
|
+
// timeout: 100000
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// Configure your compilers
|
|
104
|
+
compilers: {
|
|
105
|
+
solc: {
|
|
106
|
+
version: "0.8.0", // Fetch exact version from solc-bin (default: truffle's version)
|
|
107
|
+
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
|
|
108
|
+
// settings: { // See the solidity docs for advice about optimization and evmVersion
|
|
109
|
+
// optimizer: {
|
|
110
|
+
// enabled: false,
|
|
111
|
+
// runs: 200
|
|
112
|
+
// },
|
|
113
|
+
// evmVersion: "byzantium"
|
|
114
|
+
// }
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// Truffle DB is currently disabled by default; to enable it, change enabled: false to enabled: true
|
|
119
|
+
//
|
|
120
|
+
// Note: if you migrated your contracts prior to enabling this field in your Truffle project and want
|
|
121
|
+
// those previously migrated contracts available in the .db directory, you will need to run the following:
|
|
122
|
+
// $ truffle migrate --reset --compile-all
|
|
123
|
+
|
|
124
|
+
db: {
|
|
125
|
+
enabled: false
|
|
126
|
+
}
|
|
127
|
+
};
|