Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _assertEthBalancesEqual(rhs: BalanceStore): void {
for (const ownerAddress of [...this._ownerAddresses, ...rhs._ownerAddresses]) {
const thisBalance = _.get(this._balances.eth, [ownerAddress], new BigNumber(0));
const rhsBalance = _.get(rhs._balances.eth, [ownerAddress], new BigNumber(0));
expect(thisBalance, `${this._readableAddressName(ownerAddress)} ETH balance`).to.bignumber.equal(
rhsBalance,
);
}
}
private _assertErc721BalancesEqual(rhs: BalanceStore): void {
for (const ownerAddress of [...this._ownerAddresses, ...rhs._ownerAddresses]) {
for (const tokenAddress of [...this._tokenAddresses.erc721, ...rhs._tokenAddresses.erc721]) {
const thisBalance = _.get(this._balances.erc721, [ownerAddress, tokenAddress], []);
const rhsBalance = _.get(rhs._balances.erc721, [ownerAddress, tokenAddress], []);
expect(
thisBalance,
`${this._readableAddressName(ownerAddress)} ${this._readableAddressName(tokenAddress)} balance`,
).to.deep.equal(rhsBalance);
}
}
}
private _assertErc1155BalancesEqual(rhs: BalanceStore): void {
for (const ownerAddress of [...this._ownerAddresses, ...rhs._ownerAddresses]) {
for (const tokenAddress of [...this._tokenAddresses.erc1155, ...rhs._tokenAddresses.erc1155]) {
const thisBalance = _.get(this._balances.erc1155, [ownerAddress, tokenAddress], {});
const rhsBalance = _.get(rhs._balances.erc1155, [ownerAddress, tokenAddress], {});
expect(
thisBalance,
`${this._readableAddressName(ownerAddress)} ${this._readableAddressName(tokenAddress)} balance`,
).to.deep.equal(rhsBalance);
}
}
}
}
private _assertErc20BalancesEqual(rhs: BalanceStore): void {
for (const ownerAddress of [...this._ownerAddresses, ...rhs._ownerAddresses]) {
for (const tokenAddress of [...this._tokenAddresses.erc20, ...rhs._tokenAddresses.erc20]) {
const thisBalance = _.get(this._balances.erc20, [ownerAddress, tokenAddress], new BigNumber(0));
const rhsBalance = _.get(rhs._balances.erc20, [ownerAddress, tokenAddress], new BigNumber(0));
expect(
thisBalance,
`${this._readableAddressName(ownerAddress)} ${this._readableAddressName(tokenAddress)} balance`,
).to.bignumber.equal(rhsBalance);
}
}
}