opportunity-service 0.0.659 → 0.0.660

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. package/dist/OpportunityService.js +0 -11
  2. package/dist/OpportunityService.js.map +1 -1
  3. package/dist/api/ethereum/sendAsync.js +0 -4
  4. package/dist/api/ethereum/sendAsync.js.map +1 -1
  5. package/dist/api/exchange/create-dispute.js +0 -39
  6. package/dist/api/exchange/create-dispute.js.map +1 -1
  7. package/dist/api/exchange/create-task.js +1 -14
  8. package/dist/api/exchange/create-task.js.map +1 -1
  9. package/dist/api/exchange/enter-work-relationship.js +0 -60
  10. package/dist/api/exchange/enter-work-relationship.js.map +1 -1
  11. package/dist/api/identity/register-new-user.js +0 -10
  12. package/dist/api/identity/register-new-user.js.map +1 -1
  13. package/dist/api/index.js +2 -16
  14. package/dist/api/index.js.map +1 -1
  15. package/dist/api/internal/abis.js +1 -4
  16. package/dist/api/internal/abis.js.map +1 -1
  17. package/dist/blockchain/addresses.json +7 -3
  18. package/dist/blockchain/bytecode.json +0 -1
  19. package/dist/constants.js +0 -10
  20. package/dist/constants.js.map +1 -1
  21. package/dist/events/OpportunityEventEmitter.js +0 -2
  22. package/dist/events/OpportunityEventEmitter.js.map +1 -1
  23. package/dist/events/sync-with-ethereum-node.js +0 -2
  24. package/dist/events/sync-with-ethereum-node.js.map +1 -1
  25. package/dist/sync/process/process-log.js +0 -7
  26. package/dist/sync/process/process-log.js.map +1 -1
  27. package/dist/sync/process/processMarketCreatedLog.js +0 -3
  28. package/dist/sync/process/processMarketCreatedLog.js.map +1 -1
  29. package/dist/sync/process/processUserAssignedTrueIdentification.js +1 -2
  30. package/dist/sync/process/processUserAssignedTrueIdentification.js.map +1 -1
  31. package/dist/sync/process/processUserRegistered.js +1 -3
  32. package/dist/sync/process/processUserRegistered.js.map +1 -1
  33. package/dist/sync/process/processUserSummaryCreated.js +0 -1
  34. package/dist/sync/process/processUserSummaryCreated.js.map +1 -1
  35. package/dist/sync/process/processWorkRelationshipCreated.js +0 -2
  36. package/dist/sync/process/processWorkRelationshipCreated.js.map +1 -1
  37. package/dist/sync/sync-jobs.js +2 -3
  38. package/dist/sync/sync-jobs.js.map +1 -1
  39. package/dist/sync/sync-market-disputes.js +0 -34
  40. package/dist/sync/sync-market-disputes.js.map +1 -1
  41. package/dist/sync/sync-markets.js +2 -5
  42. package/dist/sync/sync-markets.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/OpportunityService.ts +1 -12
  45. package/src/api/ethereum/sendAsync.ts +0 -4
  46. package/src/api/exchange/create-dispute.ts +0 -41
  47. package/src/api/exchange/create-task.ts +1 -15
  48. package/src/api/exchange/enter-work-relationship.ts +0 -61
  49. package/src/api/identity/register-new-user.ts +0 -12
  50. package/src/api/index.ts +2 -16
  51. package/src/api/internal/abis.ts +1 -4
  52. package/src/blockchain/addresses.json +6 -4
  53. package/src/blockchain/bytecode.json +0 -1
  54. package/src/constants.ts +0 -11
  55. package/src/events/OpportunityEventEmitter.ts +0 -2
  56. package/src/events/sync-with-ethereum-node.ts +0 -2
  57. package/src/sync/process/process-log.ts +0 -6
  58. package/src/sync/process/processMarketCreatedLog.ts +0 -4
  59. package/src/sync/process/processUserAssignedTrueIdentification.ts +1 -3
  60. package/src/sync/process/processUserRegistered.ts +1 -5
  61. package/src/sync/process/processUserSummaryCreated.ts +0 -2
  62. package/src/sync/process/processWorkRelationshipCreated.ts +1 -5
  63. package/src/sync/sync-jobs.ts +2 -3
  64. package/src/sync/sync-market-disputes.ts +0 -27
  65. package/src/sync/sync-markets.ts +3 -5
  66. package/src/types.ts +0 -32
  67. package/dist/sync/process/processDisputeInvolvement.js +0 -33
  68. package/dist/sync/process/processDisputeInvolvement.js.map +0 -1
  69. package/dist/sync/process/processMarketDisputes.js +0 -34
  70. package/dist/sync/process/processMarketDisputes.js.map +0 -1
  71. package/dist/sync/sync-disputes.js +0 -37
  72. package/dist/sync/sync-disputes.js.map +0 -1
  73. package/src/sync/process/processDisputeInvolvement.ts +0 -42
  74. package/src/sync/process/processMarketDisputes.ts +0 -43
  75. package/src/sync/sync-disputes.ts +0 -29
@@ -8,11 +8,9 @@ import syncMarkets from '../sync/sync-markets';
8
8
  import syncJobs from '../sync/sync-jobs';
9
9
 
10
10
  async function syncWithEthereumNode(): Promise<void> {
11
- console.log('Syncing with ethereum node..');
12
11
  const highestBlockNumber = 1//blockMap[Contracts.MARKET_FACTORY]; //get highest block number form db
13
12
 
14
13
  syncMarkets()
15
- //syncJobs()
16
14
  }
17
15
 
18
16
  export { syncWithEthereumNode };
@@ -7,7 +7,6 @@ import { ethers, utils } from "ethers";
7
7
  import { hexZeroPad } from "@ethersproject/bytes";
8
8
  import { decode } from "node:punycode";
9
9
  import { processWorkRelationshipCreatedEvent } from "./processWorkRelationshipCreated";
10
- import { processDisputeInvolvement } from "./processDisputeInvolvement";
11
10
  /**
12
11
  * Retrieves topics and process the approppriate log
13
12
  * @param log
@@ -24,7 +23,6 @@ import { processDisputeInvolvement } from "./processDisputeInvolvement";
24
23
  * },{...}]
25
24
  */
26
25
  function processLog(log) {
27
- console.log(log)
28
26
  processLogEvents(log);
29
27
  }
30
28
 
@@ -56,12 +54,8 @@ function processLogEvents(log) {
56
54
  case "WorkRelationshipCreated":
57
55
  processWorkRelationshipCreatedEvent(log);
58
56
  break;
59
- case "DisputeInvolvement":
60
- processDisputeInvolvement(log)
61
57
  default:
62
58
  }
63
- } else {
64
- console.log('Event is null.. exiting processing.')
65
59
  }
66
60
  }
67
61
 
@@ -23,10 +23,6 @@ function processMarketCreatedEvent(log) {
23
23
  const marketName = args[3];
24
24
  const marketType = args[4];
25
25
 
26
- console.log('Processing ' + signature + ' with args: '
27
- + 'Market Address: ' + marketAddress + ', Index: '
28
- + marketIndex + ', Owner: ' + marketOwner, ', Market Name: ' + marketName, + ', and Market Type: ' + marketType);
29
-
30
26
  let marketData = {
31
27
  marketAddress,
32
28
  marketIndex,
@@ -15,12 +15,10 @@ function processAssignedTrueIdentification(log) {
15
15
  const registeredUniversalAddress = args[0];
16
16
  const userSummaryContractAddress = args[1];
17
17
 
18
- console.log('Processing: ' + 'processAssignedTrueIdentification event with args: ' + registeredUniversalAddress + ' and ' + userSummaryContractAddress);
19
-
20
18
  const trueIdentificationData = { registeredUniversalAddress, userSummaryContractAddress }
21
19
  opportunityEventEmitter.emit(UserEvents.UserAssignedTrueIdentification, trueIdentificationData);
22
20
  } catch(error) {
23
- console.log('processAssignedTrueIdentification: ' + error);
21
+ console.log(error);
24
22
  }
25
23
  }
26
24
 
@@ -13,13 +13,9 @@ function processUserRegistered(log) {
13
13
  const { args, signature } = decodedLog;
14
14
 
15
15
  const registeredUniversalAddress = args[0];
16
-
17
- console.log('Processing: ' + 'UserRegistered event with args: ' + registeredUniversalAddress);
18
-
19
- console.log('Successfully processedUserRegistered');
20
16
  opportunityEventEmitter.emit(UserEvents.UserRegistered, registeredUniversalAddress);
21
17
  } catch(error) {
22
- console.log('processUserRegistered: ' + error);
18
+ console.log(error)
23
19
  }
24
20
  }
25
21
 
@@ -15,8 +15,6 @@ function processUserSummaryCreated(log) {
15
15
  const userSummaryContractAddress = args[0];
16
16
  const userRegistrationNumber = args[1];
17
17
  const registeredUniversalAddress = args[2]
18
-
19
- console.log('Processing: ' + 'processUserSummaryCreated event with args: ' + registeredUniversalAddress + ' and ' + userSummaryContractAddress);
20
18
  const userSummaryData = { userSummaryContractAddress, userRegistrationNumber, registeredUniversalAddress }
21
19
  opportunityEventEmitter.emit(UserEvents.UserSummaryCreated, userSummaryData);
22
20
  } catch(error) {
@@ -21,11 +21,7 @@ function processWorkRelationshipCreatedEvent(log) {
21
21
 
22
22
  const relationshipOwner = args[0];
23
23
  const relationshipAddress = args[1];
24
- const relationshipMarketAddress = args[2];
25
-
26
- console.log('Processing ' + signature + ' with args: '
27
- + 'Owner: ' + relationshipOwner + ', Address: ' + relationshipAddress + ', and Market Address: ' + relationshipAddress);
28
-
24
+ const relationshipMarketAddress = args[2]
29
25
  const relationshipContractInstance = new ethers.Contract(relationshipAddress, abiMap[Contracts.WORK_RELATIONSHIP], opportunityService.getSignersInterface())
30
26
  const relationshipStatus = 0 //relationshipContractInstance.get_contractStatus();
31
27
  const relationshipType = 0;
@@ -12,15 +12,14 @@ async function syncJobs(marketAddress) {
12
12
  toBlock: 'latest',
13
13
  topics: ['WorkRelationshipCreated(address,address,address)']
14
14
  }).then((logs) => {
15
- console.log('Found logs.. Processing sync Jobs')
16
15
  logs.forEach(log => {
17
16
  if (log && Array.isArray(log.topics) && log.topics.length) {
18
17
  processLog(log); // keccashinside here
19
18
  }
20
19
  })
21
20
  })
22
- .catch(err => {
23
- console.log('Err on fetching logs from blockchain: ' + err)
21
+ .catch(error => {
22
+ console.log(error)
24
23
  })
25
24
  }
26
25
  }
@@ -1,27 +0,0 @@
1
- import opportunityService from "../OpportunityService";
2
- import { processLog } from './process/process-log';
3
- import * as addressMap from '../blockchain/addresses.json';
4
- import { Contracts } from '../constants';
5
-
6
- async function syncMarketDisputes(marketAddress) {
7
- if (opportunityService.getProviderInterface()) {
8
- await opportunityService.getProviderInterface().getLogs({
9
- address: marketAddress,
10
- fromBlock: 1,
11
- toBlock: 'latest',
12
- topics: ['MarketDispute(address,address,address,address,address)']
13
- }).then((logs) => {
14
- console.log('Found logs.. Processing sync market disputes')
15
- logs.forEach(log => {
16
- if (log && Array.isArray(log.topics) && log.topics.length) {
17
- processLog(log); // keccashinside here
18
- }
19
- })
20
- })
21
- .catch(err => {
22
- console.log('Err on fetching logs from blockchain: ' + err)
23
- })
24
- }
25
- }
26
-
27
- export default syncMarketDisputes;
@@ -4,7 +4,6 @@ import { Contracts } from '../constants';
4
4
  import { processLog } from './process/process-log';
5
5
 
6
6
  async function syncMarkets() {
7
- console.log('syncMarkets: ' + addressMap[opportunityService.getEthNetwork()][Contracts.MARKET_FACTORY])
8
7
  if (opportunityService.getProviderInterface()) {
9
8
  //sync Markets
10
9
  await opportunityService.getProviderInterface().getLogs({
@@ -12,16 +11,15 @@ async function syncMarkets() {
12
11
  fromBlock: 1,
13
12
  toBlock: 'latest'
14
13
  }).then((logs) => {
15
- console.log('Found logs.. Processing...')
16
- console.log(logs)
14
+
17
15
  logs.forEach(log => {
18
16
  if (log && Array.isArray(log.topics) && log.topics.length) {
19
17
  processLog(log); // keccashinside here
20
18
  }
21
19
  })
22
20
  })
23
- .catch(err => {
24
- console.log('Err on fetching logs from blockchain: ' + err)
21
+ .catch(error => {
22
+ console.log(error)
25
23
  })
26
24
  }
27
25
  }
package/src/types.ts CHANGED
@@ -38,36 +38,4 @@ export type FilterParams = {
38
38
  fromBlock: string | number,
39
39
  toBlock: string | number,
40
40
  address: string
41
- }
42
-
43
- /* Contracts */
44
-
45
- export type WorkRelationshipMetadata = {
46
- solution: any,
47
- attachments: Array<string>,
48
- definitionOfDone: string,
49
- desiredDuration: string,
50
- description: string,
51
- }
52
-
53
- export interface EventCallbackDictionary { [eventName : string]: () => any }
54
-
55
-
56
- export type DisputeDoc = {
57
- _id: string,
58
- collection: string, //dispute
59
- disputeAddress: string,
60
- vocdoniProcessId: string
61
- }
62
-
63
- export type WorkRelationshipDoc = {
64
- _id: string,
65
- collection: string //relationship
66
- }
67
-
68
- export type UserSummaryDoc = {
69
- _id: string,
70
- collection: string, //summary
71
- universalAddress: string,
72
- userSummaryAddress: string
73
41
  }
@@ -1,33 +0,0 @@
1
- import { Contracts, ExchangeEvents } from '../../constants';
2
- import * as abiMap from '../../blockchain/abi.json';
3
- import { ethers } from 'ethers';
4
- import opportunityEventEmitter from '../../events/OpportunityEventEmitter';
5
- /**
6
- * WorkRelationshipCreated(address owner, address relationship, address market)
7
- * @param log
8
- * @returns
9
- */
10
- function processDisputeInvolvement(log) {
11
- try {
12
- const iface = new ethers.utils.Interface(abiMap[Contracts.DISPUTE]);
13
- const decodedLog = iface.parseLog(log);
14
- const { args, signature } = decodedLog;
15
- const employer = args[0];
16
- const worker = args[1];
17
- const relationship = args[2];
18
- const disputeAddress = args[3];
19
- const disputeData = {
20
- employer,
21
- worker,
22
- relationship,
23
- address: disputeAddress
24
- };
25
- console.log("Processing a dispute created event with address: " + disputeData);
26
- opportunityEventEmitter.emit(ExchangeEvents.DisputeInvolvement, disputeData);
27
- }
28
- catch (error) {
29
- console.log(error);
30
- }
31
- }
32
- export { processDisputeInvolvement };
33
- //# sourceMappingURL=processDisputeInvolvement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processDisputeInvolvement.js","sourceRoot":"","sources":["../../../src/sync/process/processDisputeInvolvement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAgB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,uBAAuB,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,GAAG;IAClC,IAAI;QACJ,MAAM,KAAK,GAAe,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,MAAM,UAAU,GAAoB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QAEvC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACtB,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAC5B,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAE/B,MAAM,WAAW,GAAG;YAChB,QAAQ;YACR,MAAM;YACN,YAAY;YACZ,OAAO,EAAE,cAAc;SAC1B,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,mDAAmD,GAAG,WAAW,CAAC,CAAA;QAE9E,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;KAChF;IAAC,OAAM,KAAK,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;KACrB;AACD,CAAC;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -1,34 +0,0 @@
1
- import { Contracts, ExchangeEvents } from '../../constants';
2
- import * as abiMap from '../../blockchain/abi.json';
3
- import { ethers } from 'ethers';
4
- import opportunityEventEmitter from '../../events/OpportunityEventEmitter';
5
- /**
6
- * WorkRelationshipCreated(address owner, address relationship, address market)
7
- * @param log
8
- * @returns
9
- */
10
- function processMarketDispute(log) {
11
- try {
12
- const iface = new ethers.utils.Interface(abiMap[Contracts.DISPUTE]);
13
- const decodedLog = iface.parseLog(log);
14
- const { args, signature } = decodedLog;
15
- const employer = args[0];
16
- const worker = args[1];
17
- const relationship = args[2];
18
- const disputeAddress = args[3];
19
- const marketAddress = args[4];
20
- const disputeData = {
21
- employer,
22
- worker,
23
- relationship,
24
- address: disputeAddress
25
- };
26
- console.log("Processing a dispute created in the market: " + marketAddress);
27
- opportunityEventEmitter.emit(ExchangeEvents.MarketDispute, disputeData);
28
- }
29
- catch (error) {
30
- console.log(error);
31
- }
32
- }
33
- export { processMarketDispute };
34
- //# sourceMappingURL=processMarketDisputes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processMarketDisputes.js","sourceRoot":"","sources":["../../../src/sync/process/processMarketDisputes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAgB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAIpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,uBAAuB,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,GAAG;IAC7B,IAAI;QACJ,MAAM,KAAK,GAAe,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAChF,MAAM,UAAU,GAAoB,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QAEvC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACtB,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAC5B,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAE7B,MAAM,WAAW,GAAG;YAChB,QAAQ;YACR,MAAM;YACN,YAAY;YACZ,OAAO,EAAE,cAAc;SAC1B,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,8CAA8C,GAAG,aAAa,CAAC,CAAA;QAE3E,uBAAuB,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;KAC3E;IAAC,OAAM,KAAK,EAAE;QACX,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;KACrB;AACD,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,37 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import opportunityService from "../OpportunityService";
11
- import { processLog } from './process/process-log';
12
- function syncCreatedDisputes(userSummaryAddress) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- if (opportunityService.getProviderInterface()) {
15
- yield opportunityService.getProviderInterface().getLogs({
16
- address: userSummaryAddress,
17
- fromBlock: 1,
18
- toBlock: 'latest',
19
- topics: [
20
- 'DisputeCreated(address,address,address,address)'
21
- ]
22
- }).then((logs) => {
23
- console.log('Found logs.. Processing sync disputes');
24
- logs.forEach(log => {
25
- if (log && Array.isArray(log.topics) && log.topics.length) {
26
- processLog(log); // keccashinside here
27
- }
28
- });
29
- })
30
- .catch(err => {
31
- console.log('Err on fetching logs from blockchain: ' + err);
32
- });
33
- }
34
- });
35
- }
36
- export default syncCreatedDisputes;
37
- //# sourceMappingURL=sync-disputes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync-disputes.js","sourceRoot":"","sources":["../../src/sync/sync-disputes.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,SAAe,mBAAmB,CAAC,kBAAkB;;QACjD,IAAI,kBAAkB,CAAC,oBAAoB,EAAE,EAAE;YAC9C,MAAM,kBAAkB,CAAC,oBAAoB,EAAE,CAAC,OAAO,CAAC;gBACrD,OAAO,EAAE,kBAAkB;gBAC3B,SAAS,EAAE,CAAC;gBACZ,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE;oBACJ,iDAAiD;iBACpD;aACJ,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACb,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;gBACpD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;oBACf,IAAI,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE;wBACvD,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,qBAAqB;qBACzC;gBACL,CAAC,CAAC,CAAA;YACN,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,CAAC,EAAE;gBACT,OAAO,CAAC,GAAG,CAAC,wCAAwC,GAAG,GAAG,CAAC,CAAA;YAC/D,CAAC,CAAC,CAAA;SACL;IACD,CAAC;CAAA;AAED,eAAe,mBAAmB,CAAC"}
@@ -1,42 +0,0 @@
1
- import { Contracts, ExchangeEvents, MarketEvents } from '../../constants';
2
- import * as abiMap from '../../blockchain/abi.json';
3
- import * as addressMap from '../../blockchain/addresses.json';
4
- import opportunityService from '../../OpportunityService';
5
- import { Contract } from '@ethersproject/contracts';
6
- import { ethers } from 'ethers';
7
- import { AbiCoder, EventFragment, Interface, LogDescription, Result } from '@ethersproject/abi';
8
- import opportunityEventEmitter from '../../events/OpportunityEventEmitter';
9
-
10
-
11
- /**
12
- * WorkRelationshipCreated(address owner, address relationship, address market)
13
- * @param log
14
- * @returns
15
- */
16
- function processDisputeInvolvement(log) {
17
- try {
18
- const iface : Interface = new ethers.utils.Interface(abiMap[Contracts.DISPUTE]);
19
- const decodedLog : LogDescription = iface.parseLog(log);
20
- const { args, signature } = decodedLog;
21
-
22
- const employer = args[0]
23
- const worker = args[1]
24
- const relationship = args[2]
25
- const disputeAddress = args[3];
26
-
27
- const disputeData = {
28
- employer,
29
- worker,
30
- relationship,
31
- address: disputeAddress
32
- }
33
-
34
- console.log("Processing a dispute created event with address: " + disputeData)
35
-
36
- opportunityEventEmitter.emit(ExchangeEvents.DisputeInvolvement, disputeData);
37
- } catch(error) {
38
- console.log(error)
39
- }
40
- }
41
-
42
- export { processDisputeInvolvement };
@@ -1,43 +0,0 @@
1
- import { Contracts, ExchangeEvents, MarketEvents } from '../../constants';
2
- import * as abiMap from '../../blockchain/abi.json';
3
- import * as addressMap from '../../blockchain/addresses.json';
4
- import opportunityService from '../../OpportunityService';
5
- import { Contract } from '@ethersproject/contracts';
6
- import { ethers } from 'ethers';
7
- import { AbiCoder, EventFragment, Interface, LogDescription, Result } from '@ethersproject/abi';
8
- import opportunityEventEmitter from '../../events/OpportunityEventEmitter';
9
-
10
-
11
- /**
12
- * WorkRelationshipCreated(address owner, address relationship, address market)
13
- * @param log
14
- * @returns
15
- */
16
- function processMarketDispute(log) {
17
- try {
18
- const iface : Interface = new ethers.utils.Interface(abiMap[Contracts.DISPUTE]);
19
- const decodedLog : LogDescription = iface.parseLog(log);
20
- const { args, signature } = decodedLog;
21
-
22
- const employer = args[0]
23
- const worker = args[1]
24
- const relationship = args[2]
25
- const disputeAddress = args[3];
26
- const marketAddress = args[4]
27
-
28
- const disputeData = {
29
- employer,
30
- worker,
31
- relationship,
32
- address: disputeAddress
33
- }
34
-
35
- console.log("Processing a dispute created in the market: " + marketAddress)
36
-
37
- opportunityEventEmitter.emit(ExchangeEvents.MarketDispute, disputeData);
38
- } catch(error) {
39
- console.log(error)
40
- }
41
- }
42
-
43
- export { processMarketDispute };
@@ -1,29 +0,0 @@
1
- import opportunityService from "../OpportunityService";
2
- import { processLog } from './process/process-log';
3
- import * as addressMap from '../blockchain/addresses.json';
4
- import { Contracts } from '../constants';
5
-
6
- async function syncCreatedDisputes(userSummaryAddress) {
7
- if (opportunityService.getProviderInterface()) {
8
- await opportunityService.getProviderInterface().getLogs({
9
- address: userSummaryAddress,
10
- fromBlock: 1,
11
- toBlock: 'latest',
12
- topics: [
13
- 'DisputeCreated(address,address,address,address)'
14
- ]
15
- }).then((logs) => {
16
- console.log('Found logs.. Processing sync disputes')
17
- logs.forEach(log => {
18
- if (log && Array.isArray(log.topics) && log.topics.length) {
19
- processLog(log); // keccashinside here
20
- }
21
- })
22
- })
23
- .catch(err => {
24
- console.log('Err on fetching logs from blockchain: ' + err)
25
- })
26
- }
27
- }
28
-
29
- export default syncCreatedDisputes;