@superfluid-finance/ethereum-contracts 1.7.2-dev.09f3be3.0 → 1.7.2-dev.2cebc84.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/artifacts/contracts/apps/SuperfluidLoaderLibrary.sol/SuperfluidLoaderLibrary.json +2 -2
- package/build/contracts/AccessControl.json +1 -1
- package/build/contracts/AccessControlEnumerable.json +1 -1
- package/build/contracts/Address.json +1 -1
- package/build/contracts/AgreementBase.json +18 -18
- package/build/contracts/AgreementLibrary.json +165 -165
- package/build/contracts/BaseRelayRecipient.json +57 -57
- package/build/contracts/BatchLiquidator.json +382 -382
- package/build/contracts/BatchOperation.json +614 -614
- package/build/contracts/CFAv1Forwarder.json +1250 -1250
- package/build/contracts/CFAv1ForwarderDeployerLibrary.json +2384 -2384
- package/build/contracts/CFAv1Library.json +389 -389
- package/build/contracts/CallUtils.json +198 -198
- package/build/contracts/ClosingOnUpdateFlowTestApp.json +1525 -1525
- package/build/contracts/ConstantFlowAgreementV1.json +1087 -1087
- package/build/contracts/ConstantInflowNFT.json +402 -402
- package/build/contracts/ConstantOutflowNFT.json +661 -661
- package/build/contracts/Context.json +1 -1
- package/build/contracts/ContextDefinitions.json +614 -614
- package/build/contracts/CustomSuperTokenBase.json +19 -19
- package/build/contracts/ERC165.json +1 -1
- package/build/contracts/ERC1820Implementer.json +1 -1
- package/build/contracts/ERC1820RegistryCompiled.json +22 -22
- package/build/contracts/ERC20.json +1 -1
- package/build/contracts/ERC20WithTokenInfo.json +23 -23
- package/build/contracts/ERC777Helper.json +384 -384
- package/build/contracts/ERC777RecipientDrainingGas.json +863 -863
- package/build/contracts/ERC777RecipientReverting.json +863 -863
- package/build/contracts/EnumerableSet.json +1 -1
- package/build/contracts/EventsEmitter.json +43 -43
- package/build/contracts/ExclusiveInflowTestApp.json +1525 -1525
- package/build/contracts/FixedSizeData.json +200 -200
- package/build/contracts/FlowExchangeTestApp.json +1526 -1526
- package/build/contracts/FlowNFTBase.json +1280 -1280
- package/build/contracts/FlowOperatorDefinitions.json +614 -614
- package/build/contracts/ForwarderBase.json +190 -190
- package/build/contracts/FullUpgradableSuperTokenProxy.json +116 -116
- package/build/contracts/IAccessControl.json +1 -1
- package/build/contracts/IAccessControlEnumerable.json +1 -1
- package/build/contracts/IConstantFlowAgreementV1.json +677 -677
- package/build/contracts/IConstantInflowNFT.json +54 -54
- package/build/contracts/IConstantOutflowNFT.json +107 -107
- package/build/contracts/IDAv1Forwarder.json +912 -912
- package/build/contracts/IDAv1ForwarderDeployerLibrary.json +2384 -2384
- package/build/contracts/IDAv1Library.json +430 -430
- package/build/contracts/IERC165.json +1 -1
- package/build/contracts/IERC1820Implementer.json +1 -1
- package/build/contracts/IERC1820Registry.json +1 -1
- package/build/contracts/IERC20.json +1 -1
- package/build/contracts/IERC20Metadata.json +1 -1
- package/build/contracts/IERC20Permit.json +1 -1
- package/build/contracts/IERC721.json +1 -1
- package/build/contracts/IERC721Metadata.json +1 -1
- package/build/contracts/IERC777.json +1 -1
- package/build/contracts/IERC777Recipient.json +1 -1
- package/build/contracts/IERC777Sender.json +1 -1
- package/build/contracts/IFlowNFTBase.json +115 -115
- package/build/contracts/IInstantDistributionAgreementV1.json +667 -667
- package/build/contracts/IMultiSigWallet.json +31 -31
- package/build/contracts/IPoolAdminNFT.json +7 -7
- package/build/contracts/IPoolMemberNFT.json +7 -7
- package/build/contracts/IPureSuperToken.json +62 -62
- package/build/contracts/IPureSuperTokenCustom.json +62 -62
- package/build/contracts/IRelayRecipient.json +27 -27
- package/build/contracts/IResolver.json +38 -38
- package/build/contracts/ISETH.json +67 -67
- package/build/contracts/ISETHCustom.json +67 -67
- package/build/contracts/ISuperAgreement.json +50 -50
- package/build/contracts/ISuperApp.json +191 -191
- package/build/contracts/ISuperToken.json +695 -695
- package/build/contracts/ISuperTokenFactory.json +225 -225
- package/build/contracts/ISuperfluid.json +904 -904
- package/build/contracts/ISuperfluidGovernance.json +251 -251
- package/build/contracts/ISuperfluidToken.json +407 -407
- package/build/contracts/ITOGAv1.json +1346 -1346
- package/build/contracts/ITOGAv2.json +1346 -1346
- package/build/contracts/ITOGAv3.json +1346 -1346
- package/build/contracts/Initializable.json +1 -1
- package/build/contracts/InstantDistributionAgreementV1.json +594 -594
- package/build/contracts/Math.json +1 -1
- package/build/contracts/NonClosableOutflowTestApp.json +1526 -1526
- package/build/contracts/Ownable.json +1 -1
- package/build/contracts/Proxy.json +1 -1
- package/build/contracts/ProxyDeployerLibrary.json +2382 -2382
- package/build/contracts/PureSuperToken.json +106 -106
- package/build/contracts/Resolver.json +98 -98
- package/build/contracts/SETHProxy.json +224 -224
- package/build/contracts/SafeCast.json +1 -1
- package/build/contracts/SafeERC20.json +1 -1
- package/build/contracts/SafeGasLibrary.json +51 -51
- package/build/contracts/SafeMath.json +1 -1
- package/build/contracts/SelfDeletingFlowTestApp.json +1525 -1525
- package/build/contracts/SlotsBitmapLibrary.json +457 -457
- package/build/contracts/StreamRedirector.json +704 -704
- package/build/contracts/Strings.json +1 -1
- package/build/contracts/SuperAppBase.json +42 -42
- package/build/contracts/SuperAppBaseFlow.json +138 -138
- package/build/contracts/SuperAppDefinitions.json +614 -614
- package/build/contracts/SuperToken.json +2714 -2714
- package/build/contracts/SuperTokenDeployerLibrary.json +2383 -2383
- package/build/contracts/SuperTokenFactory.json +1347 -1347
- package/build/contracts/SuperTokenFactoryBase.json +1329 -1329
- package/build/contracts/SuperTokenV1Library.json +1483 -1483
- package/build/contracts/SuperUpgrader.json +439 -439
- package/build/contracts/Superfluid.json +5196 -5196
- package/build/contracts/SuperfluidCFAv1DeployerLibrary.json +2383 -2383
- package/build/contracts/SuperfluidFrameworkDeployer.json +1260 -1260
- package/build/contracts/SuperfluidFrameworkDeploymentSteps.json +2382 -2382
- package/build/contracts/SuperfluidGovDeployerLibrary.json +2383 -2383
- package/build/contracts/SuperfluidGovernanceBase.json +2449 -2449
- package/build/contracts/SuperfluidGovernanceConfigs.json +614 -614
- package/build/contracts/SuperfluidGovernanceII.json +155 -155
- package/build/contracts/SuperfluidGovernanceIIProxy.json +135 -135
- package/build/contracts/SuperfluidHostDeployerLibrary.json +2382 -2382
- package/build/contracts/SuperfluidIDAv1DeployerLibrary.json +2383 -2383
- package/build/contracts/SuperfluidLoader.json +207 -207
- package/build/contracts/SuperfluidLoaderDeployerLibrary.json +2384 -2384
- package/build/contracts/SuperfluidLoaderLibrary.json +485 -351
- package/build/contracts/SuperfluidNFTLogicDeployerLibrary.json +2387 -2387
- package/build/contracts/SuperfluidPeripheryDeployerLibrary.json +2385 -2385
- package/build/contracts/SuperfluidToken.json +1423 -1423
- package/build/contracts/TOGA.json +1360 -1360
- package/build/contracts/TestGovernance.json +250 -250
- package/build/contracts/TestResolver.json +47 -47
- package/build/contracts/TestToken.json +102 -102
- package/build/contracts/TokenDeployerLibrary.json +2384 -2384
- package/build/contracts/TokenInfo.json +32 -32
- package/build/contracts/UUPSProxiable.json +139 -139
- package/build/contracts/UUPSProxy.json +81 -81
- package/build/contracts/UUPSUtils.json +37 -37
- package/build/contracts-sizes.txt +15 -15
- package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.d.ts +1 -1
- package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.d.ts.map +1 -1
- package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.js +1 -1
- package/build/typechain/factories/contracts/apps/SuperfluidLoaderLibrary__factory.js.map +1 -1
- package/contracts/apps/SuperfluidLoaderLibrary.sol +4 -1
- package/package.json +4 -5
- package/ops-scripts/.eslintrc.js +0 -15
- package/ops-scripts/artifacts/ERC1820Registry.json +0 -5
- package/ops-scripts/deploy-aux-contracts.js +0 -99
- package/ops-scripts/deploy-deterministically.js +0 -169
- package/ops-scripts/deploy-erc1820.js +0 -83
- package/ops-scripts/deploy-framework.js +0 -895
- package/ops-scripts/deploy-mfa.ts +0 -27
- package/ops-scripts/deploy-super-token.js +0 -206
- package/ops-scripts/deploy-test-environment.js +0 -98
- package/ops-scripts/deploy-test-token.js +0 -86
- package/ops-scripts/deploy-unlisted-pure-super-token.js +0 -69
- package/ops-scripts/deploy-unlisted-super-token.js +0 -68
- package/ops-scripts/gov-create-new-app-registration-key.js +0 -75
- package/ops-scripts/gov-create-new-factory-registration.js +0 -49
- package/ops-scripts/gov-set-3Ps-config.js +0 -67
- package/ops-scripts/gov-set-reward-address.js +0 -60
- package/ops-scripts/gov-set-token-min-deposit.js +0 -53
- package/ops-scripts/gov-set-trusted-forwarder.js +0 -80
- package/ops-scripts/gov-transfer-framework-ownership.js +0 -90
- package/ops-scripts/gov-upgrade-governance.js +0 -87
- package/ops-scripts/gov-upgrade-super-token-logic.js +0 -193
- package/ops-scripts/info-inspect-account.js +0 -118
- package/ops-scripts/info-list-apps.js +0 -55
- package/ops-scripts/info-print-contract-addresses.js +0 -136
- package/ops-scripts/info-scan-deployments.js +0 -63
- package/ops-scripts/info-show-protocol.js +0 -400
- package/ops-scripts/libs/common.js +0 -436
- package/ops-scripts/libs/getConfig.js +0 -289
- package/ops-scripts/libs/truffleScriptRunnerFactory.js +0 -97
- package/ops-scripts/resolver-list-super-token.js +0 -73
- package/ops-scripts/resolver-register-token.js +0 -72
- package/ops-scripts/resolver-reset-deployment.js +0 -54
- package/ops-scripts/resolver-set-key-value.js +0 -69
- package/ops-scripts/resolver-unlist-super-token.js +0 -61
- package/ops-scripts/tmp-trigger-token-transfer.js +0 -33
- package/ops-scripts/validate-nft-addresses.ts +0 -49
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
const {getScriptRunnerFactory: S} = require("./libs/common");
|
|
2
|
-
|
|
3
|
-
const SuperfluidSDK = require("@superfluid-finance/js-sdk");
|
|
4
|
-
const Resolver = artifacts.require("Resolver");
|
|
5
|
-
|
|
6
|
-
const SuperfluidLoader = artifacts.require("SuperfluidLoader");
|
|
7
|
-
const CFAv1Forwarder = artifacts.require("CFAv1Forwarder");
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @dev Deploy specified contract at a deterministic address (defined by sender, nonce)
|
|
11
|
-
* This facilitates deployment of the contract at the same address across networks.
|
|
12
|
-
* In order to make this easy, the script takes a private key of the deployer account and funds it.
|
|
13
|
-
* Recommendation: create a new account (guaranteed to be at nonce 1 everywhere) for the deployer.
|
|
14
|
-
*
|
|
15
|
-
* Note: fee estimation does currently not work on optimism (mainnet and testnets).
|
|
16
|
-
* It's unknown how to do an estimation of the overall cost (L1 and L2).
|
|
17
|
-
* Solution: manually pre-fund the deployer account.
|
|
18
|
-
*
|
|
19
|
-
* @param web3 The web3 instance to be used
|
|
20
|
-
* @param from address to use for funding the deployer account
|
|
21
|
-
*
|
|
22
|
-
* Usage: npx truffle exec ops-scripts/deploy-deterministically.js : {CONTRACT NAME} [{NONCE}]
|
|
23
|
-
* CONTRACT NAME must be one of SuperfluidLoader, AgreementForwarder
|
|
24
|
-
* If NONCE is not defined, 0 is assumed (-> first tx done from the deployer account)
|
|
25
|
-
*
|
|
26
|
-
* Required ENV var: DETERMINISTIC_DEPLOYER_PK
|
|
27
|
-
*
|
|
28
|
-
* (optional) ENV vars:
|
|
29
|
-
* GAS_LIMIT: override the gas limit for networks with misbehaving estimation
|
|
30
|
-
* GAS_PRICE: override the estimated gas price
|
|
31
|
-
* EST_TX_COST: override the estimated tx cost (amount to be sent to deployer)
|
|
32
|
-
* for networks with different cost derivation structure (Optimism)
|
|
33
|
-
*/
|
|
34
|
-
module.exports = eval(`(${S.toString()})()`)(async function (
|
|
35
|
-
args,
|
|
36
|
-
options = {}
|
|
37
|
-
) {
|
|
38
|
-
let {protocolReleaseVersion} = options;
|
|
39
|
-
|
|
40
|
-
console.log("======== Deploying deterministically ========");
|
|
41
|
-
|
|
42
|
-
let nonce = 0;
|
|
43
|
-
if (args.length === 2) {
|
|
44
|
-
nonce = parseInt(args.pop());
|
|
45
|
-
if (nonce < 0) {
|
|
46
|
-
console.error("nonce must be >= 0");
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
} else if (args.length !== 1) {
|
|
50
|
-
throw new Error("Wrong number of arguments");
|
|
51
|
-
}
|
|
52
|
-
const contractName = args.pop();
|
|
53
|
-
|
|
54
|
-
const privKey = process.env.DETERMINISTIC_DEPLOYER_PK;
|
|
55
|
-
const deployer = web3.eth.accounts.privateKeyToAccount(privKey);
|
|
56
|
-
console.log("deployer:", deployer.address);
|
|
57
|
-
console.log("nonce:", nonce);
|
|
58
|
-
|
|
59
|
-
const chainId = await web3.eth.getChainId();
|
|
60
|
-
const resolverAddr = SuperfluidSDK.getConfig(
|
|
61
|
-
chainId,
|
|
62
|
-
protocolReleaseVersion
|
|
63
|
-
).resolverAddress;
|
|
64
|
-
console.log("resolver addr:", resolverAddr);
|
|
65
|
-
const resolver = await Resolver.at(resolverAddr);
|
|
66
|
-
const hostAddr = await resolver.get(`Superfluid.${protocolReleaseVersion}`);
|
|
67
|
-
console.log("host addr:", hostAddr);
|
|
68
|
-
|
|
69
|
-
let ContractArtifact;
|
|
70
|
-
let deployArgs;
|
|
71
|
-
if (contractName === "SuperfluidLoader") {
|
|
72
|
-
ContractArtifact = SuperfluidLoader;
|
|
73
|
-
deployArgs = [resolverAddr];
|
|
74
|
-
console.log(
|
|
75
|
-
`setting up SuperfluidLoader for chainId ${chainId}, resolver ${resolverAddr}`
|
|
76
|
-
);
|
|
77
|
-
} else if (contractName === "CFAv1Forwarder") {
|
|
78
|
-
ContractArtifact = CFAv1Forwarder;
|
|
79
|
-
deployArgs = [hostAddr];
|
|
80
|
-
console.log(
|
|
81
|
-
`setting up CFAv1Forwarder for chainId ${chainId}, host ${hostAddr}`
|
|
82
|
-
);
|
|
83
|
-
} else {
|
|
84
|
-
throw new Error("Contract unknown / not supported");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const deployerTxCnt = await web3.eth.getTransactionCount(deployer.address);
|
|
88
|
-
if (nonce !== deployerTxCnt) {
|
|
89
|
-
console.error(
|
|
90
|
-
`### ERR: requested nonce is ${nonce}, but next usable nonce is ${deployerTxCnt}`
|
|
91
|
-
);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const deployerBalance = await web3.eth.getBalance(deployer.address);
|
|
96
|
-
console.log("deployer balance:", web3.utils.fromWei(deployerBalance));
|
|
97
|
-
|
|
98
|
-
const gasPrice = process.env.GAS_PRICE || (await web3.eth.getGasPrice());
|
|
99
|
-
console.log("gas price:", gasPrice);
|
|
100
|
-
|
|
101
|
-
const Contract = new web3.eth.Contract(ContractArtifact.abi);
|
|
102
|
-
const deployTx = Contract.deploy({
|
|
103
|
-
data: ContractArtifact.bytecode,
|
|
104
|
-
arguments: deployArgs,
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const gasLimit = process.env.GAS_LIMIT || (await deployTx.estimateGas());
|
|
108
|
-
console.log("gas limit:", gasLimit);
|
|
109
|
-
|
|
110
|
-
const deployCode = deployTx.encodeABI();
|
|
111
|
-
|
|
112
|
-
const BN = web3.utils.BN;
|
|
113
|
-
// calc delta between deployer balance and estimated deployment cost
|
|
114
|
-
// On Optimism, this won't reflect the actual cost bcs of missing L1 component, see https://community.optimism.io/docs/developers/build/transaction-fees/#estimating-the-total-fee
|
|
115
|
-
const estTxCost = process.env.EST_TX_COST
|
|
116
|
-
? new BN(process.env.EST_TX_COST)
|
|
117
|
-
: new BN(gasLimit).mul(new BN(gasPrice));
|
|
118
|
-
console.log("estimated tx cost:", estTxCost.toString());
|
|
119
|
-
const missingBalance = estTxCost.sub(new BN(deployerBalance));
|
|
120
|
-
if (missingBalance.gt(new BN(0))) {
|
|
121
|
-
console.log("deployer missing balance", missingBalance.toString());
|
|
122
|
-
console.log("sending funding tx...");
|
|
123
|
-
const fundingTxObj = {
|
|
124
|
-
from: options.from || (await web3.eth.getAccounts())[0],
|
|
125
|
-
to: deployer.address,
|
|
126
|
-
value: missingBalance,
|
|
127
|
-
};
|
|
128
|
-
if (process.env.GAS_PRICE !== undefined) {
|
|
129
|
-
fundingTxObj.gasPrice = gasPrice;
|
|
130
|
-
}
|
|
131
|
-
const fundingTx = await web3.eth.sendTransaction(fundingTxObj);
|
|
132
|
-
|
|
133
|
-
console.log(
|
|
134
|
-
`funded deployer account in tx ${fundingTx.transactionHash}`
|
|
135
|
-
);
|
|
136
|
-
} else {
|
|
137
|
-
console.log("deployer account is already sufficiently funded");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// check if EIP-1559 enabled
|
|
141
|
-
const lastBlock = await web3.eth.getBlock(await web3.eth.getBlockNumber());
|
|
142
|
-
const hasEip1559 = lastBlock.baseFeePerGas !== undefined;
|
|
143
|
-
|
|
144
|
-
const unsignedTx = {
|
|
145
|
-
data: deployCode,
|
|
146
|
-
gas: gasLimit,
|
|
147
|
-
nonce,
|
|
148
|
-
};
|
|
149
|
-
if (hasEip1559) {
|
|
150
|
-
console.log("creating EIP-1559 tx");
|
|
151
|
-
unsignedTx.maxFeePerGas = gasPrice;
|
|
152
|
-
unsignedTx.maxPriorityFeePerGas = gasPrice; // may cause overpaying, but not a big deal here
|
|
153
|
-
} else {
|
|
154
|
-
console.log("creating non-EIP-1559 tx");
|
|
155
|
-
unsignedTx.gasPrice = gasPrice;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const signedTx = await web3.eth.accounts.signTransaction(
|
|
159
|
-
unsignedTx,
|
|
160
|
-
privKey
|
|
161
|
-
);
|
|
162
|
-
console.log("signed tx with tx hash:", signedTx.transactionHash);
|
|
163
|
-
|
|
164
|
-
console.log("sending deploy tx...");
|
|
165
|
-
const deployTxReceipt = await web3.eth.sendSignedTransaction(
|
|
166
|
-
signedTx.rawTransaction
|
|
167
|
-
);
|
|
168
|
-
console.log("contract deployed at:", deployTxReceipt.contractAddress);
|
|
169
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Adapted from https://github.com/0xjac/ERC1820/blob/master/js/deployment.js
|
|
2
|
-
const assert = require("assert").strict;
|
|
3
|
-
|
|
4
|
-
const Transaction = require("ethereumjs-tx").Transaction;
|
|
5
|
-
const ethUtils = require("ethereumjs-util");
|
|
6
|
-
// TODO: this is a weird dependency, should probably get this from elsewhere
|
|
7
|
-
const ERC1820Registry = require("./artifacts/ERC1820Registry.json");
|
|
8
|
-
const {getScriptRunnerFactory: S, hasCode} = require("./libs/common");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @dev Deploy ERC1820 to the network.
|
|
12
|
-
* @param web3 The web3 to be used
|
|
13
|
-
* @param from address to deploy contracts from
|
|
14
|
-
*
|
|
15
|
-
* Usage: npx truffle exec ops-scripts/deploy-erc1820.js
|
|
16
|
-
*/
|
|
17
|
-
module.exports = eval(`(${S.toString()})({skipArgv: true})`)(async function (
|
|
18
|
-
args,
|
|
19
|
-
options = {}
|
|
20
|
-
) {
|
|
21
|
-
web3 = web3 || options.web3;
|
|
22
|
-
|
|
23
|
-
const rawTransaction = {
|
|
24
|
-
nonce: 0,
|
|
25
|
-
gasPrice: 100000000000,
|
|
26
|
-
value: 0,
|
|
27
|
-
data: "0x" + ERC1820Registry.bin,
|
|
28
|
-
gasLimit: 800000,
|
|
29
|
-
v: 27,
|
|
30
|
-
r: "0x1820182018201820182018201820182018201820182018201820182018201820",
|
|
31
|
-
s: "0x1820182018201820182018201820182018201820182018201820182018201820",
|
|
32
|
-
};
|
|
33
|
-
const tx = new Transaction(rawTransaction);
|
|
34
|
-
const res = {
|
|
35
|
-
sender: ethUtils.toChecksumAddress(
|
|
36
|
-
"0x" + tx.getSenderAddress().toString("hex")
|
|
37
|
-
),
|
|
38
|
-
rawTx: "0x" + tx.serialize().toString("hex"),
|
|
39
|
-
contractAddr: ethUtils.toChecksumAddress(
|
|
40
|
-
"0x" +
|
|
41
|
-
ethUtils
|
|
42
|
-
.generateAddress(
|
|
43
|
-
tx.getSenderAddress(),
|
|
44
|
-
ethUtils.toBuffer(0)
|
|
45
|
-
)
|
|
46
|
-
.toString("hex")
|
|
47
|
-
),
|
|
48
|
-
};
|
|
49
|
-
assert.equal("0xa990077c3205cbDf861e17Fa532eeB069cE9fF96", res.sender);
|
|
50
|
-
assert.equal(
|
|
51
|
-
"0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24",
|
|
52
|
-
res.contractAddr
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
console.log("Checking ERC1820 deployment at", res.contractAddr);
|
|
56
|
-
if (!(await hasCode(web3, res.contractAddr))) {
|
|
57
|
-
console.log("Deploying...");
|
|
58
|
-
const account = options.from || (await web3.eth.getAccounts())[0];
|
|
59
|
-
console.log("Step 1: send ETH");
|
|
60
|
-
// NOTE: we estimate gas when running test coverage w/ hardhat
|
|
61
|
-
// otherwise there is a weird bug which requires the user to have
|
|
62
|
-
// over 2k ETH to send the transaction
|
|
63
|
-
const estimatedGasObject = {
|
|
64
|
-
from: account,
|
|
65
|
-
to: res.sender,
|
|
66
|
-
value: "100000000000000000", //web3.utils.toWei(0.1)
|
|
67
|
-
};
|
|
68
|
-
if (process.env.IS_HARDHAT) {
|
|
69
|
-
const estimatedGas = await web3.eth.estimateGas(estimatedGasObject);
|
|
70
|
-
await web3.eth.sendTransaction({
|
|
71
|
-
...estimatedGasObject,
|
|
72
|
-
gas: estimatedGas,
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
await web3.eth.sendTransaction(estimatedGasObject);
|
|
76
|
-
}
|
|
77
|
-
console.log("Step 2: send signed transaction");
|
|
78
|
-
await web3.eth.sendSignedTransaction(res.rawTx);
|
|
79
|
-
console.log("Deployment done.");
|
|
80
|
-
} else {
|
|
81
|
-
console.log("ERC1820 is already deployed.");
|
|
82
|
-
}
|
|
83
|
-
});
|