From 661821b24068519c8812b75295c2f632039e05aa Mon Sep 17 00:00:00 2001 From: Michael Elliot Date: Tue, 3 Dec 2019 12:36:22 +0800 Subject: [PATCH] Use unique DSR deposit/withdraw history event types --- packages/dai-plugin-mcd/src/EventHistory.js | 6 +++--- packages/dai-plugin-mcd/test/SavingsService.spec.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/dai-plugin-mcd/src/EventHistory.js b/packages/dai-plugin-mcd/src/EventHistory.js index 3c9984dff..cb528d7a9 100644 --- a/packages/dai-plugin-mcd/src/EventHistory.js +++ b/packages/dai-plugin-mcd/src/EventHistory.js @@ -291,7 +291,7 @@ export async function getDsrEventHistory(service, address, cache) { .filter(({ topics }) => parseWeiNumeric(topics[3]) !== '0') .map(({ blockNumber: block, transactionHash: txHash, topics }) => { return { - type: 'DEPOSIT', + type: 'DSR_DEPOSIT', order: 0, block, txHash, @@ -314,8 +314,8 @@ export async function getDsrEventHistory(service, address, cache) { .filter(({ topics }) => parseWeiNumeric(topics[3]) !== '0') .map(({ blockNumber: block, transactionHash: txHash, topics }) => { return { - type: 'WITHDRAW', - order: 0, + type: 'DSR_WITHDRAW', + order: 1, block, txHash, amount: parseWeiNumeric(topics[3]), diff --git a/packages/dai-plugin-mcd/test/SavingsService.spec.js b/packages/dai-plugin-mcd/test/SavingsService.spec.js index 0365d8626..91339985b 100644 --- a/packages/dai-plugin-mcd/test/SavingsService.spec.js +++ b/packages/dai-plugin-mcd/test/SavingsService.spec.js @@ -249,8 +249,8 @@ describe('Savings Service', () => { await service.join(MDAI(3)); const events = await service.getEventHistory(proxyAddress); - const depositEventIdx = findIndex(events, { type: 'DEPOSIT' }); - const withdrawEventIdx = findIndex(events, { type: 'WITHDRAW' }); + const depositEventIdx = findIndex(events, { type: 'DSR_DEPOSIT' }); + const withdrawEventIdx = findIndex(events, { type: 'DSR_WITHDRAW' }); expect(depositEventIdx).toBeGreaterThan(-1); expect(events[depositEventIdx].gem).toEqual('DAI');