@lukso/lsp-smart-contracts 0.6.1 → 0.6.2
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.
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +8 -8
- package/artifacts/LSP0ERC725AccountInit.json +13 -8
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +18 -2
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +18 -2
- package/artifacts/LSP4DigitalAssetMetadata.json +10 -0
- package/artifacts/LSP4DigitalAssetMetadataInit.json +10 -0
- package/artifacts/LSP6KeyManager.json +82 -13
- package/artifacts/LSP6KeyManagerInit.json +87 -13
- package/artifacts/LSP7CappedSupply.json +10 -0
- package/artifacts/LSP7CappedSupplyInit.json +10 -28
- package/artifacts/LSP7CompatibleERC20.json +714 -0
- package/artifacts/LSP7CompatibleERC20Init.json +760 -0
- package/artifacts/LSP7CompatibleERC20Mintable.json +742 -0
- package/artifacts/LSP7CompatibleERC20MintableInit.json +783 -0
- package/artifacts/LSP7DigitalAsset.json +12 -2
- package/artifacts/LSP7DigitalAssetInit.json +17 -2
- package/artifacts/LSP7Mintable.json +12 -2
- package/artifacts/LSP7MintableInit.json +17 -2
- package/artifacts/LSP8CappedSupply.json +10 -0
- package/artifacts/LSP8CappedSupplyInit.json +10 -23
- package/artifacts/LSP8CompatibleERC721.json +842 -0
- package/artifacts/LSP8CompatibleERC721Init.json +883 -0
- package/artifacts/LSP8CompatibleERC721Mintable.json +881 -0
- package/artifacts/LSP8CompatibleERC721MintableInit.json +922 -0
- package/artifacts/LSP8IdentifiableDigitalAsset.json +12 -2
- package/artifacts/LSP8IdentifiableDigitalAssetInit.json +17 -2
- package/artifacts/LSP8Mintable.json +12 -2
- package/artifacts/LSP8MintableInit.json +17 -2
- package/artifacts/LSP9Vault.json +9 -9
- package/artifacts/LSP9VaultInit.json +14 -9
- package/artifacts/UniversalFactory.json +2 -2
- package/artifacts/UniversalProfile.json +8 -8
- package/artifacts/UniversalProfileInit.json +13 -8
- package/artifacts/UniversalReceiverAddressStore.json +2 -2
- package/constants.js +49 -14
- package/contracts/Custom/ClaimOwnership.sol +10 -7
- package/contracts/Custom/IClaimOwnership.sol +1 -1
- package/contracts/Factories/Create2Factory.sol +3 -13
- package/contracts/Factories/UniversalFactory.sol +16 -7
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +3 -3
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +28 -19
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +10 -3
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -2
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +12 -3
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +18 -16
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +8 -2
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +18 -4
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +9 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +69 -73
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +14 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +16 -4
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +16 -0
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +27 -1
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +15 -15
- package/contracts/LSP6KeyManager/LSP6Errors.sol +34 -5
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +5 -3
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +224 -234
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +10 -3
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +4 -2
- package/contracts/LSP6KeyManager/LSP6Utils.sol +22 -26
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +4 -0
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +3 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +11 -0
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +3 -1
- package/contracts/LSP7DigitalAsset/extensions/{ILSP7CompatibilityForERC20.sol → ILSP7CompatibleERC20.sol} +6 -6
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +5 -2
- package/contracts/LSP7DigitalAsset/extensions/{LSP7CompatibilityForERC20.sol → LSP7CompatibleERC20.sol} +6 -7
- package/contracts/LSP7DigitalAsset/extensions/{LSP7CompatibilityForERC20Core.sol → LSP7CompatibleERC20Core.sol} +21 -16
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Init.sol +29 -0
- package/contracts/LSP7DigitalAsset/extensions/{LSP7CompatibilityForERC20InitAbstract.sol → LSP7CompatibleERC20InitAbstract.sol} +11 -10
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +22 -0
- package/contracts/LSP7DigitalAsset/{extensions/LSP7CompatibilityForERC20Init.sol → presets/LSP7CompatibleERC20MintableInit.sol} +5 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +27 -0
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +8 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +10 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +3 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{ILSP8CompatibilityForERC721.sol → ILSP8CompatibleERC721.sol} +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +4 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityConstants.sol → LSP8CompatibleConstants.sol} +0 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721.sol → LSP8CompatibleERC721.sol} +12 -11
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721Core.sol → LSP8CompatibleERC721Core.sol} +16 -16
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721Init.sol → LSP8CompatibleERC721Init.sol} +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721InitAbstract.sol → LSP8CompatibleERC721InitAbstract.sol} +13 -9
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +22 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +23 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +27 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +7 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +3 -1
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +9 -5
- package/contracts/LSP9Vault/LSP9VaultCore.sol +37 -26
- package/contracts/LSP9Vault/LSP9VaultInit.sol +10 -3
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +8 -4
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +3 -1
- package/contracts/UniversalProfile.sol +3 -4
- package/contracts/UniversalProfileInit.sol +10 -3
- package/contracts/UniversalProfileInitAbstract.sol +3 -5
- package/contracts/Utils/UtilsLib.sol +6 -34
- package/package.json +2 -2
- package/artifacts/LSP7CompatibilityForERC20.json +0 -686
- package/artifacts/LSP7CompatibilityForERC20Init.json +0 -727
- package/artifacts/LSP8CompatibilityForERC721.json +0 -832
- package/artifacts/LSP8CompatibilityForERC721Init.json +0 -873
|
@@ -13,6 +13,29 @@ import {UtilsLib} from "../Utils/UtilsLib.sol";
|
|
|
13
13
|
// constants
|
|
14
14
|
import {_TYPEID_LSP7_TOKENSSENDER} from "../LSP7DigitalAsset/LSP7Constants.sol";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @dev reverts when the value stored under the 'LSP5ReceivedAssets[]' data key is not valid.
|
|
18
|
+
* The value stored under this data key should be exactly 32 bytes long.
|
|
19
|
+
*
|
|
20
|
+
* Only possible valid values are:
|
|
21
|
+
* - any valid uint256 values
|
|
22
|
+
* i.e. 0x0000000000000000000000000000000000000000000000000000000000000000 (zero), meaning empty array, no assets received.
|
|
23
|
+
* i.e. 0x0000000000000000000000000000000000000000000000000000000000000005 (non-zero), meaning 5 array elements, 5 assets received.
|
|
24
|
+
*
|
|
25
|
+
* - 0x (nothing stored under this data key, equivalent to empty array)
|
|
26
|
+
*
|
|
27
|
+
* @param invalidValue the invalid value stored under the LSP5ReceivedAssets[] data key
|
|
28
|
+
* @param invalidValueLength the invalid number of bytes stored under the LSP5ReceivedAssets[] data key (MUST be 32)
|
|
29
|
+
*/
|
|
30
|
+
error InvalidLSP5ReceivedAssetsArrayLength(bytes invalidValue, uint256 invalidValueLength);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @title LSP5Utils
|
|
34
|
+
* @author Yamen Merhi <YamenMerhi>, Jean Cavallera <CJ42>
|
|
35
|
+
* @dev LSP5Utils is a library of functions that are used to register and manage assets received by an ERC725Y smart contract
|
|
36
|
+
* based on the LSP5 - Received Assets standard
|
|
37
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-5-ReceivedAssets.md
|
|
38
|
+
*/
|
|
16
39
|
library LSP5Utils {
|
|
17
40
|
/**
|
|
18
41
|
* @dev Generating the data keys/values to be set on the account after receiving assets/vaults
|
|
@@ -66,7 +89,10 @@ library LSP5Utils {
|
|
|
66
89
|
keys[2] = mapKey;
|
|
67
90
|
values[2] = bytes.concat(interfaceID, bytes8(uint64(arrayLength)));
|
|
68
91
|
} else {
|
|
69
|
-
revert(
|
|
92
|
+
revert InvalidLSP5ReceivedAssetsArrayLength(
|
|
93
|
+
encodedArrayLength,
|
|
94
|
+
encodedArrayLength.length
|
|
95
|
+
);
|
|
70
96
|
}
|
|
71
97
|
}
|
|
72
98
|
|
|
@@ -11,7 +11,7 @@ interface ILSP6KeyManager is
|
|
|
11
11
|
IERC1271
|
|
12
12
|
/* is ERC165 */
|
|
13
13
|
{
|
|
14
|
-
event Executed(uint256 indexed
|
|
14
|
+
event Executed(uint256 indexed value, bytes4 selector);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @notice returns the address of the account linked to this KeyManager
|
|
@@ -25,31 +25,31 @@ interface ILSP6KeyManager is
|
|
|
25
25
|
function target() external view returns (address);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @notice get latest nonce for `
|
|
28
|
+
* @notice get latest nonce for `from` for channel ID: `channelId`
|
|
29
29
|
* @dev use channel ID = 0 for sequential nonces, any other number for out-of-order execution (= execution in parallel)
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
30
|
+
* @param from caller address
|
|
31
|
+
* @param channelId channel id
|
|
32
32
|
*/
|
|
33
|
-
function getNonce(address
|
|
33
|
+
function getNonce(address from, uint256 channelId) external view returns (uint256);
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @notice execute the following payload on the ERC725Account: `_calldata`
|
|
37
37
|
* @dev the ERC725Account will return some data on successful call, or revert on failure
|
|
38
|
-
* @param
|
|
39
|
-
* @return
|
|
38
|
+
* @param payload the payload to execute. Obtained in web3 via encodeABI()
|
|
39
|
+
* @return the data being returned by the ERC725 Account
|
|
40
40
|
*/
|
|
41
|
-
function execute(bytes calldata
|
|
41
|
+
function execute(bytes calldata payload) external payable returns (bytes memory);
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* @dev allows anybody to execute given they have a signed message from an executor
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @return
|
|
45
|
+
* @param signature bytes32 ethereum signature
|
|
46
|
+
* @param nonce the address' nonce (in a specific `_channel`), obtained via `getNonce(...)`. Used to prevent replay attack
|
|
47
|
+
* @param payload obtained via encodeABI() in web3
|
|
48
|
+
* @return the data being returned by the ERC725 Account
|
|
49
49
|
*/
|
|
50
50
|
function executeRelayCall(
|
|
51
|
-
bytes memory
|
|
52
|
-
uint256
|
|
53
|
-
bytes calldata
|
|
51
|
+
bytes memory signature,
|
|
52
|
+
uint256 nonce,
|
|
53
|
+
bytes calldata payload
|
|
54
54
|
) external payable returns (bytes memory);
|
|
55
55
|
}
|
|
@@ -2,36 +2,65 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @dev
|
|
5
|
+
* @dev reverts when address `from` does not have any permissions set
|
|
6
6
|
* on the account linked to this Key Manager
|
|
7
7
|
* @param from the address that does not have permissions
|
|
8
8
|
*/
|
|
9
9
|
error NoPermissionsSet(address from);
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* @dev address `from` is not authorised to `permission`
|
|
12
|
+
* @dev reverts when address `from` is not authorised to perform `permission` on the linked account
|
|
13
13
|
* @param permission permission required
|
|
14
14
|
* @param from address not-authorised
|
|
15
15
|
*/
|
|
16
16
|
error NotAuthorised(address from, string permission);
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @dev address `from` is not authorised to interact with `disallowedAddress` via account
|
|
19
|
+
* @dev reverts when address `from` is not authorised to interact with `disallowedAddress` via the linked account
|
|
20
20
|
* @param from address making the request
|
|
21
21
|
* @param disallowedAddress address that `from` is not authorised to call
|
|
22
22
|
*/
|
|
23
23
|
error NotAllowedAddress(address from, address disallowedAddress);
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* @dev address `from` is
|
|
26
|
+
* @dev reverts when address `from` is restricted to interact only with smart contracts implementing specific standard interface(s)
|
|
27
|
+
* and try to call an address `addressNotImplementingAllowedStandard` that does not implement one of this restricted standard interfaces.
|
|
28
|
+
* @param from address making the request
|
|
29
|
+
* @param addressNotImplementingAllowedStandard the address of the smart contract that `from` is trying to interact with,
|
|
30
|
+
* and that does not implement an allowed interface.
|
|
31
|
+
*/
|
|
32
|
+
error NotAllowedStandard(address from, address addressNotImplementingAllowedStandard);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @dev reverts when address `from` is not authorised to run `disallowedFunction` via the linked account
|
|
27
36
|
* @param from address making the request
|
|
28
37
|
* @param disallowedFunction bytes4 function selector that `from` is not authorised to run
|
|
29
38
|
*/
|
|
30
39
|
error NotAllowedFunction(address from, bytes4 disallowedFunction);
|
|
31
40
|
|
|
32
41
|
/**
|
|
33
|
-
* @dev address `from` is not authorised to set the key `disallowedKey` on the account
|
|
42
|
+
* @dev reverts when address `from` is not authorised to set the key `disallowedKey` on the linked account
|
|
34
43
|
* @param from address making the request
|
|
35
44
|
* @param disallowedKey a bytes32 key that `from` is not authorised to set on the ERC725Y storage
|
|
36
45
|
*/
|
|
37
46
|
error NotAllowedERC725YKey(address from, bytes32 disallowedKey);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @dev reverts when the address provided as a target (= account) linked to this KeyManager is invalid
|
|
50
|
+
* e.g. address(0)
|
|
51
|
+
*/
|
|
52
|
+
error InvalidLSP6Target();
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @dev reverts when the `signer` address retrieved from the `signature` has an invalid nonce: `invalidNonce`.
|
|
56
|
+
* @param signer the address of the signer
|
|
57
|
+
* @param invalidNonce the nonce retrieved for the `signer` address
|
|
58
|
+
* @param signature the signature used to retrieve the `signer` address
|
|
59
|
+
*/
|
|
60
|
+
error InvalidRelayNonce(address signer, uint256 invalidNonce, bytes signature);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @dev reverts when trying to run an invalid function on the linked target account via the Key Manager.
|
|
64
|
+
* @param invalidFunction the bytes4 selector of the invalid function
|
|
65
|
+
*/
|
|
66
|
+
error InvalidERC725Function(bytes4 invalidFunction);
|
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.6;
|
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {LSP6KeyManagerCore} from "./LSP6KeyManagerCore.sol";
|
|
6
|
+
import {InvalidLSP6Target} from "./LSP6Errors.sol";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @title Implementation of a contract acting as a controller of an ERC725 Account, using permissions stored in the ERC725Y storage
|
|
@@ -12,9 +13,10 @@ import {LSP6KeyManagerCore} from "./LSP6KeyManagerCore.sol";
|
|
|
12
13
|
contract LSP6KeyManager is LSP6KeyManagerCore {
|
|
13
14
|
/**
|
|
14
15
|
* @notice Initiate the account with the address of the ERC725Account contract and sets LSP6KeyManager InterfaceId
|
|
15
|
-
* @param
|
|
16
|
+
* @param target_ The address of the ER725Account to control
|
|
16
17
|
*/
|
|
17
|
-
constructor(address
|
|
18
|
-
|
|
18
|
+
constructor(address target_) {
|
|
19
|
+
if (target_ == address(0)) revert InvalidLSP6Target();
|
|
20
|
+
target = target_;
|
|
19
21
|
}
|
|
20
22
|
}
|