@lukso/lsp-smart-contracts 0.10.3 → 0.11.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CONTRIBUTING.md +184 -0
  2. package/artifacts/LSP0ERC725Account.json +2 -2
  3. package/artifacts/LSP0ERC725AccountInit.json +2 -2
  4. package/artifacts/LSP6KeyManager.json +2 -2
  5. package/artifacts/LSP6KeyManagerInit.json +2 -2
  6. package/artifacts/LSP7CompatibleERC20Mintable.json +2 -2
  7. package/artifacts/LSP7CompatibleERC20MintableInit.json +2 -2
  8. package/artifacts/LSP8CompatibleERC721Mintable.json +2 -2
  9. package/artifacts/LSP8CompatibleERC721MintableInit.json +2 -2
  10. package/artifacts/LSP9Vault.json +2 -2
  11. package/artifacts/LSP9VaultInit.json +2 -2
  12. package/artifacts/LinkedContractsFactory.json +544 -0
  13. package/artifacts/UniversalProfile.json +2 -2
  14. package/artifacts/UniversalProfileInit.json +2 -2
  15. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +1 -1
  16. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +6 -3
  17. package/contracts/LSP23LinkedContractsDeployment/ILinkedContractsFactory.sol +174 -0
  18. package/contracts/LSP23LinkedContractsDeployment/IPostDeploymentModule.sol +10 -0
  19. package/contracts/LSP23LinkedContractsDeployment/LSP23Errors.sol +24 -0
  20. package/contracts/LSP23LinkedContractsDeployment/LinkedContractsFactory.sol +384 -0
  21. package/contracts/LSP23LinkedContractsDeployment/modules/UniversalProfileInitPostDeploymentModule.sol +59 -0
  22. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +5 -5
  23. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +4 -4
  24. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +1 -1
  25. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
  26. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +5 -1
  27. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +1 -1
  28. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +1 -1
  29. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
  30. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +23 -23
  31. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +23 -23
  32. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +1 -1
  33. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +1 -1
  34. package/contracts/LSP9Vault/LSP9VaultCore.sol +7 -2
  35. package/devdocs/LinkedContractsFactory.json +81 -0
  36. package/dist/constants.cjs.js +602 -0
  37. package/dist/constants.d.ts +338 -0
  38. package/dist/constants.es.js +602 -0
  39. package/package.json +2 -1
  40. package/userdocs/LinkedContractsFactory.json +29 -0
@@ -364,7 +364,7 @@ abstract contract LSP6ExecuteModule {
364
364
  function _isAllowedAddress(
365
365
  bytes memory allowedCall,
366
366
  address to
367
- ) internal pure returns (bool) {
367
+ ) internal pure virtual returns (bool) {
368
368
  // <offset> = 4 bytes x 8 bits = 32 bits
369
369
  //
370
370
  // <offset>v----------------address---------------v
@@ -380,7 +380,7 @@ abstract contract LSP6ExecuteModule {
380
380
  function _isAllowedStandard(
381
381
  bytes memory allowedCall,
382
382
  address to
383
- ) internal view returns (bool) {
383
+ ) internal view virtual returns (bool) {
384
384
  // <offset> = 24 bytes x 8 bits = 192 bits
385
385
  //
386
386
  // standard
@@ -397,7 +397,7 @@ abstract contract LSP6ExecuteModule {
397
397
  function _isAllowedFunction(
398
398
  bytes memory allowedCall,
399
399
  bytes4 requiredFunction
400
- ) internal pure returns (bool) {
400
+ ) internal pure virtual returns (bool) {
401
401
  // <offset> = 28 bytes x 8 bits = 224 bits
402
402
  //
403
403
  // function
@@ -416,7 +416,7 @@ abstract contract LSP6ExecuteModule {
416
416
  function _isAllowedCallType(
417
417
  bytes memory allowedCall,
418
418
  bytes4 requiredCallTypes
419
- ) internal pure returns (bool) {
419
+ ) internal pure virtual returns (bool) {
420
420
  // extract callType
421
421
  //
422
422
  // <offset> = 0
@@ -438,7 +438,7 @@ abstract contract LSP6SetDataModule {
438
438
  bytes32 dataKey,
439
439
  bytes memory dataValue,
440
440
  bool hasBothAddControllerAndEditPermissions
441
- ) internal view returns (bytes32) {
441
+ ) internal view virtual returns (bytes32) {
442
442
  if (!LSP6Utils.isCompactBytesArrayOfAllowedERC725YDataKeys(dataValue)) {
443
443
  revert InvalidEncodedAllowedERC725YDataKeys(
444
444
  dataValue,
@@ -14,7 +14,11 @@ abstract contract LSP7Burnable is LSP7DigitalAsset {
14
14
  *
15
15
  * See internal _burn function for more details
16
16
  */
17
- function burn(address from, uint256 amount, bytes memory data) public {
17
+ function burn(
18
+ address from,
19
+ uint256 amount,
20
+ bytes memory data
21
+ ) public virtual {
18
22
  _burn(from, amount, data);
19
23
  }
20
24
  }
@@ -16,7 +16,11 @@ abstract contract LSP7BurnableInitAbstract is LSP7DigitalAssetInitAbstract {
16
16
  *
17
17
  * See internal _burn function for more details
18
18
  */
19
- function burn(address from, uint256 amount, bytes memory data) public {
19
+ function burn(
20
+ address from,
21
+ uint256 amount,
22
+ bytes memory data
23
+ ) public virtual {
20
24
  _burn(from, amount, data);
21
25
  }
22
26
  }
@@ -15,7 +15,7 @@ contract LSP7CompatibleERC20Mintable is LSP7CompatibleERC20 {
15
15
  uint256 amount,
16
16
  bool allowNonLSP1Recipient,
17
17
  bytes memory data
18
- ) public onlyOwner {
18
+ ) public virtual onlyOwner {
19
19
  _mint(to, amount, allowNonLSP1Recipient, data);
20
20
  }
21
21
  }
@@ -25,7 +25,7 @@ contract LSP7CompatibleERC20MintableInitAbstract is
25
25
  uint256 amount,
26
26
  bool allowNonLSP1Recipient,
27
27
  bytes memory data
28
- ) public onlyOwner {
28
+ ) public virtual onlyOwner {
29
29
  _mint(to, amount, allowNonLSP1Recipient, data);
30
30
  }
31
31
  }
@@ -13,7 +13,7 @@ import {LSP8NotTokenOperator} from "../LSP8Errors.sol";
13
13
  * their own tokens and those that they have an allowance for as an operator.
14
14
  */
15
15
  abstract contract LSP8Burnable is LSP8IdentifiableDigitalAssetCore {
16
- function burn(bytes32 tokenId, bytes memory data) public {
16
+ function burn(bytes32 tokenId, bytes memory data) public virtual {
17
17
  if (!_isOperatorOrOwner(msg.sender, tokenId)) {
18
18
  revert LSP8NotTokenOperator(tokenId, msg.sender);
19
19
  }
@@ -310,31 +310,31 @@ abstract contract LSP8CompatibleERC721 is
310
310
  uint256 tokenId,
311
311
  bytes memory data
312
312
  ) private returns (bool) {
313
- if (to.code.length > 0) {
314
- try
315
- IERC721Receiver(to).onERC721Received(
316
- msg.sender,
317
- from,
318
- tokenId,
319
- data
320
- )
321
- returns (bytes4 retval) {
322
- return retval == IERC721Receiver.onERC721Received.selector;
323
- } catch (bytes memory reason) {
324
- if (reason.length == 0) {
325
- revert(
326
- "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
327
- );
328
- } else {
329
- // solhint-disable no-inline-assembly
330
- /// @solidity memory-safe-assembly
331
- assembly {
332
- revert(add(32, reason), mload(reason))
333
- }
313
+ if (to.code.length == 0) {
314
+ return true;
315
+ }
316
+
317
+ try
318
+ IERC721Receiver(to).onERC721Received(
319
+ msg.sender,
320
+ from,
321
+ tokenId,
322
+ data
323
+ )
324
+ returns (bytes4 retval) {
325
+ return retval == IERC721Receiver.onERC721Received.selector;
326
+ } catch (bytes memory reason) {
327
+ if (reason.length == 0) {
328
+ revert(
329
+ "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
330
+ );
331
+ } else {
332
+ // solhint-disable no-inline-assembly
333
+ /// @solidity memory-safe-assembly
334
+ assembly {
335
+ revert(add(32, reason), mload(reason))
334
336
  }
335
337
  }
336
- } else {
337
- return true;
338
338
  }
339
339
  }
340
340
 
@@ -310,31 +310,31 @@ abstract contract LSP8CompatibleERC721InitAbstract is
310
310
  uint256 tokenId,
311
311
  bytes memory data
312
312
  ) private returns (bool) {
313
- if (to.code.length > 0) {
314
- try
315
- IERC721Receiver(to).onERC721Received(
316
- msg.sender,
317
- from,
318
- tokenId,
319
- data
320
- )
321
- returns (bytes4 retval) {
322
- return retval == IERC721Receiver.onERC721Received.selector;
323
- } catch (bytes memory reason) {
324
- if (reason.length == 0) {
325
- revert(
326
- "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
327
- );
328
- } else {
329
- // solhint-disable no-inline-assembly
330
- /// @solidity memory-safe-assembly
331
- assembly {
332
- revert(add(32, reason), mload(reason))
333
- }
313
+ if (to.code.length == 0) {
314
+ return true;
315
+ }
316
+
317
+ try
318
+ IERC721Receiver(to).onERC721Received(
319
+ msg.sender,
320
+ from,
321
+ tokenId,
322
+ data
323
+ )
324
+ returns (bytes4 retval) {
325
+ return retval == IERC721Receiver.onERC721Received.selector;
326
+ } catch (bytes memory reason) {
327
+ if (reason.length == 0) {
328
+ revert(
329
+ "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
330
+ );
331
+ } else {
332
+ // solhint-disable no-inline-assembly
333
+ /// @solidity memory-safe-assembly
334
+ assembly {
335
+ revert(add(32, reason), mload(reason))
334
336
  }
335
337
  }
336
- } else {
337
- return true;
338
338
  }
339
339
  }
340
340
 
@@ -15,7 +15,7 @@ contract LSP8CompatibleERC721Mintable is LSP8CompatibleERC721 {
15
15
  bytes32 tokenId,
16
16
  bool allowNonLSP1Recipient,
17
17
  bytes memory data
18
- ) public onlyOwner {
18
+ ) public virtual onlyOwner {
19
19
  _mint(to, tokenId, allowNonLSP1Recipient, data);
20
20
  }
21
21
  }
@@ -25,7 +25,7 @@ contract LSP8CompatibleERC721MintableInitAbstract is
25
25
  bytes32 tokenId,
26
26
  bool allowNonLSP1Recipient,
27
27
  bytes memory data
28
- ) public onlyOwner {
28
+ ) public virtual onlyOwner {
29
29
  _mint(to, tokenId, allowNonLSP1Recipient, data);
30
30
  }
31
31
  }
@@ -233,7 +233,7 @@ contract LSP9VaultCore is
233
233
  */
234
234
  function batchCalls(
235
235
  bytes[] calldata data
236
- ) public returns (bytes[] memory results) {
236
+ ) public virtual returns (bytes[] memory results) {
237
237
  results = new bytes[](data.length);
238
238
  for (uint256 i; i < data.length; ) {
239
239
  (bool success, bytes memory result) = address(this).delegatecall(
@@ -366,7 +366,12 @@ contract LSP9VaultCore is
366
366
  /**
367
367
  * @dev Modifier restricting the call to the owner of the contract and the UniversalReceiverDelegate
368
368
  */
369
- function _validateAndIdentifyCaller() internal view returns (bool isURD) {
369
+ function _validateAndIdentifyCaller()
370
+ internal
371
+ view
372
+ virtual
373
+ returns (bool isURD)
374
+ {
370
375
  if (msg.sender != owner()) {
371
376
  require(
372
377
  msg.sender == _reentrantDelegate,
@@ -0,0 +1,81 @@
1
+ {
2
+ "errors": {
3
+ "InvalidValueSum()": [
4
+ {
5
+ "details": "Reverts when the `msg.value` sent is not equal to the sum of value used for the deployment of the contract & its owner contract."
6
+ }
7
+ ],
8
+ "PrimaryContractProxyInitFailureError(bytes)": [
9
+ {
10
+ "details": "Reverts when the deployment & intialisation of the contract has failed.",
11
+ "params": {
12
+ "errorData": "Potentially information about why the deployment & intialisation have failed."
13
+ }
14
+ }
15
+ ],
16
+ "SecondaryContractProxyInitFailureError(bytes)": [
17
+ {
18
+ "details": "Reverts when the deployment & intialisation of the secondary contract has failed.",
19
+ "params": {
20
+ "errorData": "Potentially information about why the deployment & intialisation have failed."
21
+ }
22
+ }
23
+ ]
24
+ },
25
+ "kind": "dev",
26
+ "methods": {
27
+ "computeAddresses((bytes32,uint256,bytes),(uint256,bytes,bool,bytes),address,bytes)": {
28
+ "details": "Computes the addresses of a primary contract and a secondary linked contract",
29
+ "params": {
30
+ "postDeploymentModule": "The module to be executed after deployment",
31
+ "postDeploymentModuleCalldata": "The data to be passed to the post deployment module",
32
+ "primaryContractDeployment": "Contains the needed parameter to deploy the primary contract. (`salt`, `fundingAmount`, `creationBytecode`)",
33
+ "secondaryContractDeployment": "Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`)"
34
+ },
35
+ "returns": {
36
+ "primaryContractAddress": "The address of the deployed primary contract.",
37
+ "secondaryContractAddress": "The address of the deployed secondary contract."
38
+ }
39
+ },
40
+ "computeERC1167Addresses((bytes32,uint256,address,bytes),(uint256,address,bytes,bool,bytes),address,bytes)": {
41
+ "details": "Computes the addresses of a primary and a secondary linked contracts proxies to be created",
42
+ "params": {
43
+ "postDeploymentModule": "The module to be executed after deployment.",
44
+ "postDeploymentModuleCalldata": "The data to be passed to the post deployment module.",
45
+ "primaryContractDeploymentInit": "Contains the needed parameters to deploy a primary proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`)",
46
+ "secondaryContractDeploymentInit": "Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `addPrimaryContractAddress`, `initializationCalldata`, `extraInitializationParams`)"
47
+ },
48
+ "returns": {
49
+ "primaryContractAddress": "The address of the deployed primary contract proxy",
50
+ "secondaryContractAddress": "The address of the deployed secondary contract proxy"
51
+ }
52
+ },
53
+ "deployContracts((bytes32,uint256,bytes),(uint256,bytes,bool,bytes),address,bytes)": {
54
+ "details": "Deploys a primary and a secondary linked contract.",
55
+ "params": {
56
+ "postDeploymentModule": "The module to be executed after deployment",
57
+ "postDeploymentModuleCalldata": "The data to be passed to the post deployment module",
58
+ "primaryContractDeployment": "Contains the needed parameter to deploy a contract. (`salt`, `fundingAmount`, `creationBytecode`)",
59
+ "secondaryContractDeployment": "Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`)"
60
+ },
61
+ "returns": {
62
+ "primaryContractAddress": "The address of the primary contract.",
63
+ "secondaryContractAddress": "The address of the secondary contract."
64
+ }
65
+ },
66
+ "deployERC1167Proxies((bytes32,uint256,address,bytes),(uint256,address,bytes,bool,bytes),address,bytes)": {
67
+ "details": "Deploys proxies of a primary contract and a secondary linked contract",
68
+ "params": {
69
+ "postDeploymentModule": "The module to be executed after deployment.",
70
+ "postDeploymentModuleCalldata": "The data to be passed to the post deployment module.",
71
+ "primaryContractDeploymentInit": "Contains the needed parameters to deploy a proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`)",
72
+ "secondaryContractDeploymentInit": "Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `addPrimaryContractAddress`, `initializationCalldata`, `extraInitializationParams`)"
73
+ },
74
+ "returns": {
75
+ "primaryContractAddress": "The address of the deployed primary contract proxy",
76
+ "secondaryContractAddress": "The address of the deployed secondary contract proxy"
77
+ }
78
+ }
79
+ },
80
+ "version": 1
81
+ }