-
-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathtranslateEventDataToProtocolPresenter.tsx
More file actions
84 lines (83 loc) · 2.47 KB
/
Copy pathtranslateEventDataToProtocolPresenter.tsx
File metadata and controls
84 lines (83 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { BigNumber } from '@ethersproject/bignumber'
import { AmountInCurrency } from 'components/currency/AmountInCurrency'
import { AnyEvent } from 'packages/v4v5/views/V4V5ProjectDashboard/V4V5ProjectTabs/V4V5ActivityPanel/utils/transformEventsData'
import { formatActivityAmount } from 'utils/format/formatActivityAmount'
/**
* Translate event data to protocol activity presenter with formatted amounts
*/
export function translateEventDataToProtocolPresenter(event: AnyEvent) {
switch (event.type) {
case 'payEvent':
return {
event,
header: 'Paid',
subject: `${formatActivityAmount(event.amount.value)} ETH`,
}
case 'addToBalanceEvent':
return {
event,
header: 'Added to balance',
subject: `${formatActivityAmount(event.amount.value)} ETH`,
}
case 'manualMintTokensEvent':
return {
event,
header: 'Minted tokens',
subject: `${formatActivityAmount(event.amount.value)} tokens`,
}
case 'cashOutEvent':
return {
event,
header: 'Cashed out',
subject: `${formatActivityAmount(event.reclaimAmount.value)} ETH`,
}
case 'deployedERC20Event':
return {
event,
header: 'Deployed ERC20',
subject: event.symbol,
}
case 'projectCreateEvent':
return {
event,
header: 'Created',
subject: 'Project created',
}
case 'distributePayoutsEvent':
return {
event,
header: 'Send payouts',
subject: `${formatActivityAmount(event.amount.value)} ETH`,
}
case 'distributeReservedTokensEvent':
return {
event,
header: 'Send reserved tokens',
subject: `${formatActivityAmount(event.tokenCount)} tokens`,
}
case 'distributeToReservedTokenSplitEvent':
return {
event,
header: 'Send to reserved token split',
subject: `${formatActivityAmount(event.tokenCount)} tokens`,
}
case 'distributeToPayoutSplitEvent':
return {
event,
header: 'Send to payout split',
subject: `${formatActivityAmount(event.amount.value)} ETH`,
}
case 'useAllowanceEvent':
return {
event,
header: 'Used allowance',
subject: `${formatActivityAmount(event.amount.value)} ETH`,
}
case 'manualBurnEvent':
return {
event,
header: 'Burned',
subject: `${formatActivityAmount(event.amount.value)} tokens`,
}
}
}