Skip to content

Commit 068fe2a

Browse files
authored
fix: format code (#65)
1 parent 7b1c57c commit 068fe2a

File tree

9 files changed

+243
-252
lines changed

9 files changed

+243
-252
lines changed

.prettierignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
*.graphql
22
*.md
33
*.yml
4-
5-
##TODO: To remove and format this folder in an other PR
6-
src/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
"dependencies": {
5959
"@iexec/poco": "^5.5.0"
6060
}
61-
}
61+
}

src/Modules/IexecCategoryManager.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
* limitations under the License. *
1515
******************************************************************************/
1616

17-
import { BigInt } from "@graphprotocol/graph-ts";
17+
import { BigInt } from '@graphprotocol/graph-ts';
1818

19-
import { CreateCategory as CreateCategoryEvent } from "../../generated/Core/IexecInterfaceToken";
19+
import { CreateCategory as CreateCategoryEvent } from '../../generated/Core/IexecInterfaceToken';
2020

21-
import { Category } from "../../generated/schema";
21+
import { Category } from '../../generated/schema';
2222

23-
import { fetchProtocol } from "../utils";
23+
import { fetchProtocol } from '../utils';
2424

2525
export function handleCreateCategory(event: CreateCategoryEvent): void {
26-
// categories may be redefined by the administrator
27-
let category = Category.load(event.params.catid.toString());
28-
29-
if (category == null) {
30-
category = new Category(event.params.catid.toString());
31-
32-
let protocol = fetchProtocol();
33-
protocol.categoriesCount = protocol.categoriesCount.plus(BigInt.fromI32(1));
34-
protocol.save();
35-
}
36-
37-
category.name = event.params.name;
38-
category.description = event.params.description;
39-
category.workClockTimeRef = event.params.workClockTimeRef;
40-
category.timestamp = event.block.timestamp;
41-
category.save();
26+
// categories may be redefined by the administrator
27+
let category = Category.load(event.params.catid.toString());
28+
29+
if (category == null) {
30+
category = new Category(event.params.catid.toString());
31+
32+
let protocol = fetchProtocol();
33+
protocol.categoriesCount = protocol.categoriesCount.plus(BigInt.fromI32(1));
34+
protocol.save();
35+
}
36+
37+
category.name = event.params.name;
38+
category.description = event.params.description;
39+
category.workClockTimeRef = event.params.workClockTimeRef;
40+
category.timestamp = event.block.timestamp;
41+
category.save();
4242
}

src/Modules/IexecERC20.ts

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -15,106 +15,106 @@
1515
******************************************************************************/
1616

1717
import {
18-
Transfer as TransferEvent,
19-
Reward as RewardEvent,
20-
Seize as SeizeEvent,
21-
Lock as LockEvent,
22-
Unlock as UnlockEvent,
23-
} from "../../generated/Core/IexecInterfaceToken";
18+
Lock as LockEvent,
19+
Reward as RewardEvent,
20+
Seize as SeizeEvent,
21+
Transfer as TransferEvent,
22+
Unlock as UnlockEvent,
23+
} from '../../generated/Core/IexecInterfaceToken';
2424

25-
import { Transfer, Reward, Seize, Lock, Unlock } from "../../generated/schema";
25+
import { Lock, Reward, Seize, Transfer, Unlock } from '../../generated/schema';
2626

2727
import {
28-
ADDRESS_ZERO,
29-
createEventID,
30-
fetchAccount,
31-
fetchProtocol,
32-
logTransaction,
33-
toRLC,
34-
} from "../utils";
28+
ADDRESS_ZERO,
29+
createEventID,
30+
fetchAccount,
31+
fetchProtocol,
32+
logTransaction,
33+
toRLC,
34+
} from '../utils';
3535

3636
export function handleTransfer(event: TransferEvent): void {
37-
let protocol = fetchProtocol();
38-
let value = toRLC(event.params.value);
39-
let from = fetchAccount(event.params.from.toHex());
40-
let to = fetchAccount(event.params.to.toHex());
41-
if (from.id == ADDRESS_ZERO) {
42-
protocol.tvl = protocol.tvl.plus(value);
43-
} else {
44-
from.balance = from.balance.minus(value);
45-
}
46-
if (to.id == ADDRESS_ZERO) {
47-
protocol.tvl = protocol.tvl.minus(value);
48-
} else {
49-
to.balance = to.balance.plus(value);
50-
}
51-
protocol.save();
52-
from.save();
53-
to.save();
54-
55-
let transferEvent = new Transfer(createEventID(event));
56-
transferEvent.transaction = logTransaction(event).id;
57-
transferEvent.timestamp = event.block.timestamp;
58-
transferEvent.from = from.id;
59-
transferEvent.to = to.id;
60-
transferEvent.value = value;
61-
transferEvent.save();
37+
let protocol = fetchProtocol();
38+
let value = toRLC(event.params.value);
39+
let from = fetchAccount(event.params.from.toHex());
40+
let to = fetchAccount(event.params.to.toHex());
41+
if (from.id == ADDRESS_ZERO) {
42+
protocol.tvl = protocol.tvl.plus(value);
43+
} else {
44+
from.balance = from.balance.minus(value);
45+
}
46+
if (to.id == ADDRESS_ZERO) {
47+
protocol.tvl = protocol.tvl.minus(value);
48+
} else {
49+
to.balance = to.balance.plus(value);
50+
}
51+
protocol.save();
52+
from.save();
53+
to.save();
54+
55+
let transferEvent = new Transfer(createEventID(event));
56+
transferEvent.transaction = logTransaction(event).id;
57+
transferEvent.timestamp = event.block.timestamp;
58+
transferEvent.from = from.id;
59+
transferEvent.to = to.id;
60+
transferEvent.value = value;
61+
transferEvent.save();
6262
}
6363

6464
export function handleReward(event: RewardEvent): void {
65-
let value = toRLC(event.params.amount);
66-
67-
let op = new Reward(createEventID(event));
68-
op.transaction = logTransaction(event).id;
69-
op.timestamp = event.block.timestamp;
70-
op.account = event.params.owner.toHex();
71-
op.value = value;
72-
op.task = event.params.ref.toHex();
73-
op.save();
65+
let value = toRLC(event.params.amount);
66+
67+
let op = new Reward(createEventID(event));
68+
op.transaction = logTransaction(event).id;
69+
op.timestamp = event.block.timestamp;
70+
op.account = event.params.owner.toHex();
71+
op.value = value;
72+
op.task = event.params.ref.toHex();
73+
op.save();
7474
}
7575

7676
export function handleSeize(event: SeizeEvent): void {
77-
let value = toRLC(event.params.amount);
78-
79-
let account = fetchAccount(event.params.owner.toHex());
80-
account.frozen = account.frozen.minus(value);
81-
account.save();
82-
83-
let op = new Seize(createEventID(event));
84-
op.transaction = logTransaction(event).id;
85-
op.timestamp = event.block.timestamp;
86-
op.account = event.params.owner.toHex();
87-
op.value = value;
88-
op.task = event.params.ref.toHex();
89-
op.save();
77+
let value = toRLC(event.params.amount);
78+
79+
let account = fetchAccount(event.params.owner.toHex());
80+
account.frozen = account.frozen.minus(value);
81+
account.save();
82+
83+
let op = new Seize(createEventID(event));
84+
op.transaction = logTransaction(event).id;
85+
op.timestamp = event.block.timestamp;
86+
op.account = event.params.owner.toHex();
87+
op.value = value;
88+
op.task = event.params.ref.toHex();
89+
op.save();
9090
}
9191

9292
export function handleLock(event: LockEvent): void {
93-
let value = toRLC(event.params.amount);
94-
95-
let account = fetchAccount(event.params.owner.toHex());
96-
account.frozen = account.frozen.plus(value);
97-
account.save();
98-
99-
let op = new Lock(createEventID(event));
100-
op.transaction = logTransaction(event).id;
101-
op.timestamp = event.block.timestamp;
102-
op.account = event.params.owner.toHex();
103-
op.value = value;
104-
op.save();
93+
let value = toRLC(event.params.amount);
94+
95+
let account = fetchAccount(event.params.owner.toHex());
96+
account.frozen = account.frozen.plus(value);
97+
account.save();
98+
99+
let op = new Lock(createEventID(event));
100+
op.transaction = logTransaction(event).id;
101+
op.timestamp = event.block.timestamp;
102+
op.account = event.params.owner.toHex();
103+
op.value = value;
104+
op.save();
105105
}
106106

107107
export function handleUnlock(event: UnlockEvent): void {
108-
let value = toRLC(event.params.amount);
109-
110-
let account = fetchAccount(event.params.owner.toHex());
111-
account.frozen = account.frozen.minus(value);
112-
account.save();
113-
114-
let op = new Unlock(createEventID(event));
115-
op.transaction = logTransaction(event).id;
116-
op.timestamp = event.block.timestamp;
117-
op.account = event.params.owner.toHex();
118-
op.value = value;
119-
op.save();
108+
let value = toRLC(event.params.amount);
109+
110+
let account = fetchAccount(event.params.owner.toHex());
111+
account.frozen = account.frozen.minus(value);
112+
account.save();
113+
114+
let op = new Unlock(createEventID(event));
115+
op.transaction = logTransaction(event).id;
116+
op.timestamp = event.block.timestamp;
117+
op.account = event.params.owner.toHex();
118+
op.value = value;
119+
op.save();
120120
}

src/Registries/Appregistry.ts

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,54 +14,54 @@
1414
* limitations under the License. *
1515
******************************************************************************/
1616

17-
import { BigInt } from "@graphprotocol/graph-ts";
17+
import { BigInt } from '@graphprotocol/graph-ts';
1818

19-
import { App as AppContract } from "../../generated/AppRegistry/App";
19+
import { App as AppContract } from '../../generated/AppRegistry/App';
2020

21-
import { Transfer as TransferEvent } from "../../generated/AppRegistry/AppRegistry";
21+
import { Transfer as TransferEvent } from '../../generated/AppRegistry/AppRegistry';
2222

23-
import { App, AppTransfer } from "../../generated/schema";
23+
import { App, AppTransfer } from '../../generated/schema';
2424

2525
import {
26-
createEventID,
27-
fetchAccount,
28-
fetchProtocol,
29-
logTransaction,
30-
intToAddress,
31-
ADDRESS_ZERO,
32-
} from "../utils";
26+
ADDRESS_ZERO,
27+
createEventID,
28+
fetchAccount,
29+
fetchProtocol,
30+
intToAddress,
31+
logTransaction,
32+
} from '../utils';
3333

3434
export function handleTransferApp(ev: TransferEvent): void {
35-
let contract = AppContract.bind(intToAddress(ev.params.tokenId));
35+
let contract = AppContract.bind(intToAddress(ev.params.tokenId));
3636

37-
let from = fetchAccount(ev.params.from.toHex());
38-
let to = fetchAccount(ev.params.to.toHex());
39-
from.save();
40-
to.save();
37+
let from = fetchAccount(ev.params.from.toHex());
38+
let to = fetchAccount(ev.params.to.toHex());
39+
from.save();
40+
to.save();
4141

42-
let app = new App(contract._address.toHex());
43-
app.owner = contract.owner().toHex();
44-
app.name = contract.m_appName();
45-
app.type = contract.m_appType();
46-
app.multiaddr = contract.m_appMultiaddr();
47-
app.checksum = contract.m_appChecksum();
48-
app.mrenclave = contract.m_appMREnclave();
49-
app.timestamp = ev.block.timestamp;
50-
app.usageCount = BigInt.zero();
51-
app.lastUsageTimestamp = BigInt.zero();
52-
app.save();
42+
let app = new App(contract._address.toHex());
43+
app.owner = contract.owner().toHex();
44+
app.name = contract.m_appName();
45+
app.type = contract.m_appType();
46+
app.multiaddr = contract.m_appMultiaddr();
47+
app.checksum = contract.m_appChecksum();
48+
app.mrenclave = contract.m_appMREnclave();
49+
app.timestamp = ev.block.timestamp;
50+
app.usageCount = BigInt.zero();
51+
app.lastUsageTimestamp = BigInt.zero();
52+
app.save();
5353

54-
let transfer = new AppTransfer(createEventID(ev));
55-
transfer.transaction = logTransaction(ev).id;
56-
transfer.timestamp = app.timestamp;
57-
transfer.app = app.id;
58-
transfer.from = from.id;
59-
transfer.to = to.id;
60-
transfer.save();
54+
let transfer = new AppTransfer(createEventID(ev));
55+
transfer.transaction = logTransaction(ev).id;
56+
transfer.timestamp = app.timestamp;
57+
transfer.app = app.id;
58+
transfer.from = from.id;
59+
transfer.to = to.id;
60+
transfer.save();
6161

62-
if (from.id == ADDRESS_ZERO) {
63-
let protocol = fetchProtocol();
64-
protocol.appsCount = protocol.appsCount.plus(BigInt.fromI32(1));
65-
protocol.save();
66-
}
62+
if (from.id == ADDRESS_ZERO) {
63+
let protocol = fetchProtocol();
64+
protocol.appsCount = protocol.appsCount.plus(BigInt.fromI32(1));
65+
protocol.save();
66+
}
6767
}

0 commit comments

Comments
 (0)