Skip to content

Commit 693fb24

Browse files
authored
chore: update dependencies and add ESLint configuration (#430)
1 parent bbb739c commit 693fb24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+9822
-7188
lines changed

packages/sharing-smart-contract/.env.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
WALLET_PRIVATE_KEY=...
33

44
# environment to use for configuration (prod/staging)
5-
ENV=prod
5+
ENV=...
66

77
# IExec PoCo contract address override (deploy script only)
8-
# POCO_ADDRESS=0x...
8+
POCO_ADDRESS=...
99

1010
# DatasetRegistry contract address override (deploy script only)
11-
# DATASET_REGISTRY_ADDRESS=0x...
11+
DATASET_REGISTRY_ADDRESS=...

packages/sharing-smart-contract/.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/sharing-smart-contract/.eslintrc.json

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.yml
2+
*json
3+
*.md
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"printWidth": 120,
2+
"printWidth": 100,
33
"singleQuote": true,
4-
"tabWidth": 2,
4+
"tabWidth": 4,
55
"trailingComma": "all",
6-
"arrowParens": "avoid",
7-
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-solidity"],
6+
"endOfLine": "auto",
7+
"plugins": [
8+
"prettier-plugin-organize-imports",
9+
"prettier-plugin-solidity"
10+
],
811
"overrides": [
9-
{
10-
"files": "*.sol",
11-
"options": {
12-
"singleQuote": false,
13-
"tabWidth": 4
14-
}
15-
}
12+
{
13+
"files": "*.sol",
14+
"options": {
15+
"singleQuote": false
16+
}
17+
}
1618
]
1719
}
Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
{
2-
"extends": ["solhint:recommended"],
2+
"extends": [
3+
"solhint:recommended"
4+
],
35
"plugins": [],
46
"rules": {
5-
"func-visibility": ["warn", { "ignoreConstructors":true }],
6-
"quotes": ["double"]
7+
"compiler-version": [
8+
"error",
9+
"^0.8.19"
10+
],
11+
"func-visibility": [
12+
"warn",
13+
{
14+
"ignoreConstructors": true
15+
}
16+
],
17+
"quotes": [
18+
"error",
19+
"double"
20+
]
721
}
822
}

packages/sharing-smart-contract/abis/DataProtectorSharing.sol/DataProtectorSharing.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
},
196196
{
197197
"inputs": [],
198-
"name": "FailedInnerCall",
198+
"name": "FailedCall",
199199
"type": "error"
200200
},
201201
{

packages/sharing-smart-contract/abis/registry/AddOnlyAppWhitelistRegistry.sol/AddOnlyAppWhitelistRegistry.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
"stateMutability": "nonpayable",
55
"type": "constructor"
66
},
7-
{
8-
"inputs": [],
9-
"name": "ERC1167FailedCreateClone",
10-
"type": "error"
11-
},
127
{
138
"inputs": [
149
{
@@ -112,6 +107,27 @@
112107
"name": "ERC721NonexistentToken",
113108
"type": "error"
114109
},
110+
{
111+
"inputs": [],
112+
"name": "FailedDeployment",
113+
"type": "error"
114+
},
115+
{
116+
"inputs": [
117+
{
118+
"internalType": "uint256",
119+
"name": "balance",
120+
"type": "uint256"
121+
},
122+
{
123+
"internalType": "uint256",
124+
"name": "needed",
125+
"type": "uint256"
126+
}
127+
],
128+
"name": "InsufficientBalance",
129+
"type": "error"
130+
},
115131
{
116132
"inputs": [],
117133
"name": "InvalidInitialization",

packages/sharing-smart-contract/contracts/DataProtectorSharing.sol

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ contract DataProtectorSharing is
166166
_workerpoolOrder.category
167167
);
168168

169-
dealid = POCO_DELEGATE.matchOrders(_appOrder, _datasetOrder, _workerpoolOrder, requestOrder);
169+
dealid = POCO_DELEGATE.matchOrders(
170+
_appOrder,
171+
_datasetOrder,
172+
_workerpoolOrder,
173+
requestOrder
174+
);
170175
emit ProtectedDataConsumed(dealid, _protectedData, _mode);
171176
}
172177

@@ -178,7 +183,11 @@ contract DataProtectorSharing is
178183

179184
// Overide burn function from ERC721BurnableUpgradeable.
180185
// Enable to burn a collectionTokenID.
181-
function _update(address to, uint256 _collectionTokenId, address auth) internal virtual override returns (address) {
186+
function _update(
187+
address to,
188+
uint256 _collectionTokenId,
189+
address auth
190+
) internal virtual override returns (address) {
182191
CollectionDetails storage _collectionDetails = collectionDetails[_collectionTokenId];
183192
if (to == address(0)) {
184193
if (_collectionDetails.size > 0) {
@@ -192,7 +201,10 @@ contract DataProtectorSharing is
192201
}
193202

194203
/// @inheritdoc IDataProtectorSharing
195-
function getProtectedDataRenter(address _protectedData, address _renterAddress) public view returns (uint48) {
204+
function getProtectedDataRenter(
205+
address _protectedData,
206+
address _renterAddress
207+
) public view returns (uint48) {
196208
return protectedDataDetails[_protectedData].renters[_renterAddress];
197209
}
198210

@@ -205,7 +217,12 @@ contract DataProtectorSharing is
205217
}
206218

207219
/// @inheritdoc IDataProtectorSharing
208-
function receiveApproval(address _sender, uint256, address, bytes calldata _extraData) public returns (bool) {
220+
function receiveApproval(
221+
address _sender,
222+
uint256,
223+
address,
224+
bytes calldata _extraData
225+
) public returns (bool) {
209226
if (msg.sender != address(POCO_DELEGATE)) {
210227
revert OnlyPocoCallerAuthorized(msg.sender);
211228
}
@@ -229,7 +246,10 @@ contract DataProtectorSharing is
229246
_rentProtectedData(protectedData, _sender, rentingParams);
230247
return true;
231248
} else if (selector == this.buyProtectedData.selector) {
232-
(address protectedData, address to, uint72 price) = abi.decode(_extraData[4:], (address, address, uint72));
249+
(address protectedData, address to, uint72 price) = abi.decode(
250+
_extraData[4:],
251+
(address, address, uint72)
252+
);
233253
_buyProtectedData(protectedData, _sender, to, price);
234254
return true;
235255
}
@@ -291,7 +311,11 @@ contract DataProtectorSharing is
291311

292312
delete protectedDataDetails[_protectedData];
293313
collectionDetails[_collectionTokenId].size -= 1;
294-
PROTECTED_DATA_REGISTRY.safeTransferFrom(address(this), msg.sender, uint256(uint160(_protectedData)));
314+
PROTECTED_DATA_REGISTRY.safeTransferFrom(
315+
address(this),
316+
msg.sender,
317+
uint256(uint160(_protectedData))
318+
);
295319
emit ProtectedDataTransfer(_protectedData, 0, _collectionTokenId, address(0));
296320
}
297321

@@ -327,7 +351,11 @@ contract DataProtectorSharing is
327351
_collectionDetails.lastSubscriptionExpiration = uint48(
328352
Math.max(endDate, _collectionDetails.lastSubscriptionExpiration)
329353
);
330-
POCO_DELEGATE.transferFrom(spender, ownerOf(_collectionTokenId), _collectionDetails.subscriptionParams.price);
354+
POCO_DELEGATE.transferFrom(
355+
spender,
356+
ownerOf(_collectionTokenId),
357+
_collectionDetails.subscriptionParams.price
358+
);
331359
emit NewSubscription(_collectionTokenId, spender, endDate);
332360
}
333361

@@ -354,7 +382,10 @@ contract DataProtectorSharing is
354382
}
355383

356384
/// @inheritdoc ISubscription
357-
function setSubscriptionParams(uint256 _collectionTokenId, SubscriptionParams calldata _subscriptionParams) public {
385+
function setSubscriptionParams(
386+
uint256 _collectionTokenId,
387+
SubscriptionParams calldata _subscriptionParams
388+
) public {
358389
_checkCollectionOperator(_collectionTokenId);
359390

360391
collectionDetails[_collectionTokenId].subscriptionParams = _subscriptionParams;
@@ -405,7 +436,10 @@ contract DataProtectorSharing is
405436
}
406437

407438
/// @inheritdoc IRental
408-
function setProtectedDataToRenting(address _protectedData, RentingParams calldata _rentingParams) public {
439+
function setProtectedDataToRenting(
440+
address _protectedData,
441+
RentingParams calldata _rentingParams
442+
) public {
409443
ProtectedDataDetails storage _protectedDataDetails = protectedDataDetails[_protectedData];
410444
uint256 _collectionTokenId = _protectedDataDetails.collection;
411445
_checkCollectionOperator(_collectionTokenId);
@@ -436,14 +470,23 @@ contract DataProtectorSharing is
436470
return _buyProtectedData(_protectedData, msg.sender, _to, _price);
437471
}
438472

439-
function _buyProtectedData(address _protectedData, address spender, address _to, uint72 _price) private {
473+
function _buyProtectedData(
474+
address _protectedData,
475+
address spender,
476+
address _to,
477+
uint72 _price
478+
) private {
440479
ProtectedDataDetails storage _protectedDataDetails = protectedDataDetails[_protectedData];
441480
_checkProtectedDataForSale(_protectedData);
442481
if (_protectedDataDetails.sellingParams.price != _price) {
443482
revert InvalidPriceForPurchase(_protectedData, _price);
444483
}
445484

446-
PROTECTED_DATA_REGISTRY.safeTransferFrom(address(this), _to, uint256(uint160(_protectedData)));
485+
PROTECTED_DATA_REGISTRY.safeTransferFrom(
486+
address(this),
487+
_to,
488+
uint256(uint160(_protectedData))
489+
);
447490
POCO_DELEGATE.transferFrom(
448491
spender,
449492
ownerOf(_protectedDataDetails.collection),

0 commit comments

Comments
 (0)