@lukso/lsp-smart-contracts 0.11.1 → 0.12.0
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/README.md +10 -2
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +68 -47
- package/artifacts/LSP0ERC725AccountInit.json +68 -47
- package/artifacts/LSP11BasicSocialRecovery.json +18 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
- package/artifacts/LSP16UniversalFactory.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +27 -46
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +27 -46
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +34 -6
- package/artifacts/LSP6KeyManagerInit.json +34 -6
- package/artifacts/LSP7CappedSupply.json +64 -4
- package/artifacts/LSP7CappedSupplyInitAbstract.json +64 -4
- package/artifacts/LSP7CompatibleERC20.json +83 -23
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +83 -23
- package/artifacts/LSP7CompatibleERC20Mintable.json +86 -26
- package/artifacts/LSP7CompatibleERC20MintableInit.json +86 -26
- package/artifacts/LSP7DigitalAsset.json +64 -4
- package/artifacts/LSP7DigitalAssetInitAbstract.json +64 -4
- package/artifacts/LSP7Mintable.json +67 -7
- package/artifacts/LSP7MintableInit.json +67 -7
- package/artifacts/LSP8CappedSupply.json +57 -3
- package/artifacts/LSP8CappedSupplyInitAbstract.json +57 -3
- package/artifacts/LSP8CompatibleERC721.json +79 -25
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +79 -25
- package/artifacts/LSP8CompatibleERC721Mintable.json +87 -28
- package/artifacts/LSP8CompatibleERC721MintableInit.json +87 -28
- package/artifacts/LSP8IdentifiableDigitalAsset.json +57 -3
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -3
- package/artifacts/LSP8Mintable.json +65 -6
- package/artifacts/LSP8MintableInit.json +65 -6
- package/artifacts/LSP9Vault.json +51 -35
- package/artifacts/LSP9VaultInit.json +51 -35
- package/artifacts/UniversalProfile.json +68 -47
- package/artifacts/UniversalProfileInit.json +68 -47
- package/contracts/Factories/Create2Factory.sol +1 -1
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -22
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +6 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +12 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +196 -123
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +11 -2
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +22 -15
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +6 -5
- package/contracts/LSP17Extensions/Extension4337.sol +101 -0
- package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +49 -33
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +33 -27
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +5 -48
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +64 -45
- package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
- package/contracts/LSP20CallVerification/LSP20Errors.sol +10 -4
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +176 -101
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +34 -28
- package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +70 -10
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +2 -2
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +29 -13
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +273 -265
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +28 -12
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +17 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +128 -54
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +129 -54
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +16 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +20 -6
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +67 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +143 -137
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +69 -15
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +172 -80
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +178 -91
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
- package/contracts/LSP9Vault/ILSP9Vault.sol +0 -21
- package/contracts/LSP9Vault/LSP9Constants.sol +6 -1
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +11 -2
- package/contracts/LSP9Vault/LSP9VaultCore.sol +119 -66
- package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -1
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
- package/contracts/UniversalProfile.sol +1 -1
- package/contracts/UniversalProfileInit.sol +1 -1
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Version.sol +16 -0
- package/devdocs/LSP0ERC725Account.json +86 -52
- package/devdocs/LSP0ERC725AccountInit.json +86 -52
- package/devdocs/LSP11BasicSocialRecovery.json +13 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
- package/devdocs/LSP16UniversalFactory.json +9 -9
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +7 -6
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +7 -6
- package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
- package/devdocs/LSP6KeyManager.json +27 -13
- package/devdocs/LSP6KeyManagerInit.json +27 -13
- package/devdocs/LSP7CappedSupply.json +61 -28
- package/devdocs/LSP7CappedSupplyInitAbstract.json +61 -28
- package/devdocs/LSP7CompatibleERC20.json +102 -32
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +102 -32
- package/devdocs/LSP7CompatibleERC20Mintable.json +102 -32
- package/devdocs/LSP7CompatibleERC20MintableInit.json +102 -32
- package/devdocs/LSP7DigitalAsset.json +61 -28
- package/devdocs/LSP7DigitalAssetInitAbstract.json +61 -28
- package/devdocs/LSP7Mintable.json +61 -28
- package/devdocs/LSP7MintableInit.json +61 -28
- package/devdocs/LSP8CappedSupply.json +66 -27
- package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -27
- package/devdocs/LSP8CompatibleERC721.json +93 -33
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +93 -33
- package/devdocs/LSP8CompatibleERC721Mintable.json +95 -35
- package/devdocs/LSP8CompatibleERC721MintableInit.json +96 -36
- package/devdocs/LSP8IdentifiableDigitalAsset.json +70 -28
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -27
- package/devdocs/LSP8Mintable.json +68 -29
- package/devdocs/LSP8MintableInit.json +69 -30
- package/devdocs/LSP9Vault.json +69 -41
- package/devdocs/LSP9VaultInit.json +69 -41
- package/devdocs/UniversalProfile.json +86 -52
- package/devdocs/UniversalProfileInit.json +86 -52
- package/dist/constants.cjs.js +5565 -2846
- package/dist/constants.d.ts +3996 -1182
- package/dist/constants.es.js +5564 -2846
- package/package.json +8 -8
- package/userdocs/LSP0ERC725Account.json +20 -11
- package/userdocs/LSP0ERC725AccountInit.json +20 -11
- package/userdocs/LSP16UniversalFactory.json +26 -1
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +4 -11
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +4 -11
- package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
- package/userdocs/LSP6KeyManager.json +3 -5
- package/userdocs/LSP6KeyManagerInit.json +3 -5
- package/userdocs/LSP7CappedSupply.json +17 -6
- package/userdocs/LSP7CappedSupplyInitAbstract.json +16 -5
- package/userdocs/LSP7CompatibleERC20.json +18 -5
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +18 -5
- package/userdocs/LSP7CompatibleERC20Mintable.json +18 -5
- package/userdocs/LSP7CompatibleERC20MintableInit.json +18 -5
- package/userdocs/LSP7DigitalAsset.json +18 -5
- package/userdocs/LSP7DigitalAssetInitAbstract.json +18 -5
- package/userdocs/LSP7Mintable.json +18 -5
- package/userdocs/LSP7MintableInit.json +18 -5
- package/userdocs/LSP8CappedSupply.json +16 -5
- package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -4
- package/userdocs/LSP8CompatibleERC721.json +30 -17
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +30 -17
- package/userdocs/LSP8CompatibleERC721Mintable.json +31 -18
- package/userdocs/LSP8CompatibleERC721MintableInit.json +32 -19
- package/userdocs/LSP8IdentifiableDigitalAsset.json +18 -5
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +17 -4
- package/userdocs/LSP8Mintable.json +18 -5
- package/userdocs/LSP8MintableInit.json +19 -6
- package/userdocs/LSP9Vault.json +23 -14
- package/userdocs/LSP9VaultInit.json +23 -14
- package/userdocs/UniversalProfile.json +20 -11
- package/userdocs/UniversalProfileInit.json +20 -11
- package/CONTRIBUTING.md +0 -184
- package/artifacts/LSP4Compatibility.json +0 -216
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
- package/devdocs/LSP4Compatibility.json +0 -79
- package/userdocs/LSP4Compatibility.json +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
@@ -19,9 +19,17 @@ import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
|
19
19
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
20
20
|
|
|
21
21
|
// constants
|
|
22
|
-
import {_INTERFACEID_LSP8} from "./LSP8Constants.sol";
|
|
22
|
+
import {_INTERFACEID_LSP8, _LSP8_TOKENID_TYPE_KEY} from "./LSP8Constants.sol";
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// errors
|
|
25
|
+
import {
|
|
26
|
+
LSP8TokenContractCannotHoldValue,
|
|
27
|
+
LSP8TokenIdTypeNotEditable
|
|
28
|
+
} from "./LSP8Errors.sol";
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
_LSP17_EXTENSION_PREFIX
|
|
32
|
+
} from "../LSP17ContractExtension/LSP17Constants.sol";
|
|
25
33
|
|
|
26
34
|
// errors
|
|
27
35
|
|
|
@@ -47,21 +55,39 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
47
55
|
LSP8IdentifiableDigitalAssetCore,
|
|
48
56
|
LSP17Extendable
|
|
49
57
|
{
|
|
58
|
+
/**
|
|
59
|
+
* @dev Initialize a `LSP8IdentifiableDigitalAsset` contract and set the tokenId type inside the ERC725Y storage of the contract.
|
|
60
|
+
* This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`.
|
|
61
|
+
*
|
|
62
|
+
* @param name_ The name of the token
|
|
63
|
+
* @param symbol_ The symbol of the token
|
|
64
|
+
* @param newOwner_ The owner of the the token-Metadata
|
|
65
|
+
* @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
|
|
66
|
+
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
|
|
67
|
+
*
|
|
68
|
+
* @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once
|
|
69
|
+
* and cannot be changed in the ERC725Y storage after the contract has been initialized.
|
|
70
|
+
*/
|
|
50
71
|
function _initialize(
|
|
51
72
|
string memory name_,
|
|
52
73
|
string memory symbol_,
|
|
53
|
-
address newOwner_
|
|
54
|
-
|
|
74
|
+
address newOwner_,
|
|
75
|
+
uint256 tokenIdType_
|
|
76
|
+
) internal virtual onlyInitializing {
|
|
55
77
|
LSP4DigitalAssetMetadataInitAbstract._initialize(
|
|
56
78
|
name_,
|
|
57
79
|
symbol_,
|
|
58
80
|
newOwner_
|
|
59
81
|
);
|
|
82
|
+
|
|
83
|
+
LSP4DigitalAssetMetadataInitAbstract._setData(
|
|
84
|
+
_LSP8_TOKENID_TYPE_KEY,
|
|
85
|
+
abi.encode(tokenIdType_)
|
|
86
|
+
);
|
|
60
87
|
}
|
|
61
88
|
|
|
62
89
|
// fallback function
|
|
63
90
|
|
|
64
|
-
// solhint-disable no-complex-fallback
|
|
65
91
|
/**
|
|
66
92
|
* @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
|
|
67
93
|
*
|
|
@@ -81,6 +107,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
81
107
|
*
|
|
82
108
|
* 2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert.
|
|
83
109
|
*/
|
|
110
|
+
// solhint-disable-next-line no-complex-fallback
|
|
84
111
|
fallback(
|
|
85
112
|
bytes calldata callData
|
|
86
113
|
) external payable virtual returns (bytes memory) {
|
|
@@ -90,11 +117,25 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
90
117
|
return _fallbackLSP17Extendable(callData);
|
|
91
118
|
}
|
|
92
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @dev Reverts whenever someone tries to send native tokens to a LSP8 contract.
|
|
122
|
+
* @notice LSP8 contract cannot receive native tokens.
|
|
123
|
+
*/
|
|
124
|
+
receive() external payable virtual {
|
|
125
|
+
// revert on empty calls with no value
|
|
126
|
+
if (msg.value == 0) {
|
|
127
|
+
revert InvalidFunctionSelector(hex"00000000");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
revert LSP8TokenContractCannotHoldValue();
|
|
131
|
+
}
|
|
132
|
+
|
|
93
133
|
/**
|
|
94
134
|
* @dev Forwards the call with the received value to an extension mapped to a function selector.
|
|
95
135
|
*
|
|
96
|
-
* Calls {
|
|
136
|
+
* Calls {_getExtensionAndForwardValue} to get the address of the extension mapped to the function selector being
|
|
97
137
|
* called on the account. If there is no extension, the address(0) will be returned.
|
|
138
|
+
* We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens.
|
|
98
139
|
*
|
|
99
140
|
* Reverts if there is no extension for the function being called.
|
|
100
141
|
*
|
|
@@ -102,16 +143,14 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
102
143
|
* CALL opcode, passing the {msg.data} appended with the 20 bytes of the {msg.sender} and
|
|
103
144
|
* 32 bytes of the {msg.value}
|
|
104
145
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.
|
|
146
|
+
* @custom:info The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract
|
|
147
|
+
* will be forwarded to the extension address mapped to the selector from `msg.sig`.
|
|
109
148
|
*/
|
|
110
149
|
function _fallbackLSP17Extendable(
|
|
111
150
|
bytes calldata callData
|
|
112
151
|
) internal virtual override returns (bytes memory) {
|
|
113
152
|
// If there is a function selector
|
|
114
|
-
address extension =
|
|
153
|
+
(address extension, ) = _getExtensionAndForwardValue(msg.sig);
|
|
115
154
|
|
|
116
155
|
// if no extension was found, revert
|
|
117
156
|
if (extension == address(0))
|
|
@@ -140,9 +179,9 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
140
179
|
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
|
|
141
180
|
* - If no extension is stored, returns the address(0).
|
|
142
181
|
*/
|
|
143
|
-
function
|
|
182
|
+
function _getExtensionAndForwardValue(
|
|
144
183
|
bytes4 functionSelector
|
|
145
|
-
) internal view virtual override returns (address) {
|
|
184
|
+
) internal view virtual override returns (address, bool) {
|
|
146
185
|
// Generate the data key relevant for the functionSelector being called
|
|
147
186
|
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
148
187
|
_LSP17_EXTENSION_PREFIX,
|
|
@@ -156,7 +195,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
156
195
|
if (extensionAddress.length != 20 && extensionAddress.length != 0)
|
|
157
196
|
revert InvalidExtensionAddress(extensionAddress);
|
|
158
197
|
|
|
159
|
-
return address(bytes20(extensionAddress));
|
|
198
|
+
return (address(bytes20(extensionAddress)), true);
|
|
160
199
|
}
|
|
161
200
|
|
|
162
201
|
/**
|
|
@@ -176,4 +215,19 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
176
215
|
super.supportsInterface(interfaceId) ||
|
|
177
216
|
LSP17Extendable._supportsInterfaceInERC165Extension(interfaceId);
|
|
178
217
|
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @inheritdoc LSP4DigitalAssetMetadataInitAbstract
|
|
221
|
+
* @dev The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed
|
|
222
|
+
* once the identifiable digital asset contract has been deployed.
|
|
223
|
+
*/
|
|
224
|
+
function _setData(
|
|
225
|
+
bytes32 dataKey,
|
|
226
|
+
bytes memory dataValue
|
|
227
|
+
) internal virtual override {
|
|
228
|
+
if (dataKey == _LSP8_TOKENID_TYPE_KEY) {
|
|
229
|
+
revert LSP8TokenIdTypeNotEditable();
|
|
230
|
+
}
|
|
231
|
+
LSP4DigitalAssetMetadataInitAbstract._setData(dataKey, dataValue);
|
|
232
|
+
}
|
|
179
233
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.4;
|
|
4
4
|
|
|
@@ -26,7 +26,7 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
|
|
|
26
26
|
error LSP8CappedSupplyCannotMintOverCap();
|
|
27
27
|
|
|
28
28
|
// --- Storage
|
|
29
|
-
uint256 private immutable
|
|
29
|
+
uint256 private immutable _TOKEN_SUPPLY_CAP;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @notice Deploying a `LSP8CappedSupply` token contract with max token supply cap set to `tokenSupplyCap_`.
|
|
@@ -43,13 +43,13 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
|
|
|
43
43
|
revert LSP8CappedSupplyRequired();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
_TOKEN_SUPPLY_CAP = tokenSupplyCap_;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// --- Token queries
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* @notice The maximum supply amount of tokens allowed to exist is `
|
|
52
|
+
* @notice The maximum supply amount of tokens allowed to exist is `_TOKEN_SUPPLY_CAP`.
|
|
53
53
|
*
|
|
54
54
|
* @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches
|
|
55
55
|
* reaches {totalSuuplyCap}, it is not possible to mint more tokens.
|
|
@@ -57,7 +57,7 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
|
|
|
57
57
|
* @return The maximum number of tokens that can exist in the contract.
|
|
58
58
|
*/
|
|
59
59
|
function tokenSupplyCap() public view virtual returns (uint256) {
|
|
60
|
-
return
|
|
60
|
+
return _TOKEN_SUPPLY_CAP;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// --- Transfer functionality
|
|
@@ -74,13 +74,13 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
|
|
|
74
74
|
function _mint(
|
|
75
75
|
address to,
|
|
76
76
|
bytes32 tokenId,
|
|
77
|
-
bool
|
|
77
|
+
bool force,
|
|
78
78
|
bytes memory data
|
|
79
79
|
) internal virtual override {
|
|
80
80
|
if (totalSupply() + 1 > tokenSupplyCap()) {
|
|
81
81
|
revert LSP8CappedSupplyCannotMintOverCap();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
super._mint(to, tokenId,
|
|
84
|
+
super._mint(to, tokenId, force, data);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.4;
|
|
4
4
|
|
|
@@ -77,13 +77,13 @@ abstract contract LSP8CappedSupplyInitAbstract is
|
|
|
77
77
|
function _mint(
|
|
78
78
|
address to,
|
|
79
79
|
bytes32 tokenId,
|
|
80
|
-
bool
|
|
80
|
+
bool force,
|
|
81
81
|
bytes memory data
|
|
82
82
|
) internal virtual override {
|
|
83
83
|
if (totalSupply() + 1 > tokenSupplyCap()) {
|
|
84
84
|
revert LSP8CappedSupplyCannotMintOverCap();
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
super._mint(to, tokenId,
|
|
87
|
+
super._mint(to, tokenId, force, data);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.12;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
6
|
import {
|
|
7
7
|
IERC721Receiver
|
|
8
|
-
} from "@openzeppelin/contracts/
|
|
9
|
-
import {ILSP8CompatibleERC721} from "./ILSP8CompatibleERC721.sol";
|
|
8
|
+
} from "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
|
|
10
9
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
IERC721Metadata,
|
|
11
|
+
IERC721
|
|
12
|
+
} from "@openzeppelin/contracts/interfaces/IERC721Metadata.sol";
|
|
13
13
|
|
|
14
14
|
// libraries
|
|
15
|
+
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
15
16
|
import {
|
|
16
17
|
EnumerableSet
|
|
17
18
|
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
18
|
-
import {
|
|
19
|
+
import {LSP1Utils} from "../../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
19
20
|
|
|
20
21
|
// modules
|
|
21
22
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
LSP8IdentifiableDigitalAsset,
|
|
26
|
-
LSP4DigitalAssetMetadata,
|
|
27
|
-
ERC725YCore
|
|
23
|
+
LSP8IdentifiableDigitalAssetCore,
|
|
24
|
+
LSP8IdentifiableDigitalAsset
|
|
28
25
|
} from "../LSP8IdentifiableDigitalAsset.sol";
|
|
29
|
-
import {
|
|
30
|
-
LSP8IdentifiableDigitalAssetCore
|
|
31
|
-
} from "../LSP8IdentifiableDigitalAssetCore.sol";
|
|
32
26
|
|
|
33
27
|
// errors
|
|
34
|
-
import
|
|
28
|
+
import {
|
|
29
|
+
LSP8NotTokenOwner,
|
|
30
|
+
LSP8CannotUseAddressZeroAsOperator,
|
|
31
|
+
LSP8TokenOwnerCannotBeOperator,
|
|
32
|
+
LSP8OperatorAlreadyAuthorized,
|
|
33
|
+
LSP8NotTokenOperator
|
|
34
|
+
} from "../LSP8Errors.sol";
|
|
35
35
|
|
|
36
36
|
// constants
|
|
37
37
|
import {
|
|
38
|
-
_LSP4_METADATA_KEY
|
|
38
|
+
_LSP4_METADATA_KEY,
|
|
39
|
+
_LSP4_TOKEN_NAME_KEY,
|
|
40
|
+
_LSP4_TOKEN_SYMBOL_KEY
|
|
39
41
|
} from "../../LSP4DigitalAssetMetadata/LSP4Constants.sol";
|
|
40
|
-
import {
|
|
41
|
-
_INTERFACEID_ERC721,
|
|
42
|
-
_INTERFACEID_ERC721METADATA
|
|
43
|
-
} from "././ILSP8CompatibleERC721.sol";
|
|
42
|
+
import {_TYPEID_LSP8_TOKENOPERATOR} from "../LSP8Constants.sol";
|
|
44
43
|
|
|
45
44
|
/**
|
|
46
45
|
* @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
|
|
47
46
|
*/
|
|
48
47
|
abstract contract LSP8CompatibleERC721 is
|
|
49
|
-
|
|
50
|
-
LSP4Compatibility,
|
|
48
|
+
IERC721Metadata,
|
|
51
49
|
LSP8IdentifiableDigitalAsset
|
|
52
50
|
{
|
|
51
|
+
using BytesLib for bytes;
|
|
53
52
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
53
|
+
using LSP1Utils for address;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* @dev Mapping from owner to operator approvals for backward compatibility with ERC721
|
|
@@ -68,8 +68,48 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
68
68
|
constructor(
|
|
69
69
|
string memory name_,
|
|
70
70
|
string memory symbol_,
|
|
71
|
-
address newOwner_
|
|
72
|
-
|
|
71
|
+
address newOwner_,
|
|
72
|
+
uint256 tokenIdType_
|
|
73
|
+
) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) {}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @inheritdoc IERC721Metadata
|
|
77
|
+
* @dev Returns the name of the token.
|
|
78
|
+
* For compatibility with clients & tools that expect ERC721.
|
|
79
|
+
*
|
|
80
|
+
* @return The name of the token
|
|
81
|
+
*/
|
|
82
|
+
function name() public view virtual override returns (string memory) {
|
|
83
|
+
bytes memory data = _getData(_LSP4_TOKEN_NAME_KEY);
|
|
84
|
+
return string(data);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @inheritdoc IERC721Metadata
|
|
89
|
+
* @dev Returns the symbol of the token, usually a shorter version of the name.
|
|
90
|
+
* For compatibility with clients & tools that expect ERC721.
|
|
91
|
+
*
|
|
92
|
+
* @return The symbol of the token
|
|
93
|
+
*/
|
|
94
|
+
function symbol() public view virtual override returns (string memory) {
|
|
95
|
+
bytes memory data = _getData(_LSP4_TOKEN_SYMBOL_KEY);
|
|
96
|
+
return string(data);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @inheritdoc LSP8IdentifiableDigitalAssetCore
|
|
101
|
+
*/
|
|
102
|
+
function balanceOf(
|
|
103
|
+
address tokenOwner
|
|
104
|
+
)
|
|
105
|
+
public
|
|
106
|
+
view
|
|
107
|
+
virtual
|
|
108
|
+
override(IERC721, LSP8IdentifiableDigitalAssetCore)
|
|
109
|
+
returns (uint256)
|
|
110
|
+
{
|
|
111
|
+
return super.balanceOf(tokenOwner);
|
|
112
|
+
}
|
|
73
113
|
|
|
74
114
|
/**
|
|
75
115
|
* @inheritdoc LSP8IdentifiableDigitalAsset
|
|
@@ -80,17 +120,22 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
80
120
|
public
|
|
81
121
|
view
|
|
82
122
|
virtual
|
|
83
|
-
override(IERC165,
|
|
123
|
+
override(IERC165, LSP8IdentifiableDigitalAsset)
|
|
84
124
|
returns (bool)
|
|
85
125
|
{
|
|
86
126
|
return
|
|
87
|
-
interfaceId ==
|
|
88
|
-
interfaceId ==
|
|
127
|
+
interfaceId == type(IERC721).interfaceId ||
|
|
128
|
+
interfaceId == type(IERC721Metadata).interfaceId ||
|
|
89
129
|
super.supportsInterface(interfaceId);
|
|
90
130
|
}
|
|
91
131
|
|
|
92
|
-
|
|
93
|
-
* @inheritdoc
|
|
132
|
+
/**
|
|
133
|
+
* @inheritdoc IERC721Metadata
|
|
134
|
+
* @notice Retrieving the token URI of tokenId `tokenId`.
|
|
135
|
+
*
|
|
136
|
+
* @dev Compatible with ERC721Metadata tokenURI. Retrieve the tokenURI for a specific `tokenId`.
|
|
137
|
+
*
|
|
138
|
+
* @return The token URI.
|
|
94
139
|
*/
|
|
95
140
|
function tokenURI(
|
|
96
141
|
uint256 /* tokenId */
|
|
@@ -100,27 +145,37 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
100
145
|
// offset = bytes4(hashSig) + bytes32(contentHash) -> 4 + 32 = 36
|
|
101
146
|
uint256 offset = 36;
|
|
102
147
|
|
|
103
|
-
bytes memory uriBytes =
|
|
104
|
-
data,
|
|
105
|
-
offset,
|
|
106
|
-
data.length - offset
|
|
107
|
-
);
|
|
148
|
+
bytes memory uriBytes = data.slice(offset, data.length - offset);
|
|
108
149
|
return string(uriBytes);
|
|
109
150
|
}
|
|
110
151
|
|
|
111
152
|
/**
|
|
112
|
-
* @inheritdoc
|
|
153
|
+
* @inheritdoc IERC721
|
|
154
|
+
* @notice Retrieving the address that own tokenId `tokenId`.
|
|
155
|
+
*
|
|
156
|
+
* @dev Compatible with ERC721 ownerOf.
|
|
157
|
+
*
|
|
158
|
+
* @param tokenId The tokenId to query.
|
|
159
|
+
* @return The owner of the tokenId.
|
|
113
160
|
*/
|
|
114
|
-
function ownerOf(
|
|
161
|
+
function ownerOf(
|
|
162
|
+
uint256 tokenId
|
|
163
|
+
) public view virtual override returns (address) {
|
|
115
164
|
return tokenOwnerOf(bytes32(tokenId));
|
|
116
165
|
}
|
|
117
166
|
|
|
118
167
|
/**
|
|
119
|
-
* @inheritdoc
|
|
168
|
+
* @inheritdoc IERC721
|
|
169
|
+
* @notice Retrieving the address other than the token owner that is approved to transfer tokenId `tokenId` on behalf of its owner.
|
|
170
|
+
*
|
|
171
|
+
* @dev Compatible with ERC721 getApproved.
|
|
172
|
+
*
|
|
173
|
+
* @param tokenId The tokenId to query.
|
|
174
|
+
* @return The address of the operator for `tokenId`.
|
|
120
175
|
*/
|
|
121
176
|
function getApproved(
|
|
122
177
|
uint256 tokenId
|
|
123
|
-
) public view virtual returns (address) {
|
|
178
|
+
) public view virtual override returns (address) {
|
|
124
179
|
bytes32 tokenIdAsBytes32 = bytes32(tokenId);
|
|
125
180
|
_existsOrError(tokenIdAsBytes32);
|
|
126
181
|
|
|
@@ -140,74 +195,125 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
140
195
|
}
|
|
141
196
|
}
|
|
142
197
|
|
|
143
|
-
|
|
144
|
-
* @inheritdoc
|
|
198
|
+
/**
|
|
199
|
+
* @inheritdoc IERC721
|
|
200
|
+
* @notice Checking if address `operator` is approved to transfer any tokenId owned by address `owner`.
|
|
201
|
+
*
|
|
202
|
+
* @dev Compatible with ERC721 isApprovedForAll.
|
|
203
|
+
*
|
|
204
|
+
* @param tokenOwner The tokenOwner address to query.
|
|
205
|
+
* @param operator The operator address to query.
|
|
206
|
+
*
|
|
207
|
+
* @return Returns if the `operator` is allowed to manage all of the assets of `owner`
|
|
145
208
|
*/
|
|
146
209
|
function isApprovedForAll(
|
|
147
210
|
address tokenOwner,
|
|
148
211
|
address operator
|
|
149
|
-
) public view virtual returns (bool) {
|
|
212
|
+
) public view virtual override returns (bool) {
|
|
150
213
|
return _operatorApprovals[tokenOwner][operator];
|
|
151
214
|
}
|
|
152
215
|
|
|
153
216
|
/**
|
|
154
|
-
* @inheritdoc
|
|
217
|
+
* @inheritdoc IERC721
|
|
218
|
+
* @notice Calling `approve` function to approve operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner.
|
|
219
|
+
*
|
|
220
|
+
* @dev Approval function compatible with ERC721 `approve(address,uint256)`.
|
|
221
|
+
*
|
|
222
|
+
* @param operator The address to approve for `tokenId`.
|
|
223
|
+
* @param tokenId The tokenId to approve.
|
|
155
224
|
*/
|
|
156
|
-
function approve(
|
|
225
|
+
function approve(
|
|
226
|
+
address operator,
|
|
227
|
+
uint256 tokenId
|
|
228
|
+
) public virtual override {
|
|
157
229
|
authorizeOperator(operator, bytes32(tokenId), "");
|
|
158
230
|
}
|
|
159
231
|
|
|
160
232
|
/**
|
|
161
|
-
* @
|
|
233
|
+
* @inheritdoc IERC721
|
|
234
|
+
* @notice Setting the "approval for all" status of operator `_operator` to `_approved` to allow it to transfer any tokenIds on behalf of `msg.sender`.
|
|
235
|
+
*
|
|
236
|
+
* @dev Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets. The contract MUST allow multiple operators per owner.
|
|
237
|
+
* See {_setApprovalForAll}
|
|
238
|
+
*
|
|
239
|
+
* @param operator Address to add to the set of authorized operators.
|
|
240
|
+
* @param approved True if the operator is approved, false to revoke approval.
|
|
241
|
+
*
|
|
242
|
+
* @custom:events {ApprovalForAll} event
|
|
162
243
|
*/
|
|
163
|
-
function setApprovalForAll(
|
|
244
|
+
function setApprovalForAll(
|
|
245
|
+
address operator,
|
|
246
|
+
bool approved
|
|
247
|
+
) public virtual override {
|
|
164
248
|
_setApprovalForAll(msg.sender, operator, approved);
|
|
165
249
|
}
|
|
166
250
|
|
|
167
251
|
/**
|
|
168
|
-
* @inheritdoc
|
|
252
|
+
* @inheritdoc IERC721
|
|
253
|
+
* @notice Calling `transferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`.
|
|
169
254
|
*
|
|
170
|
-
* @
|
|
255
|
+
* @dev Transfer functions from the ERC721 standard interface.
|
|
256
|
+
*
|
|
257
|
+
* @param from The sending address.
|
|
258
|
+
* @param to The receiving address.
|
|
259
|
+
* @param tokenId The tokenId to transfer.
|
|
260
|
+
*
|
|
261
|
+
* @custom:info This function sets the `force` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
|
|
171
262
|
*/
|
|
172
263
|
function transferFrom(
|
|
173
264
|
address from,
|
|
174
265
|
address to,
|
|
175
266
|
uint256 tokenId
|
|
176
|
-
) public virtual {
|
|
267
|
+
) public virtual override {
|
|
177
268
|
_transfer(from, to, bytes32(tokenId), true, "");
|
|
178
269
|
}
|
|
179
270
|
|
|
180
271
|
/**
|
|
181
|
-
* @inheritdoc
|
|
272
|
+
* @inheritdoc IERC721
|
|
273
|
+
* @notice Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`.
|
|
274
|
+
*
|
|
275
|
+
* @dev Safe Transfer function without optional data from the ERC721 standard interface.
|
|
276
|
+
*
|
|
277
|
+
* @param from The sending address.
|
|
278
|
+
* @param to The receiving address.
|
|
279
|
+
* @param tokenId The tokenId to transfer.
|
|
182
280
|
*
|
|
183
|
-
* @custom:info This function sets the `
|
|
281
|
+
* @custom:info This function sets the `force` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
|
|
184
282
|
*/
|
|
185
283
|
function safeTransferFrom(
|
|
186
284
|
address from,
|
|
187
285
|
address to,
|
|
188
286
|
uint256 tokenId
|
|
189
|
-
) public virtual {
|
|
287
|
+
) public virtual override {
|
|
190
288
|
_safeTransfer(from, to, tokenId, "");
|
|
191
289
|
}
|
|
192
290
|
|
|
193
291
|
/**
|
|
194
|
-
* @inheritdoc
|
|
292
|
+
* @inheritdoc IERC721
|
|
293
|
+
* @notice Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`.
|
|
195
294
|
*
|
|
196
|
-
* @
|
|
295
|
+
* @dev Safe Transfer function with optional data from the ERC721 standard interface.
|
|
296
|
+
*
|
|
297
|
+
* @param from The sending address.
|
|
298
|
+
* @param to The receiving address.
|
|
299
|
+
* @param tokenId The tokenId to transfer.
|
|
300
|
+
* @param data The data to be sent with the transfer.
|
|
301
|
+
*
|
|
302
|
+
* @custom:info This function sets the `force` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
|
|
197
303
|
*/
|
|
198
304
|
function safeTransferFrom(
|
|
199
305
|
address from,
|
|
200
306
|
address to,
|
|
201
307
|
uint256 tokenId,
|
|
202
308
|
bytes memory data
|
|
203
|
-
) public virtual {
|
|
309
|
+
) public virtual override {
|
|
204
310
|
_safeTransfer(from, to, tokenId, data);
|
|
205
311
|
}
|
|
206
312
|
|
|
207
313
|
// --- Overrides
|
|
208
314
|
|
|
209
315
|
/**
|
|
210
|
-
* @inheritdoc
|
|
316
|
+
* @inheritdoc LSP8IdentifiableDigitalAssetCore
|
|
211
317
|
*
|
|
212
318
|
* @custom:events
|
|
213
319
|
* - LSP7 {AuthorizedOperator} event.
|
|
@@ -217,14 +323,7 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
217
323
|
address operator,
|
|
218
324
|
bytes32 tokenId,
|
|
219
325
|
bytes memory operatorNotificationData
|
|
220
|
-
)
|
|
221
|
-
public
|
|
222
|
-
virtual
|
|
223
|
-
override(
|
|
224
|
-
ILSP8IdentifiableDigitalAsset,
|
|
225
|
-
LSP8IdentifiableDigitalAssetCore
|
|
226
|
-
)
|
|
227
|
-
{
|
|
326
|
+
) public virtual override {
|
|
228
327
|
address tokenOwner = tokenOwnerOf(tokenId);
|
|
229
328
|
|
|
230
329
|
if (
|
|
@@ -258,7 +357,10 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
258
357
|
tokenId,
|
|
259
358
|
operatorNotificationData
|
|
260
359
|
);
|
|
261
|
-
|
|
360
|
+
operator.tryNotifyUniversalReceiver(
|
|
361
|
+
_TYPEID_LSP8_TOKENOPERATOR,
|
|
362
|
+
lsp1Data
|
|
363
|
+
);
|
|
262
364
|
}
|
|
263
365
|
|
|
264
366
|
/**
|
|
@@ -272,7 +374,7 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
272
374
|
address from,
|
|
273
375
|
address to,
|
|
274
376
|
bytes32 tokenId,
|
|
275
|
-
bool
|
|
377
|
+
bool force,
|
|
276
378
|
bytes memory data
|
|
277
379
|
) internal virtual override {
|
|
278
380
|
if (
|
|
@@ -283,7 +385,7 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
283
385
|
}
|
|
284
386
|
|
|
285
387
|
emit Transfer(from, to, uint256(tokenId));
|
|
286
|
-
super._transfer(from, to, tokenId,
|
|
388
|
+
super._transfer(from, to, tokenId, force, data);
|
|
287
389
|
}
|
|
288
390
|
|
|
289
391
|
/**
|
|
@@ -314,11 +416,11 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
314
416
|
function _mint(
|
|
315
417
|
address to,
|
|
316
418
|
bytes32 tokenId,
|
|
317
|
-
bool
|
|
419
|
+
bool force,
|
|
318
420
|
bytes memory data
|
|
319
421
|
) internal virtual override {
|
|
320
422
|
emit Transfer(address(0), to, uint256(tokenId));
|
|
321
|
-
super._mint(to, tokenId,
|
|
423
|
+
super._mint(to, tokenId, force, data);
|
|
322
424
|
}
|
|
323
425
|
|
|
324
426
|
/**
|
|
@@ -339,7 +441,7 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
339
441
|
}
|
|
340
442
|
|
|
341
443
|
/**
|
|
342
|
-
* @dev Approve `operator` to operate on all tokens of `tokensOwner
|
|
444
|
+
* @dev Approve `operator` to operate on all tokens of `tokensOwner`.
|
|
343
445
|
*
|
|
344
446
|
* @custom:events {ApprovalForAll} event.
|
|
345
447
|
*/
|
|
@@ -399,14 +501,4 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
399
501
|
}
|
|
400
502
|
}
|
|
401
503
|
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @inheritdoc LSP4DigitalAssetMetadata
|
|
405
|
-
*/
|
|
406
|
-
function _setData(
|
|
407
|
-
bytes32 key,
|
|
408
|
-
bytes memory value
|
|
409
|
-
) internal virtual override(LSP4DigitalAssetMetadata, ERC725YCore) {
|
|
410
|
-
super._setData(key, value);
|
|
411
|
-
}
|
|
412
504
|
}
|