@requestnetwork/smart-contracts 0.29.1-next.1875 → 0.29.1-next.1878
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/README.md +11 -1
- package/dist/hardhat.config.d.ts +5 -0
- package/dist/hardhat.config.d.ts.map +1 -1
- package/dist/hardhat.config.js +9 -0
- package/dist/hardhat.config.js.map +1 -1
- package/dist/scripts/deploy-one.d.ts.map +1 -1
- package/dist/scripts/deploy-one.js +4 -1
- package/dist/scripts/deploy-one.js.map +1 -1
- package/dist/scripts/test-deploy-batch-conversion-deployment.d.ts.map +1 -1
- package/dist/scripts/test-deploy-batch-conversion-deployment.js +4 -3
- package/dist/scripts/test-deploy-batch-conversion-deployment.js.map +1 -1
- package/dist/scripts/test-deploy-batch-erc-eth-deployment.d.ts.map +1 -1
- package/dist/scripts/test-deploy-batch-erc-eth-deployment.js +4 -1
- package/dist/scripts/test-deploy-batch-erc-eth-deployment.js.map +1 -1
- package/dist/scripts-create2/compute-one-address.d.ts +1 -1
- package/dist/scripts-create2/compute-one-address.d.ts.map +1 -1
- package/dist/scripts-create2/compute-one-address.js +4 -1
- package/dist/scripts-create2/compute-one-address.js.map +1 -1
- package/dist/scripts-create2/constructor-args.d.ts +2 -1
- package/dist/scripts-create2/constructor-args.d.ts.map +1 -1
- package/dist/scripts-create2/constructor-args.js.map +1 -1
- package/dist/scripts-create2/contract-setup/adminTasks.d.ts +4 -3
- package/dist/scripts-create2/contract-setup/adminTasks.d.ts.map +1 -1
- package/dist/scripts-create2/contract-setup/adminTasks.js.map +1 -1
- package/dist/scripts-create2/contract-setup/setupBatchConversionPayments.d.ts.map +1 -1
- package/dist/scripts-create2/contract-setup/setupBatchConversionPayments.js +2 -1
- package/dist/scripts-create2/contract-setup/setupBatchConversionPayments.js.map +1 -1
- package/dist/scripts-create2/contract-setup/setupERC20SwapToConversion.d.ts.map +1 -1
- package/dist/scripts-create2/contract-setup/setupERC20SwapToConversion.js +2 -0
- package/dist/scripts-create2/contract-setup/setupERC20SwapToConversion.js.map +1 -1
- package/dist/scripts-create2/contract-setup/setupETHConversionProxy.d.ts.map +1 -1
- package/dist/scripts-create2/contract-setup/setupETHConversionProxy.js +1 -0
- package/dist/scripts-create2/contract-setup/setupETHConversionProxy.js.map +1 -1
- package/dist/scripts-create2/contract-setup/setupErc20ConversionProxy.d.ts.map +1 -1
- package/dist/scripts-create2/contract-setup/setupErc20ConversionProxy.js +2 -0
- package/dist/scripts-create2/contract-setup/setupErc20ConversionProxy.js.map +1 -1
- package/dist/scripts-create2/deploy.d.ts +1 -2
- package/dist/scripts-create2/deploy.d.ts.map +1 -1
- package/dist/scripts-create2/deploy.js +9 -6
- package/dist/scripts-create2/deploy.js.map +1 -1
- package/dist/scripts-create2/tenderly.d.ts +3 -0
- package/dist/scripts-create2/tenderly.d.ts.map +1 -0
- package/dist/scripts-create2/tenderly.js +100 -0
- package/dist/scripts-create2/tenderly.js.map +1 -0
- package/dist/scripts-create2/types.d.ts +5 -0
- package/dist/scripts-create2/types.d.ts.map +1 -1
- package/dist/scripts-create2/utils.d.ts +1 -1
- package/dist/scripts-create2/utils.d.ts.map +1 -1
- package/dist/scripts-create2/utils.js +11 -4
- package/dist/scripts-create2/utils.js.map +1 -1
- package/dist/scripts-create2/verify.d.ts +1 -2
- package/dist/scripts-create2/verify.d.ts.map +1 -1
- package/dist/scripts-create2/verify.js +3 -1
- package/dist/scripts-create2/verify.js.map +1 -1
- package/dist/src/lib/ContractArtifact.d.ts +20 -10
- package/dist/src/lib/ContractArtifact.d.ts.map +1 -1
- package/dist/src/lib/ContractArtifact.js +22 -0
- package/dist/src/lib/ContractArtifact.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -5
|
@@ -6,6 +6,7 @@ const utils_1 = require("./utils");
|
|
|
6
6
|
const xdeployer_1 = require("./xdeployer");
|
|
7
7
|
const constructor_args_1 = require("./constructor-args");
|
|
8
8
|
const contract_setup_1 = require("./contract-setup");
|
|
9
|
+
const currency_1 = require("@requestnetwork/currency");
|
|
9
10
|
// Deploys, set up the contracts and returns the address
|
|
10
11
|
const deployOneWithCreate2 = (deploymentParams, hre) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
12
|
if (!hre.config.xdeploy.networks || hre.config.xdeploy.networks.length === 0) {
|
|
@@ -13,27 +14,27 @@ const deployOneWithCreate2 = (deploymentParams, hre) => tslib_1.__awaiter(void 0
|
|
|
13
14
|
}
|
|
14
15
|
// Deploy the contract on several network through xdeployer
|
|
15
16
|
const deploymentResult = yield (0, xdeployer_1.xdeploy)(deploymentParams, hre);
|
|
16
|
-
|
|
17
|
+
hre.config.xdeploy.networks.forEach((network, i) => {
|
|
17
18
|
if (deploymentResult[i].deployed) {
|
|
18
19
|
console.log(`${deploymentParams.contract} successfully deployed:`);
|
|
19
|
-
console.log(` On network: ${
|
|
20
|
+
console.log(` On network: ${network}`);
|
|
20
21
|
console.log(` At address: ${deploymentResult[i].address}`);
|
|
21
22
|
console.log(` At block: ${deploymentResult[i].receipt.blockNumber}`);
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
if ((0, utils_1.isContractDeployed)(deploymentParams.contract,
|
|
25
|
+
if ((0, utils_1.isContractDeployed)(deploymentParams.contract, network, deploymentResult[i].address)) {
|
|
25
26
|
console.log(`${deploymentParams.contract} already deployed:`);
|
|
26
|
-
console.log(` On network: ${
|
|
27
|
+
console.log(` On network: ${network}`);
|
|
27
28
|
console.log(` At address: ${deploymentResult[i].address}`);
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
31
|
console.log(`${deploymentParams.contract} has not been deployed:`);
|
|
31
|
-
console.log(` On network: ${
|
|
32
|
+
console.log(` On network: ${network}`);
|
|
32
33
|
console.log(` Error: ${deploymentResult[i].error}`);
|
|
33
34
|
console.log(` Hint: Check admin wallet balance and that your artifacts are up to date`);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
}
|
|
37
|
+
});
|
|
37
38
|
return deploymentResult[0].address;
|
|
38
39
|
});
|
|
39
40
|
exports.deployOneWithCreate2 = deployOneWithCreate2;
|
|
@@ -80,12 +81,14 @@ const deployWithCreate2FromList = (hre) => tslib_1.__awaiter(void 0, void 0, voi
|
|
|
80
81
|
case 'ERC20EscrowToPay':
|
|
81
82
|
case 'ERC20TransferableReceivable': {
|
|
82
83
|
const network = hre.config.xdeploy.networks[0];
|
|
84
|
+
currency_1.EvmChains.assertChainSupported(network);
|
|
83
85
|
const constructorArgs = (0, constructor_args_1.getConstructorArgs)(contract, network);
|
|
84
86
|
yield (0, exports.deployOneWithCreate2)({ contract, constructorArgs }, hre);
|
|
85
87
|
break;
|
|
86
88
|
}
|
|
87
89
|
case 'BatchConversionPayments': {
|
|
88
90
|
const network = hre.config.xdeploy.networks[0];
|
|
91
|
+
currency_1.EvmChains.assertChainSupported(network);
|
|
89
92
|
const constructorArgs = (0, constructor_args_1.getConstructorArgs)(contract, network);
|
|
90
93
|
const address = yield (0, exports.deployOneWithCreate2)({ contract, constructorArgs }, hre);
|
|
91
94
|
yield (0, contract_setup_1.setupBatchConversionPayments)(address, hre);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../scripts-create2/deploy.ts"],"names":[],"mappings":";;;;AAAA,mCAA4E;
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../scripts-create2/deploy.ts"],"names":[],"mappings":";;;;AAAA,mCAA4E;AAE5E,2CAAsC;AACtC,yDAAwD;AACxD,qDAO0B;AAC1B,uDAAqD;AAErD,wDAAwD;AACjD,MAAM,oBAAoB,GAAG,CAClC,gBAAmC,EACnC,GAAsC,EACrB,EAAE;IACnB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5E,MAAM,I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CAAC,CAAC;gBAC9B,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC/C,oBAAS,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBACxC,MAAM,eAAe,GAAG,IAAA,qCAAkB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAC9D,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAoB,EAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,GAAG,CAAC,CAAC;gBAC/E,MAAM,IAAA,6CAA4B,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBACjD,MAAM;aACP;YACD,oCAAoC;YACpC;gBACE,MAAM,IAAI,KAAK,CAAC,gBAAgB,QAAQ,iDAAiD,CAAC,CAAC;SAC9F;KACF;AACH,CAAC,CAAA,CAAC;AA/DW,QAAA,yBAAyB,6BA+DpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenderly.d.ts","sourceRoot":"","sources":["../../scripts-create2/tenderly.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,SAAS,CAAC;AA6C5D,eAAO,MAAM,iBAAiB,QAAe,iCAAiC,KAAG,QAAQ,IAAI,CA+D5F,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tenderlyImportAll = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const artifacts = require("../src/lib/artifacts");
|
|
6
|
+
const console = require("console");
|
|
7
|
+
const axios_1 = require("axios");
|
|
8
|
+
const currency_1 = require("@requestnetwork/currency");
|
|
9
|
+
const getTenderlyAxiosInstance = (hre) => {
|
|
10
|
+
return axios_1.default.create({
|
|
11
|
+
baseURL: 'https://api.tenderly.co',
|
|
12
|
+
headers: {
|
|
13
|
+
'X-Access-Key': hre.config.tenderly.accessKey,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
18
|
+
/**
|
|
19
|
+
* Chains supported by Tenderly.
|
|
20
|
+
* Supported testnet chains are commented out.
|
|
21
|
+
*/
|
|
22
|
+
const supportedTenderlyChains = [
|
|
23
|
+
'arbitrum-one',
|
|
24
|
+
'arbitrum-rinkeby',
|
|
25
|
+
'avalanche',
|
|
26
|
+
'bsc',
|
|
27
|
+
'fantom',
|
|
28
|
+
'goerli',
|
|
29
|
+
'mainnet',
|
|
30
|
+
'matic',
|
|
31
|
+
'moonbeam',
|
|
32
|
+
'mumbai',
|
|
33
|
+
'optimism',
|
|
34
|
+
'rinkeby',
|
|
35
|
+
'xdai',
|
|
36
|
+
];
|
|
37
|
+
const getTenderlyContractId = (c) => `eth:${c.chainId}:${c.address.toLowerCase()}`;
|
|
38
|
+
const tenderlyImportAll = (hre) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
try {
|
|
41
|
+
const { username, project } = hre.config.tenderly;
|
|
42
|
+
const contracts = {};
|
|
43
|
+
const mainnetContracts = new Set();
|
|
44
|
+
const testnetContracts = new Set();
|
|
45
|
+
const versions = {};
|
|
46
|
+
for (const artifactName in artifacts) {
|
|
47
|
+
const artifact = artifacts[artifactName];
|
|
48
|
+
const deployments = artifact.getAllAddressesFromAllNetworks();
|
|
49
|
+
for (const deployment of deployments) {
|
|
50
|
+
const { networkName, address, version } = deployment;
|
|
51
|
+
if (!supportedTenderlyChains.includes(networkName))
|
|
52
|
+
continue;
|
|
53
|
+
const chainId = currency_1.EvmChains.getChainId(networkName);
|
|
54
|
+
const contract = {
|
|
55
|
+
address,
|
|
56
|
+
chainId,
|
|
57
|
+
};
|
|
58
|
+
const contractId = getTenderlyContractId(contract);
|
|
59
|
+
contracts[contractId] = Object.assign({ name: capitalizeFirstLetter(artifactName.replace(/Artifact/i, '')) }, contract);
|
|
60
|
+
(_a = versions[version]) !== null && _a !== void 0 ? _a : (versions[version] = new Set());
|
|
61
|
+
versions[version].add(contractId);
|
|
62
|
+
(currency_1.EvmChains.isTestnet(networkName) ? testnetContracts : mainnetContracts).add(contractId);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
console.log(`> Retrieved ${Object.keys(contracts).length} contracts from protocol artifacts`);
|
|
66
|
+
console.log(`> Syncing contracts with Tenderly...`);
|
|
67
|
+
const axiosInstance = getTenderlyAxiosInstance(hre);
|
|
68
|
+
yield axiosInstance.post(`/api/v2/accounts/${username}/projects/${project}/contracts`, {
|
|
69
|
+
contracts: Object.values(contracts).map((contract) => ({
|
|
70
|
+
address: contract.address,
|
|
71
|
+
display_name: contract.name,
|
|
72
|
+
network_id: contract.chainId.toString(),
|
|
73
|
+
})),
|
|
74
|
+
});
|
|
75
|
+
console.log(' ✔ done');
|
|
76
|
+
console.log(`> Adding version tags to contracts...`);
|
|
77
|
+
for (const version in versions) {
|
|
78
|
+
yield axiosInstance.post(`/api/v1/account/${username}/project/${project}/tag`, {
|
|
79
|
+
contract_ids: Array.from(versions[version]),
|
|
80
|
+
tag: `v${version}`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
console.log(' ✔ done');
|
|
84
|
+
console.log(`> Adding mainnet/testnet tags to contracts...`);
|
|
85
|
+
yield axiosInstance.post(`/api/v1/account/${username}/project/${project}/tag`, {
|
|
86
|
+
contract_ids: Array.from(mainnetContracts),
|
|
87
|
+
tag: 'mainnet',
|
|
88
|
+
});
|
|
89
|
+
yield axiosInstance.post(`/api/v1/account/${username}/project/${project}/tag`, {
|
|
90
|
+
contract_ids: Array.from(testnetContracts),
|
|
91
|
+
tag: 'testnet',
|
|
92
|
+
});
|
|
93
|
+
console.log(' ✔ done');
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
console.error('Error while adding contract(s) to Tenderly', ((_b = err.response) === null || _b === void 0 ? void 0 : _b.data) || err);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
exports.tenderlyImportAll = tenderlyImportAll;
|
|
100
|
+
//# sourceMappingURL=tenderly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenderly.js","sourceRoot":"","sources":["../../scripts-create2/tenderly.ts"],"names":[],"mappings":";;;;AACA,kDAAkD;AAGlD,mCAAmC;AACnC,iCAA0B;AAC1B,uDAAqD;AAGrD,MAAM,wBAAwB,GAAG,CAAC,GAAsC,EAAE,EAAE;IAC1E,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,yBAAyB;QAClC,OAAO,EAAE;YACP,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS;SAC9C;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnG;;;GAGG;AACH,MAAM,uBAAuB,GAAiC;IAC5D,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,UAAU;IACV,QAAQ;IACR,UAAU;IACV,SAAS;IACT,MAAM;CACP,CAAC;AAIF,MAAM,qBAAqB,GAAG,CAAC,CAAmB,EAAE,EAAE,CACpD,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;AAEzC,MAAM,iBAAiB,GAAG,CAAO,GAAsC,EAAiB,EAAE;;IAC/F,IAAI;QACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;QAClD,MAAM,SAAS,GAAwD,E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,CAAC,gBAAgB,CAAC;YAC1C,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;KACzB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,CAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,KAAI,GAAG,CAAC,CAAC;KACxF;AACH,CAAC,CAAA,CAAC;AA/DW,QAAA,iBAAiB,qBA+D5B"}
|
|
@@ -12,6 +12,11 @@ export type HardhatRuntimeEnvironmentExtended = HardhatRuntimeEnvironment & {
|
|
|
12
12
|
deployerAddress: string;
|
|
13
13
|
gasLimit?: number;
|
|
14
14
|
};
|
|
15
|
+
tenderly: {
|
|
16
|
+
project: string;
|
|
17
|
+
username: string;
|
|
18
|
+
accessKey: string;
|
|
19
|
+
};
|
|
15
20
|
};
|
|
16
21
|
};
|
|
17
22
|
export interface IDeploymentResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../scripts-create2/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,MAAM,iCAAiC,GAAG,yBAAyB,GAAG;IAC1E,MAAM,EAAE;QACN,OAAO,EAAE;YACP,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,MAAM,CAAC;YACf,eAAe,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../scripts-create2/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9B;AAED,MAAM,MAAM,iCAAiC,GAAG,yBAAyB,GAAG;IAC1E,MAAM,EAAE;QACN,OAAO,EAAE;YACP,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YACxB,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE,MAAM,CAAC;YACf,eAAe,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,CAAC;QACF,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B"}
|
|
@@ -12,7 +12,7 @@ export declare const create2ContractDeploymentList: string[];
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const getArtifact: (contract: string) => artifacts.ContractArtifact<Contract>;
|
|
14
14
|
/**
|
|
15
|
-
* Check if a contract has already been
|
|
15
|
+
* Check if a contract has already been deployed on a specific network at a specific address
|
|
16
16
|
* @param contract name of the contract
|
|
17
17
|
* @param network name of the network
|
|
18
18
|
* @param computedAddress address to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../scripts-create2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../scripts-create2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAGxC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,UAWzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,aAAc,MAAM,KAAG,UAAU,gBAAgB,CAAC,QAAQ,CAiCjF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,WACP,MAAM,mBACE,MAAM,KACtB,OASF,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isContractDeployed = exports.getArtifact = exports.create2ContractDeploymentList = void 0;
|
|
4
4
|
const artifacts = require("../src/lib");
|
|
5
|
+
const currency_1 = require("@requestnetwork/currency");
|
|
5
6
|
/**
|
|
6
7
|
* List of smart contract that we deploy using the CREATE2 scheme through the Request Deployer contract
|
|
7
8
|
* By default all smart contracts from bellow will get deployed.
|
|
@@ -59,16 +60,22 @@ const getArtifact = (contract) => {
|
|
|
59
60
|
};
|
|
60
61
|
exports.getArtifact = getArtifact;
|
|
61
62
|
/**
|
|
62
|
-
* Check if a contract has already been
|
|
63
|
+
* Check if a contract has already been deployed on a specific network at a specific address
|
|
63
64
|
* @param contract name of the contract
|
|
64
65
|
* @param network name of the network
|
|
65
66
|
* @param computedAddress address to check
|
|
66
67
|
* @returns a boolean
|
|
67
68
|
*/
|
|
68
69
|
const isContractDeployed = (contract, network, computedAddress) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
try {
|
|
71
|
+
currency_1.EvmChains.assertChainSupported(network);
|
|
72
|
+
const contractArtifact = (0, exports.getArtifact)(contract);
|
|
73
|
+
const addresses = contractArtifact.getAllAddresses(network);
|
|
74
|
+
return addresses.some((x) => x.address === computedAddress);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
72
79
|
};
|
|
73
80
|
exports.isContractDeployed = isContractDeployed;
|
|
74
81
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../scripts-create2/utils.ts"],"names":[],"mappings":";;;AACA,wCAAwC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../scripts-create2/utils.ts"],"names":[],"mappings":";;;AACA,wCAAwC;AACxC,uDAAqD;AAErD;;;;GAIG;AACU,QAAA,6BAA6B,GAAG;IAC3C;;;;uBAImB;IACnB,gBAAgB;IAChB;;iCAE6B;IAC7B,6BAA6B;CAC9B,CAAC;AAEF;;;GAGG;AACI,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAwC,EAAE;IACpF,QAAQ,QAAQ,EAAE;QAChB,KAAK,oBAAoB;YACvB,OAAO,SAAS,CAAC,0BAA0B,CAAC;QAC9C,KAAK,0BAA0B;YAC7B,OAAO,SAAS,CAAC,4BAA4B,CAAC;QAChD,KAAK,YAAY;YACf,OAAO,SAAS,CAAC,kBAAkB,CAAC;QACtC,KAAK,eAAe;YAClB,OAAO,SAAS,CAAC,qBAAqB,CAAC;QACzC,KAAK,eAAe;YAClB,OAAO,SAAS,CAAC,qBAAqB,CAAC;QACzC,KAAK,kBAAkB;YACrB,OAAO,SAAS,CAA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imeEnvironmentExtended, IDeploymentParams } from './types';
|
|
3
2
|
export declare const verifyOne: (contractAddress: string, deploymentParams: IDeploymentParams, hre: HardhatRuntimeEnvironmentExtended) => Promise<void>;
|
|
4
3
|
export declare function VerifyCreate2FromList(hre: HardhatRuntimeEnvironmentExtended): Promise<void>;
|
|
5
4
|
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../scripts-create2/verify.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../scripts-create2/verify.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI/E,eAAO,MAAM,SAAS,oBACH,MAAM,oBACL,iBAAiB,OAC9B,iCAAiC,KACrC,QAAQ,IAAI,CASd,CAAC;AAEF,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDjG"}
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const compute_one_address_1 = require("./compute-one-address");
|
|
6
6
|
const constructor_args_1 = require("./constructor-args");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
+
const currency_1 = require("@requestnetwork/currency");
|
|
8
9
|
const verifyOne = (contractAddress, deploymentParams, hre) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
10
|
try {
|
|
10
11
|
yield hre.run('verify:verify', {
|
|
@@ -46,6 +47,7 @@ function VerifyCreate2FromList(hre) {
|
|
|
46
47
|
case 'BatchConversionPayments':
|
|
47
48
|
case 'ERC20TransferableReceivable': {
|
|
48
49
|
const network = hre.config.xdeploy.networks[0];
|
|
50
|
+
currency_1.EvmChains.assertChainSupported(network);
|
|
49
51
|
const constructorArgs = (0, constructor_args_1.getConstructorArgs)(contract, network);
|
|
50
52
|
address = yield (0, compute_one_address_1.computeCreate2DeploymentAddress)({ contract, constructorArgs }, hre);
|
|
51
53
|
yield (0, exports.verifyOne)(address, { contract, constructorArgs }, hre);
|
|
@@ -53,7 +55,7 @@ function VerifyCreate2FromList(hre) {
|
|
|
53
55
|
}
|
|
54
56
|
// Other cases to add when necessary
|
|
55
57
|
default:
|
|
56
|
-
throw new Error(`The
|
|
58
|
+
throw new Error(`The contract ${contract} is not to be deployed using the CREATE2 scheme`);
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../scripts-create2/verify.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,yDAAwD;
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../scripts-create2/verify.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,yDAAwD;AAExD,mCAAwD;AACxD,uDAAqD;AAE9C,MAAM,SAAS,GAAG,CACvB,eAAuB,EACvB,gBAAmC,EACnC,GAAsC,EACvB,EAAE;IACjB,IAAI;QACF,MAAM,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE;YAC7B,OAAO,EAAE,eAAe;YACxB,oBAAoB,EAAE,gBAAgB,CAAC,eAAe;SACvD,CAAC,CAAC;KACJ;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAClB;AACH,CAAC,CAAA,CAAC;AAbW,QAAA,SAAS,aAapB;AAEF,SAAsB,qBAAqB,CAAC,GAAsC;;QAChF,IAAI;YACF;;;eAGG;YACH,MAAM,KAAK,GAAG,GAAG,EAAE;gBACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;oBAC7B,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC3B,CAAC,CAAC,CAAC;YACL,CAAC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|
|
|
1
1
|
import { Contract, providers, Signer } from 'ethers';
|
|
2
2
|
import type { JsonFragment } from '@ethersproject/abi';
|
|
3
|
+
import type { CurrencyTypes } from '@requestnetwork/types';
|
|
3
4
|
/**
|
|
4
5
|
* Contract information specific to a network
|
|
5
6
|
*/
|
|
@@ -10,12 +11,12 @@ export type ArtifactNetworkInfo = {
|
|
|
10
11
|
creationBlockNumber: number;
|
|
11
12
|
};
|
|
12
13
|
/** Deployment information and ABI per network */
|
|
13
|
-
export type ArtifactDeploymentInfo<TNetwork extends
|
|
14
|
+
export type ArtifactDeploymentInfo<TNetwork extends CurrencyTypes.EvmChainName = CurrencyTypes.EvmChainName> = {
|
|
14
15
|
abi: JsonFragment[];
|
|
15
|
-
deployment: Record<TNetwork, ArtifactNetworkInfo
|
|
16
|
+
deployment: Partial<Record<TNetwork, ArtifactNetworkInfo>>;
|
|
16
17
|
};
|
|
17
18
|
/** Deployment information and ABI per version and network */
|
|
18
|
-
export type ArtifactInfo<TVersion extends string = string, TNetwork extends
|
|
19
|
+
export type ArtifactInfo<TVersion extends string = string, TNetwork extends CurrencyTypes.EvmChainName = CurrencyTypes.EvmChainName> = Record<TVersion, ArtifactDeploymentInfo<TNetwork>>;
|
|
19
20
|
export type DeploymentInformation = {
|
|
20
21
|
address: string;
|
|
21
22
|
creationBlockNumber: number;
|
|
@@ -27,11 +28,11 @@ export type DeploymentInformation = {
|
|
|
27
28
|
export declare class ContractArtifact<TContract extends Contract> {
|
|
28
29
|
private info;
|
|
29
30
|
private lastVersion;
|
|
30
|
-
constructor(info: ArtifactInfo
|
|
31
|
+
constructor(info: ArtifactInfo, lastVersion: string);
|
|
31
32
|
/**
|
|
32
33
|
* Returns an ethers contract instance for the given `networkName`
|
|
33
34
|
*/
|
|
34
|
-
connect(networkName:
|
|
35
|
+
connect(networkName: CurrencyTypes.EvmChainName, signerOrProvider: Signer | providers.Provider, version?: string): TContract;
|
|
35
36
|
getInterface(): TContract['interface'];
|
|
36
37
|
/**
|
|
37
38
|
* Retrieve the abi from the artifact of the used version
|
|
@@ -44,15 +45,24 @@ export declare class ContractArtifact<TContract extends Contract> {
|
|
|
44
45
|
* @param networkName the name of the network where the contract is deployed
|
|
45
46
|
* @returns the address of the deployed contract
|
|
46
47
|
*/
|
|
47
|
-
getAddress(networkName:
|
|
48
|
+
getAddress(networkName: CurrencyTypes.EvmChainName, version?: string): string;
|
|
48
49
|
/**
|
|
49
50
|
* Retrieve all addresses for all versions
|
|
50
51
|
* @param networkName the name of the network where the contract is deployed
|
|
51
52
|
* @returns the addresses of the deployed contract and the associated version.
|
|
52
53
|
*/
|
|
53
|
-
getAllAddresses(networkName:
|
|
54
|
+
getAllAddresses(networkName: CurrencyTypes.EvmChainName): {
|
|
55
|
+
version: string;
|
|
56
|
+
address: string | undefined;
|
|
57
|
+
}[];
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve all addresses for all versions for all networks
|
|
60
|
+
* @returns the addresses of the deployed contract and the associated network and version.
|
|
61
|
+
*/
|
|
62
|
+
getAllAddressesFromAllNetworks(): {
|
|
54
63
|
version: string;
|
|
55
64
|
address: string;
|
|
65
|
+
networkName: CurrencyTypes.EvmChainName;
|
|
56
66
|
}[];
|
|
57
67
|
/**
|
|
58
68
|
* Retrieve the block creation number from the artifact of the used version
|
|
@@ -60,20 +70,20 @@ export declare class ContractArtifact<TContract extends Contract> {
|
|
|
60
70
|
* @param networkName the name of the network where the contract is deployed
|
|
61
71
|
* @returns the number of the block where the contract was deployed
|
|
62
72
|
*/
|
|
63
|
-
getCreationBlockNumber(networkName:
|
|
73
|
+
getCreationBlockNumber(networkName: CurrencyTypes.EvmChainName, version?: string): number;
|
|
64
74
|
/**
|
|
65
75
|
* Retrieve the deployment information from the artifact of the used version
|
|
66
76
|
* deployed into the specified network. Will trow an error if the version of network is incorrect.
|
|
67
77
|
* @param networkName the name of the network where the contract is deployed
|
|
68
78
|
* @returns The address and the number of the creation block
|
|
69
79
|
*/
|
|
70
|
-
getDeploymentInformation(networkName:
|
|
80
|
+
getDeploymentInformation(networkName: CurrencyTypes.EvmChainName, version?: string): DeploymentInformation;
|
|
71
81
|
/**
|
|
72
82
|
* Retrieve the deployment information from the artifact of the used version
|
|
73
83
|
* deployed into the specified network
|
|
74
84
|
* @param networkName the name of the network where the contract is deployed
|
|
75
85
|
* @returns The address and the number of the creation block, or null if not found
|
|
76
86
|
*/
|
|
77
|
-
getOptionalDeploymentInformation(networkName:
|
|
87
|
+
getOptionalDeploymentInformation(networkName: CurrencyTypes.EvmChainName, version?: string): DeploymentInformation | null;
|
|
78
88
|
}
|
|
79
89
|
//# sourceMappingURL=ContractArtifact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractArtifact.d.ts","sourceRoot":"","sources":["../../../src/lib/ContractArtifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ContractArtifact.d.ts","sourceRoot":"","sources":["../../../src/lib/ContractArtifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,sBAAsB,CAChC,QAAQ,SAAS,aAAa,CAAC,YAAY,GAAG,aAAa,CAAC,YAAY,IACtE;IACF,GAAG,EAAE,YAAY,EAAE,CAAC;IACpB,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;;;;OAKG;IACH,sBAAsB,CACpB,WAAW,EAAE,aAAa,CAAC,YAAY,EACvC,OAAO,SAAmB,GACzB,MAAM;IAIT;;;;;OAKG;IACH,wBAAwB,CACtB,WAAW,EAAE,aAAa,CAAC,YAAY,EACvC,OAAO,SAAmB,GACzB,qBAAqB;IAaxB;;;;;OAKG;IACH,gCAAgC,CAC9B,WAAW,EAAE,aAAa,CAAC,YAAY,EACvC,OAAO,SAAmB,GACzB,qBAAqB,GAAG,IAAI;CAGhC"}
|
|
@@ -59,6 +59,28 @@ class ContractArtifact {
|
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Retrieve all addresses for all versions for all networks
|
|
64
|
+
* @returns the addresses of the deployed contract and the associated network and version.
|
|
65
|
+
*/
|
|
66
|
+
getAllAddressesFromAllNetworks() {
|
|
67
|
+
var _a;
|
|
68
|
+
const deployments = [];
|
|
69
|
+
for (const version in this.info) {
|
|
70
|
+
let networkName;
|
|
71
|
+
for (networkName in this.info[version].deployment) {
|
|
72
|
+
const address = (_a = this.info[version].deployment[networkName]) === null || _a === void 0 ? void 0 : _a.address;
|
|
73
|
+
if (!address)
|
|
74
|
+
continue;
|
|
75
|
+
deployments.push({
|
|
76
|
+
version,
|
|
77
|
+
address,
|
|
78
|
+
networkName,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return deployments;
|
|
83
|
+
}
|
|
62
84
|
/**
|
|
63
85
|
* Retrieve the block creation number from the artifact of the used version
|
|
64
86
|
* deployed into the specified network
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractArtifact.js","sourceRoot":"","sources":["../../../src/lib/ContractArtifact.ts"],"names":[],"mappings":";;;AAAA,mCAAqD;
|
|
1
|
+
{"version":3,"file":"ContractArtifact.js","sourceRoot":"","sources":["../../../src/lib/ContractArtifact.ts"],"names":[],"mappings":";;;AAAA,mCAAqD;AAiCrD;;;IAGI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