From e529a1ac73c2457fd021108ab04fe6964b971b2b Mon Sep 17 00:00:00 2001 From: Phil Bain Date: Tue, 16 Nov 2021 12:37:07 -0700 Subject: [PATCH] clean up imports --- .../dai-plugin-governance/test/helpers/index.js | 3 +-- packages/dai-plugin-liquidations/package.json | 4 ++-- .../src/LiquidationService.ts | 6 +----- .../test/LiquidationService.test.js | 6 ++---- packages/dai-plugin-liquidations/test/utils.js | 3 +-- packages/dai-plugin-mcd/src/utils.ts | 5 ----- packages/dai-plugin-mcd/test/helpers.ts | 3 +-- packages/dai-plugin-migrations/package.json | 6 +++--- .../dai-plugin-migrations/test/helpers/index.js | 14 +++----------- .../GlobalSettlementCollateralClaims.spec.js | 3 +-- .../migrations/GlobalSettlementDaiRedeemer.spec.js | 3 +-- .../migrations/GlobalSettlementSavingsDai.spec.ts | 3 +-- packages/dai-plugin-scd/package.json | 6 +++--- packages/dai-plugin-scd/src/EthereumCdpService.ts | 3 +-- packages/dai/src/eth/Web3Service.ts | 3 --- packages/dai/test/eth/TransactionManager.spec.js | 8 +++----- packages/dai/test/eth/tokens/EtherToken.spec.js | 6 +++--- 17 files changed, 27 insertions(+), 58 deletions(-) diff --git a/packages/dai-plugin-governance/test/helpers/index.js b/packages/dai-plugin-governance/test/helpers/index.js index 477fd1eac..d9583c6a8 100644 --- a/packages/dai-plugin-governance/test/helpers/index.js +++ b/packages/dai-plugin-governance/test/helpers/index.js @@ -1,6 +1,5 @@ import fetch from 'node-fetch'; -// import Maker from '@makerdao/dai'; -import Maker from '../../../dai/src'; +import Maker from '@makerdao/dai'; import govPlugin from '../../src/index'; import configPlugin from '@makerdao/dai-plugin-config'; import { createCurrency } from '@makerdao/currency'; diff --git a/packages/dai-plugin-liquidations/package.json b/packages/dai-plugin-liquidations/package.json index 112a79b3c..fa4191a68 100644 --- a/packages/dai-plugin-liquidations/package.json +++ b/packages/dai-plugin-liquidations/package.json @@ -17,11 +17,11 @@ "test": "yarn testchain --ci jest --runInBand" }, "peerDependencies": { - "@makerdao/dai": "^0.41.0-alpha.2" + "@makerdao/dai": "^0.41.0-alpha.9" }, "dependencies": { "@makerdao/currency": "0.9.9", - "@makerdao/services-core": "^0.11.0-alpha.4", + "@makerdao/services-core": "^0.11.0-alpha.9", "bignumber.js": "^8.1.1", "ramda": "^0.27.1" }, diff --git a/packages/dai-plugin-liquidations/src/LiquidationService.ts b/packages/dai-plugin-liquidations/src/LiquidationService.ts index a982e5108..c622a82c5 100644 --- a/packages/dai-plugin-liquidations/src/LiquidationService.ts +++ b/packages/dai-plugin-liquidations/src/LiquidationService.ts @@ -2,11 +2,7 @@ import { PublicService } from '@makerdao/services-core'; import { bytes32ToNumber, numberToBytes32 -} from '../../dai/src/utils/conversion'; -// import { -// bytes32ToNumber, -// numberToBytes32 -// } from '@makerdao/dai/src/utils/conversion'; +} from '@makerdao/dai/src/utils/conversion'; import assert from 'assert'; import { utils } from 'ethers'; import tracksTransactions from './utils/tracksTransactions'; diff --git a/packages/dai-plugin-liquidations/test/LiquidationService.test.js b/packages/dai-plugin-liquidations/test/LiquidationService.test.js index fed3e5090..bf48444bc 100644 --- a/packages/dai-plugin-liquidations/test/LiquidationService.test.js +++ b/packages/dai-plugin-liquidations/test/LiquidationService.test.js @@ -1,8 +1,6 @@ import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; -// import Maker from '@makerdao/dai/'; -import Maker from '../../dai/src'; -// import { McdPlugin, YFI } from '@makerdao/dai-plugin-mcd'; -import { McdPlugin, YFI } from '../../dai-plugin-mcd/src'; +import Maker from '@makerdao/dai'; +import { McdPlugin, YFI } from '@makerdao/dai-plugin-mcd'; import BigNumber from 'bignumber.js'; import liquidationPlugin from '../src'; import LiquidationService, { diff --git a/packages/dai-plugin-liquidations/test/utils.js b/packages/dai-plugin-liquidations/test/utils.js index d6ea0d94d..f5d2e7716 100644 --- a/packages/dai-plugin-liquidations/test/utils.js +++ b/packages/dai-plugin-liquidations/test/utils.js @@ -1,5 +1,4 @@ -// import { DAI } from '@makerdao/dai-plugin-mcd'; -import { DAI } from '../../dai-plugin-mcd/src'; +import { DAI } from '@makerdao/dai-plugin-mcd'; import { mineBlocks } from '../../test-helpers/src'; import BigNumber from 'bignumber.js'; import { stringToBytes } from '../src/LiquidationService'; diff --git a/packages/dai-plugin-mcd/src/utils.ts b/packages/dai-plugin-mcd/src/utils.ts index 21063995f..69025eda3 100644 --- a/packages/dai-plugin-mcd/src/utils.ts +++ b/packages/dai-plugin-mcd/src/utils.ts @@ -16,11 +16,6 @@ export function stringToBytes(str) { assert(typeof str === 'string', 'argument is not a string'); return ethersUtils.formatBytes32String(str); } -// export function stringToBytes(str) { -// assert(!!str, 'argument is falsy'); -// assert(typeof str === 'string', 'argument is not a string'); -// return '0x' + Buffer.from(str).toString('hex'); -// } export function bytesToString(hex) { return Buffer.from(hex.replace(/^0x/, ''), 'hex') diff --git a/packages/dai-plugin-mcd/test/helpers.ts b/packages/dai-plugin-mcd/test/helpers.ts index 5cf5301af..0dafbeee7 100644 --- a/packages/dai-plugin-mcd/test/helpers.ts +++ b/packages/dai-plugin-mcd/test/helpers.ts @@ -1,7 +1,6 @@ import assert from 'assert'; import { createCurrencyRatio } from '@makerdao/currency'; -// import Maker from '@makerdao/dai'; -import Maker from '../../dai/src'; +import Maker from '@makerdao/dai'; import { McdPlugin, ETH, USD, GNT } from '../src'; import { stringToBytes } from '../src/utils'; import { ServiceRoles } from '../src/constants'; diff --git a/packages/dai-plugin-migrations/package.json b/packages/dai-plugin-migrations/package.json index 0f1891188..b06dea22c 100644 --- a/packages/dai-plugin-migrations/package.json +++ b/packages/dai-plugin-migrations/package.json @@ -17,12 +17,12 @@ "test": "yarn testchain --ci jest --runInBand" }, "peerDependencies": { - "@makerdao/dai": "^0.41.0-alpha.2" + "@makerdao/dai": "^0.41.0-alpha.9" }, "dependencies": { "@makerdao/currency": "0.9.9", - "@makerdao/dai": "^0.41.0-alpha.5", - "@makerdao/services-core": "^0.11.0-alpha.4", + "@makerdao/dai": "^0.41.0-alpha.9", + "@makerdao/services-core": "^0.11.0-alpha.9", "bignumber.js": "^8.1.1" }, "gitHead": "689f3670142282c9483c74d5658f60161d4287bb" diff --git a/packages/dai-plugin-migrations/test/helpers/index.js b/packages/dai-plugin-migrations/test/helpers/index.js index b67bdd458..1add40147 100644 --- a/packages/dai-plugin-migrations/test/helpers/index.js +++ b/packages/dai-plugin-migrations/test/helpers/index.js @@ -1,5 +1,4 @@ -// import Maker from '@makerdao/dai'; -import Maker from '../../../dai/src'; +import Maker from '@makerdao/dai'; import MigrationPlugin from '../../src'; import { Migrations } from '../../src/constants'; import { createCurrencyRatio } from '@makerdao/currency'; @@ -8,15 +7,8 @@ import McdPlugin, { ETH, GNT, USD -} from '../../../dai-plugin-mcd/src'; -// import McdPlugin, { -// ServiceRoles, -// ETH, -// GNT, -// USD -// } from '@makerdao/dai-plugin-mcd'; -import ScdPlugin from '../../../dai-plugin-scd/src'; -// import ScdPlugin from '@makerdao/dai-plugin-scd'; +} from '@makerdao/dai-plugin-mcd'; +import ScdPlugin from '@makerdao/dai-plugin-scd'; import ethAbi from 'web3-eth-abi'; import { utils } from 'ethers'; diff --git a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementCollateralClaims.spec.js b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementCollateralClaims.spec.js index 720cf167c..2e0dba4db 100644 --- a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementCollateralClaims.spec.js +++ b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementCollateralClaims.spec.js @@ -2,8 +2,7 @@ import { migrationMaker, setupCollateral } from '../helpers'; import { mockContracts, globalSettlement } from '../helpers/mocks'; import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; import { ServiceRoles, Migrations } from '../../src/constants'; -// import { DAI, ETH } from '@makerdao/dai-plugin-mcd'; -import { DAI, ETH } from '../../../dai-plugin-mcd/src'; +import { DAI, ETH } from '@makerdao/dai-plugin-mcd'; let maker, migration, smartContract, cdpManager, snapshot; diff --git a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementDaiRedeemer.spec.js b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementDaiRedeemer.spec.js index c4afeb60b..209fc1562 100644 --- a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementDaiRedeemer.spec.js +++ b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementDaiRedeemer.spec.js @@ -2,8 +2,7 @@ import { migrationMaker, setupCollateral } from '../helpers'; import { mockContracts, globalSettlement } from '../helpers/mocks'; import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; import { ServiceRoles, Migrations } from '../../src/constants'; -// import { DAI, ETH } from '@makerdao/dai-plugin-mcd'; -import { DAI, ETH } from '../../../dai-plugin-mcd/src'; +import { DAI, ETH } from '@makerdao/dai-plugin-mcd'; jest.setTimeout(30000); diff --git a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementSavingsDai.spec.ts b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementSavingsDai.spec.ts index b72be31af..d33324ca2 100644 --- a/packages/dai-plugin-migrations/test/migrations/GlobalSettlementSavingsDai.spec.ts +++ b/packages/dai-plugin-migrations/test/migrations/GlobalSettlementSavingsDai.spec.ts @@ -2,8 +2,7 @@ import { migrationMaker, setupCollateral } from '../helpers'; import { mockContracts, globalSettlement } from '../helpers/mocks'; import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; import { ServiceRoles, Migrations } from '../../src/constants'; -// import { DAI, ETH } from '@makerdao/dai-plugin-mcd'; -import { DAI, ETH } from '../../../dai-plugin-mcd/src'; +import { ETH, DAI } from '@makerdao/dai-plugin-mcd'; let maker, migration, cdpManager, smartContract, snapshot; diff --git a/packages/dai-plugin-scd/package.json b/packages/dai-plugin-scd/package.json index 1b31d218d..d410f2c10 100644 --- a/packages/dai-plugin-scd/package.json +++ b/packages/dai-plugin-scd/package.json @@ -1,7 +1,7 @@ { "name": "@makerdao/dai-plugin-scd", "description": "Plugin to add Single-Collateral Dai support to dai.js", - "version": "1.3.0-alpha.4", + "version": "1.3.0-alpha.9", "license": "MIT", "main": "dist/index.js", "unpkg": "dist/index.js", @@ -20,11 +20,11 @@ "test:integration": "export NETWORK='test' && yarn test --config ./test/config/jestIntegrationConfig.json" }, "peerDependencies": { - "@makerdao/dai": "^0.41.0-alpha.2" + "@makerdao/dai": "^0.41.0-alpha.9" }, "dependencies": { "@makerdao/currency": "^0.9.9", - "@makerdao/services-core": "^0.11.0-alpha.4", + "@makerdao/services-core": "^0.11.0-alpha.9", "assert": "^2.0.0", "bignumber.js": "^8.1.1", "chokidar": "^2.0.4", diff --git a/packages/dai-plugin-scd/src/EthereumCdpService.ts b/packages/dai-plugin-scd/src/EthereumCdpService.ts index b5bdfe2b7..661f1aeb0 100644 --- a/packages/dai-plugin-scd/src/EthereumCdpService.ts +++ b/packages/dai-plugin-scd/src/EthereumCdpService.ts @@ -355,7 +355,6 @@ export default class EthereumCdpService extends PrivateService { } async getLiquidationPrice(cdpId) { - // .. const [debt, liqRatio, collateral] = await Promise.all([ this.getDebtValue(cdpId, USD), this.getLiquidationRatio(), @@ -471,7 +470,7 @@ export default class EthereumCdpService extends PrivateService { const hexCdpId = numberToBytes32(cdpId); const valueEth = getCurrency(amountEth, ETH).toFixed('wei'); const valueSai = getCurrency(amountSai, SAI).toFixed('wei'); - // + return this._saiProxyTubContract().lockAndDraw( this._tubContract().address, hexCdpId, diff --git a/packages/dai/src/eth/Web3Service.ts b/packages/dai/src/eth/Web3Service.ts index 4f5694613..5f11322b2 100644 --- a/packages/dai/src/eth/Web3Service.ts +++ b/packages/dai/src/eth/Web3Service.ts @@ -157,9 +157,6 @@ export default class Web3Service extends PrivateService { https://web3js.readthedocs.io/en/1.0/web3-eth.html#sendtransaction */ sendTransaction(...args) { - // const prov = new ethers.providers.Web3Provider(this.web3Provider()); - //@ts-ignore - // return prov.getSigner().sendTransaction(...args); return new Promise((resolve, reject) => { this._web3.eth .sendTransaction(...args) diff --git a/packages/dai/test/eth/TransactionManager.spec.js b/packages/dai/test/eth/TransactionManager.spec.js index e420b580a..e24e8dc67 100644 --- a/packages/dai/test/eth/TransactionManager.spec.js +++ b/packages/dai/test/eth/TransactionManager.spec.js @@ -4,14 +4,12 @@ import { buildTestSmartContractService } from '../helpers/serviceBuilders'; import { uniqueId } from '../../src/utils'; -import { mineBlocks } from '../../../test-helpers/src'; import { size } from 'lodash'; -// import { mineBlocks } from '@makerdao/test-helpers'; +import { mineBlocks } from '@makerdao/test-helpers'; import debug from 'debug'; const log = debug('sai:testing:TxMgr.spec'); import Maker from '../../src'; -import ScdPlugin from '../../../dai-plugin-scd/src'; -// import ScdPlugin from '@makerdao/dai-plugin-scd'; +import ScdPlugin from '@makerdao/dai-plugin-scd'; async function scdMaker({ preset = 'test', @@ -64,7 +62,7 @@ test('reuse the same web3 service in test services', () => { expect(services.currentAddress).toMatch(/^0x[0-9A-Fa-f]+$/); }, 30000); -test('contract call accepts a businessObject option', async () => { +test('wrapped contract call accepts a businessObject option', async () => { expect.assertions(3); const token = services.contract.getContract('WETH'); diff --git a/packages/dai/test/eth/tokens/EtherToken.spec.js b/packages/dai/test/eth/tokens/EtherToken.spec.js index e4f222c2c..83d34164c 100644 --- a/packages/dai/test/eth/tokens/EtherToken.spec.js +++ b/packages/dai/test/eth/tokens/EtherToken.spec.js @@ -80,9 +80,9 @@ test('ether transfer should move transferValue from sender to receiver', done => receiverBalance = ETH(balances[1]); return token.transfer(receiver, '0.1'); }) - .then(() => { - return Promise.all([token.balanceOf(sender), token.balanceOf(receiver)]); - }) + .then(() => + Promise.all([token.balanceOf(sender), token.balanceOf(receiver)]) + ) .then(balances => { const newSenderBalance = ETH(balances[0]), newReceiverBalance = ETH(balances[1]);