File tree Expand file tree Collapse file tree 7 files changed +69
-1
lines changed
handlers/motions/motionCreated Expand file tree Collapse file tree 7 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -652,6 +652,8 @@ export enum ColonyActionType {
652
652
CreateExpenditure = 'CREATE_EXPENDITURE' ,
653
653
/** An action related to creating a streaming payment */
654
654
CreateStreamingPayment = 'CREATE_STREAMING_PAYMENT' ,
655
+ /** An action related to creating a streaming payment via a motion */
656
+ CreateStreamingPaymentMotion = 'CREATE_STREAMING_PAYMENT_MOTION' ,
655
657
/** An action related to editing a domain's details */
656
658
EditDomain = 'EDIT_DOMAIN' ,
657
659
/** An action related to editing a domain's details via a motion */
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ export { handleMulticallMotion } from './multicall';
13
13
export { handleMakeArbitraryTransactionsMotion } from './makeArbitraryTransactions' ;
14
14
export { handleMetadataDeltaMotion } from './metadataDelta' ;
15
15
export * from './expenditures' ;
16
- export * from './streamingPayments.ts ' ;
16
+ export * from './streamingPayments' ;
Original file line number Diff line number Diff line change
1
+ import { TransactionDescription } from 'ethers/lib/utils' ;
2
+ import { ContractEvent , motionNameMapping } from '~types' ;
3
+ import { createMotionInDB } from '../../helpers' ;
4
+ import {
5
+ getDomainDatabaseId ,
6
+ getExpenditureDatabaseId ,
7
+ toNumber ,
8
+ } from '~utils' ;
9
+
10
+ export default async (
11
+ colonyAddress : string ,
12
+ event : ContractEvent ,
13
+ { name, args : actionArgs } : TransactionDescription ,
14
+ ) : Promise < void > => {
15
+ const { args } = event ;
16
+ const [ , , streamingPaymentId ] = actionArgs ;
17
+ const [ , , domainId ] = args ;
18
+
19
+ await createMotionInDB ( colonyAddress , event , {
20
+ type : motionNameMapping [ name ] ,
21
+ fromDomainId : getDomainDatabaseId ( colonyAddress , domainId ) ,
22
+ streamingPaymentId : getExpenditureDatabaseId (
23
+ colonyAddress ,
24
+ toNumber ( streamingPaymentId ) ,
25
+ ) ,
26
+ } ) ;
27
+ } ;
Original file line number Diff line number Diff line change
1
+ import { TransactionDescription } from 'ethers/lib/utils' ;
2
+ import { ContractEvent , motionNameMapping } from '~types' ;
3
+ import { createMotionInDB } from '../../helpers' ;
4
+ import {
5
+ getDomainDatabaseId ,
6
+ getExpenditureDatabaseId ,
7
+ toNumber ,
8
+ } from '~utils' ;
9
+
10
+ export default async (
11
+ colonyAddress : string ,
12
+ event : ContractEvent ,
13
+ { name, args : actionArgs } : TransactionDescription ,
14
+ ) : Promise < void > => {
15
+ const { args } = event ;
16
+ const [ , , streamingPaymentId ] = actionArgs ;
17
+ const [ , , domainId ] = args ;
18
+
19
+ await createMotionInDB ( colonyAddress , event , {
20
+ type : motionNameMapping [ name ] ,
21
+ fromDomainId : getDomainDatabaseId ( colonyAddress , domainId ) ,
22
+ streamingPaymentId : getExpenditureDatabaseId (
23
+ colonyAddress ,
24
+ toNumber ( streamingPaymentId ) ,
25
+ ) ,
26
+ } ) ;
27
+ } ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -236,6 +236,15 @@ export const handleMotionCreated: EventHandler = async (
236
236
break ;
237
237
}
238
238
239
+ case StreamingPaymentsOperations . CreateStreamingPayment : {
240
+ await handleCancelStreamingPaymentsMotion (
241
+ colonyAddress ,
242
+ event ,
243
+ parsedAction ,
244
+ ) ;
245
+ break ;
246
+ }
247
+
239
248
default : {
240
249
break ;
241
250
}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export enum ColonyOperations {
27
27
}
28
28
29
29
export enum StreamingPaymentsOperations {
30
+ CreateStreamingPayment = 'create' ,
30
31
CancelStreamingPayment = 'cancel' ,
31
32
}
32
33
@@ -75,6 +76,8 @@ export const motionNameMapping: { [key: string]: ColonyActionType } = {
75
76
ColonyActionType . ReleaseStagedPaymentsMotion ,
76
77
[ StreamingPaymentsOperations . CancelStreamingPayment ] :
77
78
ColonyActionType . CancelStreamingPaymentMotion ,
79
+ [ StreamingPaymentsOperations . CreateStreamingPayment ] :
80
+ ColonyActionType . CreateStreamingPaymentMotion ,
78
81
} ;
79
82
80
83
export enum MotionSide {
You can’t perform that action at this time.
0 commit comments