@gearbox-protocol/devops
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -43,13 +43,26 @@ "use strict"; | ||
var sdk_1 = require("@gearbox-protocol/sdk"); | ||
var waitingTime = function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var chainId; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, hardhat_1.ethers.getSigners()]; | ||
case 1: | ||
chainId = (_a.sent()).getChainId(); | ||
return [2 /*return*/, chainId === 1337 ? 0 : chainId === 42 ? 2 : 4]; | ||
} | ||
}); | ||
}); }; | ||
function waitForTransaction(transaction, logger) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var request, txReceipt; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var request, txReceipt, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, transaction]; | ||
case 1: | ||
request = _a.sent(); | ||
return [4 /*yield*/, request.wait()]; | ||
case 2: | ||
txReceipt = _a.sent(); | ||
request = _c.sent(); | ||
_b = (_a = request).wait; | ||
return [4 /*yield*/, waitingTime()]; | ||
case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 3: | ||
txReceipt = _c.sent(); | ||
if (logger) { | ||
@@ -71,18 +84,20 @@ logger.debug("Tx: ".concat(txReceipt.transactionHash)); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var artifact, contract, txReceipt; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var artifact, contract, txReceipt, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, hardhat_1.ethers.getContractFactory(name)]; | ||
case 1: | ||
artifact = _a.sent(); | ||
artifact = _c.sent(); | ||
return [4 /*yield*/, artifact.deploy.apply(artifact, args)]; | ||
case 2: | ||
contract = (_a.sent()); | ||
contract = (_c.sent()); | ||
logger === null || logger === void 0 ? void 0 : logger.debug("Deploying ".concat(name, "...")); | ||
return [4 /*yield*/, contract.deployed()]; | ||
case 3: | ||
_a.sent(); | ||
return [4 /*yield*/, contract.deployTransaction.wait()]; | ||
case 4: | ||
txReceipt = _a.sent(); | ||
_c.sent(); | ||
_b = (_a = contract.deployTransaction).wait; | ||
return [4 /*yield*/, waitingTime()]; | ||
case 4: return [4 /*yield*/, _b.apply(_a, [_c.sent()])]; | ||
case 5: | ||
txReceipt = _c.sent(); | ||
logger === null || logger === void 0 ? void 0 : logger.debug("Deployed ".concat(name, " to ").concat(contract.address)); | ||
@@ -89,0 +104,0 @@ logger === null || logger === void 0 ? void 0 : logger.debug("Tx: ".concat(txReceipt.transactionHash)); |
@@ -96,3 +96,3 @@ "use strict"; | ||
var symbol = _a[_i]; | ||
(0, expect_1.expect)(this.getBalance(stage, compareWith, symbol), " ".concat(stage, ": different balances for ").concat(symbol)).to.be.eq(this.getBalance(stage, holder, symbol)); | ||
(0, expect_1.expect)(this.getBalance(stage, compareWith, symbol), " ".concat(String(stage), ": different balances for ").concat(symbol)).to.be.eq(this.getBalance(stage, holder, symbol)); | ||
} | ||
@@ -112,9 +112,9 @@ }; | ||
if (!stageData) | ||
throw new Error("No balances exist for stage ".concat(stage)); | ||
throw new Error("No balances exist for stage ".concat(String(stage))); | ||
var accountData = stageData[account]; | ||
if (!accountData) | ||
throw new Error("No balances exist for stage ".concat(stage, " and account ").concat(account)); | ||
throw new Error("No balances exist for stage ".concat(String(stage), " and account ").concat(account)); | ||
var balance = accountData[token]; | ||
if (!balance) | ||
throw new Error("No balance exists for stage ".concat(stage, ", account ").concat(account, " and token ").concat(token)); | ||
throw new Error("No balance exists for stage ".concat(String(stage), ", account ").concat(account, " and token ").concat(token)); | ||
return balance; | ||
@@ -121,0 +121,0 @@ }; |
{ | ||
"name": "@gearbox-protocol/devops", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "Gearbox Devops for SC development", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -8,2 +8,9 @@ // @ts-ignore | ||
const waitingTime = async () => { | ||
// Gets accounts | ||
const chainId = (await ethers.getSigners()).getChainId(); | ||
return chainId === 1337 ? 0 : chainId === 42 ? 2 : 4; | ||
}; | ||
export async function waitForTransaction( | ||
@@ -14,3 +21,3 @@ transaction: Promise<ContractTransaction>, | ||
const request = await transaction; | ||
const txReceipt = await request.wait(); | ||
const txReceipt = await request.wait(await waitingTime()); | ||
@@ -48,3 +55,3 @@ if (logger) { | ||
await contract.deployed(); | ||
const txReceipt = await contract.deployTransaction.wait(); | ||
const txReceipt = await contract.deployTransaction.wait(await waitingTime()); | ||
logger?.debug(`Deployed ${name} to ${contract.address}`); | ||
@@ -51,0 +58,0 @@ logger?.debug(`Tx: ${txReceipt.transactionHash}`); |
@@ -44,17 +44,17 @@ import { Provider } from "@ethersproject/providers"; | ||
compareSnapshots(stage: T, holder: string, compareWith: string) { | ||
compareSnapshots(stage: T, holder: string, compareWith: string) { | ||
for (let symbol of this._list) { | ||
expect( | ||
this.getBalance(stage, compareWith, symbol), | ||
` ${stage}: different balances for ${symbol}` | ||
` ${String(stage)}: different balances for ${symbol}` | ||
).to.be.eq(this.getBalance(stage, holder, symbol)); | ||
} | ||
} | ||
compareAllSnapshots(holder: string, compareWith: string) { | ||
for (let stage in this._balanceSnapshot) { | ||
this.compareSnapshots(stage, holder, compareWith) | ||
this.compareSnapshots(stage, holder, compareWith); | ||
} | ||
} | ||
} | ||
getBalance( | ||
@@ -74,3 +74,4 @@ stage: T, | ||
const stageData = this._balanceSnapshot[stage]; | ||
if (!stageData) throw new Error(`No balances exist for stage ${stage}`); | ||
if (!stageData) | ||
throw new Error(`No balances exist for stage ${String(stage)}`); | ||
@@ -80,3 +81,3 @@ const accountData = stageData[account]; | ||
throw new Error( | ||
`No balances exist for stage ${stage} and account ${account}` | ||
`No balances exist for stage ${String(stage)} and account ${account}` | ||
); | ||
@@ -87,3 +88,5 @@ | ||
throw new Error( | ||
`No balance exists for stage ${stage}, account ${account} and token ${token}` | ||
`No balance exists for stage ${String( | ||
stage | ||
)}, account ${account} and token ${token}` | ||
); | ||
@@ -90,0 +93,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66355
1405