Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gearbox-protocol/devops

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gearbox-protocol/devops - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

7

lib/utils/balanceComparator.d.ts

@@ -10,6 +10,7 @@ import { Provider } from "@ethersproject/providers";

constructor(list: Array<SupportedToken>, _provider: Provider);
storeBalances(stage: T, holder: string): Promise<void>;
compareBalances(stage: T, holder: string, compareWith: string): Promise<void>;
getNetwork(): Promise<NetworkType>;
takeSnapshot(stage: T, holder: string): Promise<void>;
compareSnapshot(stage: T, holder: string, compareWith: string): Promise<void>;
getBalance(stage: T, account: string, token: SupportedToken): BigNumber | undefined;
getBalanceOrThrow(stage: T, account: string, token: SupportedToken): BigNumber;
protected getNetwork(): Promise<NetworkType>;
}

@@ -60,3 +60,3 @@ "use strict";

}
BalanceComparator.prototype.storeBalances = function (stage, holder) {
BalanceComparator.prototype.takeSnapshot = function (stage, holder) {
return __awaiter(this, void 0, void 0, function () {

@@ -94,3 +94,3 @@ var balances, network, _i, _a, symbol, token, _b, _c;

};
BalanceComparator.prototype.compareBalances = function (stage, holder, compareWith) {
BalanceComparator.prototype.compareSnapshot = function (stage, holder, compareWith) {
return __awaiter(this, void 0, void 0, function () {

@@ -112,3 +112,3 @@ var network, _i, _a, symbol, token, _b;

case 3:
_b.apply(void 0, [_c.sent()]).to.be.eq(this.getBalance(stage, holder, symbol));
_b.apply(void 0, [_c.sent(), " ".concat(stage, ": different balances for ").concat(symbol)]).to.be.eq(this.getBalance(stage, holder, symbol));
_c.label = 4;

@@ -123,2 +123,18 @@ case 4:

};
BalanceComparator.prototype.getBalance = function (stage, account, token) {
var _a, _b;
return (_b = (_a = this._balanceSnapshot[stage]) === null || _a === void 0 ? void 0 : _a[account]) === null || _b === void 0 ? void 0 : _b[token];
};
BalanceComparator.prototype.getBalanceOrThrow = function (stage, account, token) {
var stageData = this._balanceSnapshot[stage];
if (!stageData)
throw new Error("No balances exist for stage ".concat(stage));
var accountData = stageData[account];
if (!accountData)
throw new Error("No balances exist for stage ".concat(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));
return balance;
};
BalanceComparator.prototype.getNetwork = function () {

@@ -141,8 +157,4 @@ return __awaiter(this, void 0, void 0, function () {

};
BalanceComparator.prototype.getBalance = function (stage, account, token) {
var _a, _b;
return (_b = (_a = this._balanceSnapshot[stage]) === null || _a === void 0 ? void 0 : _a[account]) === null || _b === void 0 ? void 0 : _b[token];
};
return BalanceComparator;
}());
exports.BalanceComparator = BalanceComparator;
{
"name": "@gearbox-protocol/devops",
"version": "0.0.14",
"version": "0.0.15",
"description": "Gearbox Devops for SC development",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -25,3 +25,3 @@ import { Provider } from "@ethersproject/providers";

async storeBalances(stage: T, holder: string) {
async takeSnapshot(stage: T, holder: string) {
let balances: Partial<Record<SupportedToken, BigNumber>> = {};

@@ -32,3 +32,3 @@

for (let symbol of this._list) {
let token = IERC20__factory.connect(
const token = IERC20__factory.connect(
tokenDataByNetwork[network][symbol],

@@ -46,3 +46,3 @@ this._provider

async compareBalances(stage: T, holder: string, compareWith: string) {
async compareSnapshot(stage: T, holder: string, compareWith: string) {
const network = await this.getNetwork();

@@ -56,15 +56,9 @@

expect(await token.balanceOf(compareWith)).to.be.eq(
this.getBalance(stage, holder, symbol)
);
expect(
await token.balanceOf(compareWith),
` ${stage}: different balances for ${symbol}`
).to.be.eq(this.getBalance(stage, holder, symbol));
}
}
async getNetwork(): Promise<NetworkType> {
if (!this._networkType) {
this._networkType = await detectNetwork();
}
return this._networkType;
}
getBalance(

@@ -77,2 +71,32 @@ stage: T,

}
getBalanceOrThrow(
stage: T,
account: string,
token: SupportedToken
): BigNumber {
const stageData = this._balanceSnapshot[stage];
if (!stageData) throw new Error(`No balances exist for stage ${stage}`);
const accountData = stageData[account];
if (!accountData)
throw new Error(
`No balances exist for stage ${stage} and account ${account}`
);
const balance = accountData[token];
if (!balance)
throw new Error(
`No balance exists for stage ${stage}, account ${account} and token ${token}`
);
return balance;
}
protected async getNetwork(): Promise<NetworkType> {
if (!this._networkType) {
this._networkType = await detectNetwork();
}
return this._networkType;
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc