Skip to content

Commit fe700ad

Browse files
committed
indent fix deploy
1 parent 661fc37 commit fe700ad

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

web3deployment/reserveDeployer2.js renamed to web3deployment/reserveEnhancedSteps.js

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,63 +40,62 @@ let chainId = chainIdInput;
4040
console.log("from",sender);
4141

4242
async function sendTx(txObject) {
43-
const txTo = txObject._parent.options.address;
43+
const txTo = txObject._parent.options.address;
4444

45-
let gasLimit;
46-
try {
47-
gasLimit = await txObject.estimateGas();
48-
}
49-
catch (e) {
50-
gasLimit = 500 * 1000;
51-
}
45+
let gasLimit;
46+
try {
47+
gasLimit = await txObject.estimateGas();
48+
} catch (e) {
49+
gasLimit = 500 * 1000;
50+
}
5251

53-
if(txTo !== null) {
54-
gasLimit = 500 * 1000;
55-
}
52+
if(txTo !== null) {
53+
gasLimit = 500 * 1000;
54+
}
5655

57-
gasLimit *= 1.2;
58-
gasLimit -= gasLimit % 1;
59-
//console.log(gasLimit);
60-
const txData = txObject.encodeABI();
61-
const txFrom = account.address;
62-
const txKey = account.privateKey;
63-
64-
const tx = {
65-
from : txFrom,
66-
to : txTo,
67-
nonce : nonce,
68-
data : txData,
69-
gas : gasLimit,
70-
chainId,
71-
gasPrice
72-
};
73-
74-
const signedTx = await web3.eth.accounts.signTransaction(tx, txKey);
75-
nonce++;
76-
// don't wait for confirmation
77-
signedTxs.push(signedTx.rawTransaction)
78-
if (!dontSendTx) {
79-
web3.eth.sendSignedTransaction(signedTx.rawTransaction, {from:sender});
80-
}
56+
gasLimit *= 1.2;
57+
gasLimit -= gasLimit % 1;
58+
//console.log(gasLimit);
59+
const txData = txObject.encodeABI();
60+
const txFrom = account.address;
61+
const txKey = account.privateKey;
62+
63+
const tx = {
64+
from : txFrom,
65+
to : txTo,
66+
nonce : nonce,
67+
data : txData,
68+
gas : gasLimit,
69+
chainId,
70+
gasPrice
71+
};
72+
73+
const signedTx = await web3.eth.accounts.signTransaction(tx, txKey);
74+
nonce++;
75+
// don't wait for confirmation
76+
signedTxs.push(signedTx.rawTransaction)
77+
if (!dontSendTx) {
78+
web3.eth.sendSignedTransaction(signedTx.rawTransaction, {from:sender});
79+
}
8180
}
8281

8382
async function deployContract(solcOutput, contractName, ctorArgs) {
8483

85-
const actualName = contractName;
86-
const bytecode = solcOutput.contracts[actualName].bytecode;
84+
const actualName = contractName;
85+
const bytecode = solcOutput.contracts[actualName].bytecode;
8786

88-
const abi = solcOutput.contracts[actualName].interface;
89-
const myContract = new web3.eth.Contract(JSON.parse(abi));
90-
const deploy = myContract.deploy({data:"0x" + bytecode, arguments: ctorArgs});
91-
let address = "0x" + web3.utils.sha3(RLP.encode([sender,nonce])).slice(12).substring(14);
92-
address = web3.utils.toChecksumAddress(address);
87+
const abi = solcOutput.contracts[actualName].interface;
88+
const myContract = new web3.eth.Contract(JSON.parse(abi));
89+
const deploy = myContract.deploy({data:"0x" + bytecode, arguments: ctorArgs});
90+
let address = "0x" + web3.utils.sha3(RLP.encode([sender,nonce])).slice(12).substring(14);
91+
address = web3.utils.toChecksumAddress(address);
9392

94-
await sendTx(deploy);
93+
await sendTx(deploy);
9594

96-
myContract.options.address = address;
95+
myContract.options.address = address;
9796

9897

99-
return [address,myContract];
98+
return [address,myContract];
10099
}
101100

102101
const contractPath = path.join(__dirname, "../contracts/");
@@ -113,7 +112,6 @@ let conversionRatesPermissions;
113112
const depositAddresses = [];
114113
let validDurationBlock = 24;
115114
let taxWalletAddress = 0x0;
116-
let taxFeesBps = 1000;
117115

118116
const ethAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
119117

@@ -168,6 +166,7 @@ async function setPermissions(contract, alerters, operators, admin) {
168166
console.log(operator);
169167
await sendTx(contract.methods.addOperator(operator));
170168
}
169+
171170
console.log("set alerter(s)");
172171
for(let i = 0 ; i < alerters.length ; i++ ) {
173172
const alerter = alerters[i];
@@ -180,7 +179,6 @@ async function setPermissions(contract, alerters, operators, admin) {
180179
await sendTx(contract.methods.transferAdminQuickly(admin));
181180
}
182181

183-
184182
async function main() {
185183
nonce = await web3.eth.getTransactionCount(sender);
186184
console.log("nonce",nonce);
@@ -216,9 +214,11 @@ async function main() {
216214
admin = '0xf3d872b9e8d314820dc8e99dafbe1a3feedc27d5';
217215

218216
await setPermissions(reserveContract, operators, operators, admin);
219-
await setPermissions(conversionRatesContract, operators, operators, admin);
220217
await setPermissions(wrapperContract, operators, operators, admin);
221218

219+
operators[2] = wrapperAddress;
220+
await setPermissions(conversionRatesContract, operators, operators, admin);
221+
222222
console.log("done for now...")
223223
return;
224224

0 commit comments

Comments
 (0)