@lukso/lsp-smart-contracts 0.6.0 → 0.7.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 +13 -12
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +66 -27
- package/artifacts/LSP0ERC725AccountInit.json +71 -53
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +23 -2
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +23 -2
- package/artifacts/LSP4Compatibility.json +15 -9
- package/artifacts/LSP4DigitalAssetMetadata.json +25 -9
- package/artifacts/{LSP4DigitalAssetMetadataInit.json → LSP4DigitalAssetMetadataInitAbstract.json} +27 -60
- package/artifacts/LSP6KeyManager.json +93 -13
- package/artifacts/LSP6KeyManagerInit.json +98 -13
- package/artifacts/LSP7CappedSupply.json +56 -35
- package/artifacts/{LSP7CappedSupplyInit.json → LSP7CappedSupplyInitAbstract.json} +58 -104
- package/artifacts/LSP7CompatibleERC20.json +704 -0
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +717 -0
- package/artifacts/LSP7CompatibleERC20Mintable.json +753 -0
- package/artifacts/LSP7CompatibleERC20MintableInit.json +773 -0
- package/artifacts/LSP7DigitalAsset.json +56 -61
- package/artifacts/LSP7DigitalAssetInitAbstract.json +540 -0
- package/artifacts/LSP7Mintable.json +59 -38
- package/artifacts/LSP7MintableInit.json +64 -64
- package/artifacts/LSP8CappedSupply.json +62 -9
- package/artifacts/{LSP8CappedSupplyInit.json → LSP8CappedSupplyInitAbstract.json} +64 -73
- package/artifacts/LSP8CompatibleERC721.json +907 -0
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +920 -0
- package/artifacts/LSP8CompatibleERC721Mintable.json +967 -0
- package/artifacts/LSP8CompatibleERC721MintableInit.json +987 -0
- package/artifacts/LSP8IdentifiableDigitalAsset.json +62 -30
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +628 -0
- package/artifacts/LSP8Mintable.json +64 -11
- package/artifacts/LSP8MintableInit.json +69 -37
- package/artifacts/LSP9Vault.json +63 -24
- package/artifacts/LSP9VaultInit.json +68 -50
- package/artifacts/UniversalFactory.json +2 -2
- package/artifacts/UniversalProfile.json +66 -27
- package/artifacts/UniversalProfileInit.json +71 -53
- package/artifacts/UniversalReceiverAddressStore.json +7 -2
- package/constants.js +273 -31
- package/contracts/Custom/ClaimOwnership.sol +74 -9
- package/contracts/Custom/ERC165Checker.sol +1 -1
- package/contracts/Custom/IClaimOwnership.sol +3 -1
- package/contracts/Factories/Create2Factory.sol +3 -13
- package/contracts/Factories/UniversalFactory.sol +20 -16
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +3 -3
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +49 -37
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +10 -3
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +3 -3
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +3 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +4 -2
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -1
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +22 -16
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +14 -10
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +35 -29
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +10 -3
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +24 -9
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +9 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +157 -75
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +24 -4
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +26 -5
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +16 -0
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +151 -77
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +16 -16
- package/contracts/LSP6KeyManager/LSP6Constants.sol +16 -21
- package/contracts/LSP6KeyManager/LSP6Errors.sol +42 -5
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +6 -4
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +293 -284
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +11 -4
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +5 -3
- package/contracts/LSP6KeyManager/LSP6Utils.sol +24 -27
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +18 -5
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +8 -4
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +35 -24
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +5 -3
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +2 -0
- package/contracts/LSP7DigitalAsset/extensions/{ILSP7CompatibilityForERC20.sol → ILSP7CompatibleERC20.sol} +6 -6
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +1 -1
- 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} +23 -19
- package/contracts/LSP7DigitalAsset/extensions/{LSP7CompatibilityForERC20InitAbstract.sol → LSP7CompatibleERC20InitAbstract.sol} +11 -10
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +22 -0
- package/contracts/{LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Init.sol → LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol} +12 -7
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +27 -0
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +9 -7
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +11 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +8 -7
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +3 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +6 -0
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +31 -30
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +3 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{ILSP8CompatibilityForERC721.sol → ILSP8CompatibleERC721.sol} +16 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +17 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.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} +61 -37
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721InitAbstract.sol → LSP8CompatibleERC721InitAbstract.sol} +13 -9
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +21 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +50 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +24 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +22 -0
- package/contracts/{LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Init.sol → LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol} +12 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +27 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +6 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +7 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +8 -5
- package/contracts/LSP9Vault/LSP9Constants.sol +6 -3
- package/contracts/LSP9Vault/LSP9Vault.sol +9 -5
- package/contracts/LSP9Vault/LSP9VaultCore.sol +152 -69
- package/contracts/LSP9Vault/LSP9VaultInit.sol +10 -3
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +9 -5
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +6 -2
- package/contracts/UniversalProfile.sol +3 -4
- package/contracts/UniversalProfileInit.sol +10 -3
- package/contracts/UniversalProfileInitAbstract.sol +3 -5
- package/contracts/Utils/GasLib.sol +17 -0
- package/contracts/Utils/UtilsLib.sol +6 -34
- package/package.json +27 -30
- package/artifacts/LSP7CompatibilityForERC20.json +0 -686
- package/artifacts/LSP7CompatibilityForERC20Init.json +0 -727
- package/artifacts/LSP7DigitalAssetInit.json +0 -573
- package/artifacts/LSP8CompatibilityForERC721.json +0 -832
- package/artifacts/LSP8CompatibilityForERC721Init.json +0 -873
- package/artifacts/LSP8IdentifiableDigitalAssetInit.json +0 -624
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +0 -26
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +0 -28
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +0 -19
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableCore.sol +0 -26
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +0 -26
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +0 -19
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableCore.sol +0 -26
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
|
|
5
5
|
// interfaces
|
|
6
6
|
import {ILSP7DigitalAsset} from "../ILSP7DigitalAsset.sol";
|
|
7
|
-
import {
|
|
7
|
+
import {ILSP7CompatibleERC20} from "./ILSP7CompatibleERC20.sol";
|
|
8
8
|
|
|
9
9
|
// modules
|
|
10
10
|
import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
|
|
@@ -13,42 +13,45 @@ import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
|
13
13
|
/**
|
|
14
14
|
* @dev LSP7 extension, for compatibility for clients / tools that expect ERC20.
|
|
15
15
|
*/
|
|
16
|
-
abstract contract
|
|
16
|
+
abstract contract LSP7CompatibleERC20Core is
|
|
17
17
|
LSP4Compatibility,
|
|
18
18
|
LSP7DigitalAssetCore,
|
|
19
|
-
|
|
19
|
+
ILSP7CompatibleERC20
|
|
20
20
|
{
|
|
21
|
+
// --- Overrides
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
|
-
* @inheritdoc
|
|
24
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
23
25
|
*/
|
|
24
|
-
function approve(address operator, uint256 amount)
|
|
25
|
-
|
|
26
|
+
function approve(address operator, uint256 amount) public virtual returns (bool) {
|
|
27
|
+
authorizeOperator(operator, amount);
|
|
28
|
+
return true;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
|
-
* @inheritdoc
|
|
32
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
30
33
|
*/
|
|
31
34
|
function allowance(address tokenOwner, address operator)
|
|
32
|
-
|
|
35
|
+
public
|
|
33
36
|
view
|
|
34
37
|
virtual
|
|
35
|
-
override
|
|
36
38
|
returns (uint256)
|
|
37
39
|
{
|
|
38
|
-
return
|
|
40
|
+
return authorizedAmountFor(operator, tokenOwner);
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
|
-
* @inheritdoc
|
|
44
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
43
45
|
* @dev Compatible with ERC20 transfer.
|
|
44
46
|
* Using force=true so that EOA and any contract may receive the tokens.
|
|
45
47
|
*/
|
|
46
|
-
function transfer(address to, uint256 amount)
|
|
47
|
-
|
|
48
|
+
function transfer(address to, uint256 amount) public virtual override returns (bool) {
|
|
49
|
+
transfer(msg.sender, to, amount, true, "");
|
|
50
|
+
return true;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/**
|
|
51
|
-
* @inheritdoc
|
|
54
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
52
55
|
* @dev Compatible with ERC20 transferFrom.
|
|
53
56
|
* Using force=true so that EOA and any contract may receive the tokens.
|
|
54
57
|
*/
|
|
@@ -56,12 +59,11 @@ abstract contract LSP7CompatibilityForERC20Core is
|
|
|
56
59
|
address from,
|
|
57
60
|
address to,
|
|
58
61
|
uint256 amount
|
|
59
|
-
)
|
|
60
|
-
|
|
62
|
+
) public virtual returns (bool) {
|
|
63
|
+
transfer(from, to, amount, true, "");
|
|
64
|
+
return true;
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
// --- Overrides
|
|
64
|
-
|
|
65
67
|
function authorizeOperator(address operator, uint256 amount)
|
|
66
68
|
public
|
|
67
69
|
virtual
|
|
@@ -69,9 +71,11 @@ abstract contract LSP7CompatibilityForERC20Core is
|
|
|
69
71
|
{
|
|
70
72
|
super.authorizeOperator(operator, amount);
|
|
71
73
|
|
|
72
|
-
emit Approval(
|
|
74
|
+
emit Approval(msg.sender, operator, amount);
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
// --- Internals
|
|
78
|
+
|
|
75
79
|
function _transfer(
|
|
76
80
|
address from,
|
|
77
81
|
address to,
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
LSP7DigitalAssetInitAbstract,
|
|
8
|
+
LSP4DigitalAssetMetadataInitAbstract,
|
|
9
|
+
ERC725YCore
|
|
10
|
+
} from "../LSP7DigitalAssetInitAbstract.sol";
|
|
7
11
|
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
-
import {
|
|
12
|
+
import {LSP7CompatibleERC20Core} from "./LSP7CompatibleERC20Core.sol";
|
|
9
13
|
|
|
10
|
-
contract
|
|
11
|
-
LSP7DigitalAssetInitAbstract,
|
|
12
|
-
LSP7CompatibilityForERC20Core
|
|
13
|
-
{
|
|
14
|
+
contract LSP7CompatibleERC20InitAbstract is LSP7DigitalAssetInitAbstract, LSP7CompatibleERC20Core {
|
|
14
15
|
function _initialize(
|
|
15
16
|
string memory name_,
|
|
16
17
|
string memory symbol_,
|
|
@@ -24,7 +25,7 @@ contract LSP7CompatibilityForERC20InitAbstract is
|
|
|
24
25
|
function authorizeOperator(address operator, uint256 amount)
|
|
25
26
|
public
|
|
26
27
|
virtual
|
|
27
|
-
override(LSP7DigitalAssetCore,
|
|
28
|
+
override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core)
|
|
28
29
|
{
|
|
29
30
|
super.authorizeOperator(operator, amount);
|
|
30
31
|
}
|
|
@@ -33,7 +34,7 @@ contract LSP7CompatibilityForERC20InitAbstract is
|
|
|
33
34
|
address from,
|
|
34
35
|
uint256 amount,
|
|
35
36
|
bytes memory data
|
|
36
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
37
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
37
38
|
super._burn(from, amount, data);
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -42,7 +43,7 @@ contract LSP7CompatibilityForERC20InitAbstract is
|
|
|
42
43
|
uint256 amount,
|
|
43
44
|
bool force,
|
|
44
45
|
bytes memory data
|
|
45
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
46
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
46
47
|
super._mint(to, amount, force, data);
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -52,7 +53,7 @@ contract LSP7CompatibilityForERC20InitAbstract is
|
|
|
52
53
|
uint256 amount,
|
|
53
54
|
bool force,
|
|
54
55
|
bytes memory data
|
|
55
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
56
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
56
57
|
super._transfer(from, to, amount, force, data);
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {LSP7CompatibleERC20} from "../extensions/LSP7CompatibleERC20.sol";
|
|
5
|
+
|
|
6
|
+
contract LSP7CompatibleERC20Mintable is LSP7CompatibleERC20 {
|
|
7
|
+
/* solhint-disable no-empty-blocks */
|
|
8
|
+
constructor(
|
|
9
|
+
string memory name_,
|
|
10
|
+
string memory symbol_,
|
|
11
|
+
address newOwner_
|
|
12
|
+
) LSP7CompatibleERC20(name_, symbol_, newOwner_) {}
|
|
13
|
+
|
|
14
|
+
function mint(
|
|
15
|
+
address to,
|
|
16
|
+
uint256 amount,
|
|
17
|
+
bool force,
|
|
18
|
+
bytes memory data
|
|
19
|
+
) public onlyOwner {
|
|
20
|
+
_mint(to, amount, force, data);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.0;
|
|
4
3
|
|
|
5
4
|
// modules
|
|
6
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
LSP7CompatibleERC20MintableInitAbstract
|
|
7
|
+
} from "./LSP7CompatibleERC20MintableInitAbstract.sol";
|
|
8
|
+
|
|
9
|
+
contract LSP7CompatibleERC20MintableInit is LSP7CompatibleERC20MintableInitAbstract {
|
|
10
|
+
/**
|
|
11
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
_disableInitializers();
|
|
15
|
+
}
|
|
7
16
|
|
|
8
|
-
/**
|
|
9
|
-
* @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
|
|
10
|
-
*/
|
|
11
|
-
contract LSP8CompatibilityForERC721Init is LSP8CompatibilityForERC721InitAbstract {
|
|
12
17
|
/**
|
|
13
18
|
* @notice Sets the name, the symbol and the owner of the token
|
|
14
19
|
* @param name_ The name of the token
|
|
@@ -20,6 +25,6 @@ contract LSP8CompatibilityForERC721Init is LSP8CompatibilityForERC721InitAbstrac
|
|
|
20
25
|
string memory symbol_,
|
|
21
26
|
address newOwner_
|
|
22
27
|
) public virtual initializer {
|
|
23
|
-
|
|
28
|
+
LSP7CompatibleERC20MintableInitAbstract._initialize(name_, symbol_, newOwner_);
|
|
24
29
|
}
|
|
25
30
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
// modules
|
|
5
|
+
import {LSP7CompatibleERC20InitAbstract} from "../extensions/LSP7CompatibleERC20InitAbstract.sol";
|
|
6
|
+
|
|
7
|
+
contract LSP7CompatibleERC20MintableInitAbstract is LSP7CompatibleERC20InitAbstract {
|
|
8
|
+
/**
|
|
9
|
+
* @inheritdoc LSP7CompatibleERC20InitAbstract
|
|
10
|
+
*/
|
|
11
|
+
function _initialize(
|
|
12
|
+
string memory name_,
|
|
13
|
+
string memory symbol_,
|
|
14
|
+
address newOwner_
|
|
15
|
+
) internal virtual override onlyInitializing {
|
|
16
|
+
LSP7CompatibleERC20InitAbstract._initialize(name_, symbol_, newOwner_);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function mint(
|
|
20
|
+
address to,
|
|
21
|
+
uint256 amount,
|
|
22
|
+
bool force,
|
|
23
|
+
bytes memory data
|
|
24
|
+
) public onlyOwner {
|
|
25
|
+
_mint(to, amount, force, data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
+
// interfaces
|
|
6
|
+
import {ILSP7Mintable} from "./ILSP7Mintable.sol";
|
|
7
|
+
|
|
5
8
|
// modules
|
|
6
9
|
import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
|
|
7
|
-
import {LSP7MintableCore} from "./LSP7MintableCore.sol";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* @title LSP7Mintable
|
|
11
13
|
* @author Jean Cavallera, Yamen Merhi
|
|
12
14
|
* @dev LSP7 extension, mintable.
|
|
13
15
|
*/
|
|
14
|
-
contract LSP7Mintable is LSP7DigitalAsset,
|
|
16
|
+
contract LSP7Mintable is LSP7DigitalAsset, ILSP7Mintable {
|
|
15
17
|
// solhint-disable no-empty-blocks
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -19,24 +21,24 @@ contract LSP7Mintable is LSP7DigitalAsset, LSP7MintableCore {
|
|
|
19
21
|
* @param name_ The name of the token
|
|
20
22
|
* @param symbol_ The symbol of the token
|
|
21
23
|
* @param newOwner_ The owner of the the token-Metadata
|
|
22
|
-
* @param
|
|
24
|
+
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token
|
|
23
25
|
*/
|
|
24
26
|
constructor(
|
|
25
27
|
string memory name_,
|
|
26
28
|
string memory symbol_,
|
|
27
29
|
address newOwner_,
|
|
28
|
-
bool
|
|
29
|
-
) LSP7DigitalAsset(name_, symbol_, newOwner_,
|
|
30
|
+
bool isNonDivisible_
|
|
31
|
+
) LSP7DigitalAsset(name_, symbol_, newOwner_, isNonDivisible_) {}
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
|
-
* @inheritdoc
|
|
34
|
+
* @inheritdoc ILSP7Mintable
|
|
33
35
|
*/
|
|
34
36
|
function mint(
|
|
35
37
|
address to,
|
|
36
38
|
uint256 amount,
|
|
37
39
|
bool force,
|
|
38
40
|
bytes memory data
|
|
39
|
-
) public
|
|
41
|
+
) public virtual onlyOwner {
|
|
40
42
|
_mint(to, amount, force, data);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -9,19 +9,26 @@ import {LSP7MintableInitAbstract} from "./LSP7MintableInitAbstract.sol";
|
|
|
9
9
|
* @dev LSP7 extension, mintable.
|
|
10
10
|
*/
|
|
11
11
|
contract LSP7MintableInit is LSP7MintableInitAbstract {
|
|
12
|
+
/**
|
|
13
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
14
|
+
*/
|
|
15
|
+
constructor() {
|
|
16
|
+
_disableInitializers();
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* @notice Sets the token-Metadata and register LSP7InterfaceId
|
|
14
21
|
* @param name_ The name of the token
|
|
15
22
|
* @param symbol_ The symbol of the token
|
|
16
23
|
* @param newOwner_ The owner of the the token-Metadata
|
|
17
|
-
* @param
|
|
24
|
+
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token
|
|
18
25
|
*/
|
|
19
26
|
function initialize(
|
|
20
27
|
string memory name_,
|
|
21
28
|
string memory symbol_,
|
|
22
29
|
address newOwner_,
|
|
23
|
-
bool
|
|
24
|
-
) public virtual
|
|
25
|
-
LSP7MintableInitAbstract._initialize(name_, symbol_, newOwner_,
|
|
30
|
+
bool isNonDivisible_
|
|
31
|
+
) public virtual initializer {
|
|
32
|
+
LSP7MintableInitAbstract._initialize(name_, symbol_, newOwner_, isNonDivisible_);
|
|
26
33
|
}
|
|
27
34
|
}
|
|
@@ -2,33 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
+
// interfaces
|
|
6
|
+
import {ILSP7Mintable} from "./ILSP7Mintable.sol";
|
|
7
|
+
|
|
5
8
|
// modules
|
|
6
|
-
import {LSP7DigitalAssetInit} from "../LSP7DigitalAssetInit.sol";
|
|
7
9
|
import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
|
|
8
|
-
import {LSP7MintableCore} from "./LSP7MintableCore.sol";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @dev LSP7 extension, mintable.
|
|
12
13
|
*/
|
|
13
|
-
abstract contract LSP7MintableInitAbstract is
|
|
14
|
+
abstract contract LSP7MintableInitAbstract is LSP7DigitalAssetInitAbstract, ILSP7Mintable {
|
|
14
15
|
function _initialize(
|
|
15
16
|
string memory name_,
|
|
16
17
|
string memory symbol_,
|
|
17
18
|
address newOwner_,
|
|
18
|
-
bool
|
|
19
|
+
bool isNonDivisible_
|
|
19
20
|
) internal virtual override onlyInitializing {
|
|
20
|
-
LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_,
|
|
21
|
+
LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, isNonDivisible_);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
|
-
* @inheritdoc
|
|
25
|
+
* @inheritdoc ILSP7Mintable
|
|
25
26
|
*/
|
|
26
27
|
function mint(
|
|
27
28
|
address to,
|
|
28
29
|
uint256 amount,
|
|
29
30
|
bool force,
|
|
30
31
|
bytes memory data
|
|
31
|
-
) public
|
|
32
|
+
) public virtual onlyOwner {
|
|
32
33
|
_mint(to, amount, force, data);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -7,7 +7,7 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
|
7
7
|
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @title interface of the LSP8 - Identifiable Digital Asset standard.
|
|
11
11
|
*/
|
|
12
12
|
interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
13
13
|
// --- Events
|
|
@@ -168,6 +168,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
168
168
|
*
|
|
169
169
|
* - `from` cannot be the zero address.
|
|
170
170
|
* - `to` cannot be the zero address.
|
|
171
|
+
* - `from` and `to` cannot be the same address.
|
|
171
172
|
* - `tokenId` token must be owned by `from`.
|
|
172
173
|
* - If the caller is not `from`, it must be an operator of `tokenId`.
|
|
173
174
|
*
|
|
@@ -197,6 +198,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
197
198
|
* - `from`, `to`, `tokenId` lists are the same length.
|
|
198
199
|
* - no values in `from` can be the zero address.
|
|
199
200
|
* - no values in `to` can be the zero address.
|
|
201
|
+
* - `from` and `to` cannot be the same address at the same index of each lists.
|
|
200
202
|
* - each `tokenId` token must be owned by `from`.
|
|
201
203
|
* - If the caller is not `from`, it must be an operator of each `tokenId`.
|
|
202
204
|
*
|
|
@@ -6,11 +6,11 @@ bytes4 constant _INTERFACEID_LSP8 = 0x49399145;
|
|
|
6
6
|
|
|
7
7
|
// --- ERC725Y Keys
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
bytes12 constant _LSP8_METADATA_ADDRESS_KEY_PREFIX =
|
|
9
|
+
// bytes10(keccak256('LSP8MetadataAddress')) + bytes2(0)
|
|
10
|
+
bytes12 constant _LSP8_METADATA_ADDRESS_KEY_PREFIX = 0x73dcc7c3c4096cdc7f8a0000;
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
bytes12 constant _LSP8_METADATA_JSON_KEY_PREFIX =
|
|
12
|
+
// bytes10(keccak256('LSP8MetadataJSON')) + bytes2(0)
|
|
13
|
+
bytes12 constant _LSP8_METADATA_JSON_KEY_PREFIX = 0x9a26b4060ae7f7d5e3cd0000;
|
|
14
14
|
|
|
15
15
|
// --- Token Hooks
|
|
16
16
|
|
|
@@ -9,10 +9,16 @@ error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller);
|
|
|
9
9
|
|
|
10
10
|
error LSP8NotTokenOperator(bytes32 tokenId, address caller);
|
|
11
11
|
|
|
12
|
+
error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId);
|
|
13
|
+
|
|
12
14
|
error LSP8CannotUseAddressZeroAsOperator();
|
|
13
15
|
|
|
14
16
|
error LSP8CannotSendToAddressZero();
|
|
15
17
|
|
|
18
|
+
error LSP8CannotSendToSelf();
|
|
19
|
+
|
|
20
|
+
error LSP8NonExistingOperator(address _address, bytes32 tokenId);
|
|
21
|
+
|
|
16
22
|
error LSP8TokenIdAlreadyMinted(bytes32 tokenId);
|
|
17
23
|
|
|
18
24
|
error LSP8InvalidTransferBatch();
|
|
@@ -17,7 +17,7 @@ import {_INTERFACEID_LSP8} from "./LSP8Constants.sol";
|
|
|
17
17
|
* @author Matthew Stevens
|
|
18
18
|
* @dev Implementation of a LSP8 compliant contract.
|
|
19
19
|
*/
|
|
20
|
-
contract LSP8IdentifiableDigitalAsset is
|
|
20
|
+
abstract contract LSP8IdentifiableDigitalAsset is
|
|
21
21
|
LSP4DigitalAssetMetadata,
|
|
22
22
|
LSP8IdentifiableDigitalAssetCore
|
|
23
23
|
{
|
|
@@ -6,12 +6,12 @@ import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalRec
|
|
|
6
6
|
import {ILSP8IdentifiableDigitalAsset} from "./ILSP8IdentifiableDigitalAsset.sol";
|
|
7
7
|
|
|
8
8
|
// libraries
|
|
9
|
+
import {GasLib} from "../Utils/GasLib.sol";
|
|
9
10
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
10
11
|
import {ERC165Checker} from "../Custom/ERC165Checker.sol";
|
|
11
12
|
|
|
12
13
|
// modules
|
|
13
|
-
|
|
14
|
-
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
|
|
14
|
+
|
|
15
15
|
import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
|
|
16
16
|
|
|
17
17
|
// errors
|
|
@@ -19,7 +19,6 @@ import "./LSP8Errors.sol";
|
|
|
19
19
|
|
|
20
20
|
// constants
|
|
21
21
|
import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
22
|
-
// import {} from "../LSP4DigitalAssetMetadata/LSP4Constants.sol";
|
|
23
22
|
import {_TYPEID_LSP8_TOKENSSENDER, _TYPEID_LSP8_TOKENSRECIPIENT} from "./LSP8Constants.sol";
|
|
24
23
|
|
|
25
24
|
/**
|
|
@@ -27,10 +26,9 @@ import {_TYPEID_LSP8_TOKENSSENDER, _TYPEID_LSP8_TOKENSRECIPIENT} from "./LSP8Con
|
|
|
27
26
|
* @author Matthew Stevens
|
|
28
27
|
* @dev Core Implementation of a LSP8 compliant contract.
|
|
29
28
|
*/
|
|
30
|
-
abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
29
|
+
abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAsset {
|
|
31
30
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
32
31
|
using EnumerableSet for EnumerableSet.Bytes32Set;
|
|
33
|
-
using Address for address;
|
|
34
32
|
|
|
35
33
|
// --- Storage
|
|
36
34
|
|
|
@@ -45,12 +43,14 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
45
43
|
// Mapping a `tokenId` to its authorized operator addresses.
|
|
46
44
|
mapping(bytes32 => EnumerableSet.AddressSet) internal _operators;
|
|
47
45
|
|
|
46
|
+
mapping(address => EnumerableSet.Bytes32Set) internal _tokenIdsForOperator;
|
|
47
|
+
|
|
48
48
|
// --- Token queries
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
52
52
|
*/
|
|
53
|
-
function totalSupply() public view
|
|
53
|
+
function totalSupply() public view returns (uint256) {
|
|
54
54
|
return _existingTokens;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -59,14 +59,14 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
59
59
|
/**
|
|
60
60
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
61
61
|
*/
|
|
62
|
-
function balanceOf(address tokenOwner) public view
|
|
62
|
+
function balanceOf(address tokenOwner) public view returns (uint256) {
|
|
63
63
|
return _ownedTokens[tokenOwner].length();
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
68
68
|
*/
|
|
69
|
-
function tokenOwnerOf(bytes32 tokenId) public view
|
|
69
|
+
function tokenOwnerOf(bytes32 tokenId) public view returns (address) {
|
|
70
70
|
address tokenOwner = _tokenOwners[tokenId];
|
|
71
71
|
|
|
72
72
|
if (tokenOwner == address(0)) {
|
|
@@ -79,7 +79,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
79
79
|
/**
|
|
80
80
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
81
81
|
*/
|
|
82
|
-
function tokenIdsOf(address tokenOwner) public view
|
|
82
|
+
function tokenIdsOf(address tokenOwner) public view returns (bytes32[] memory) {
|
|
83
83
|
return _ownedTokens[tokenOwner].values();
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -88,9 +88,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
88
88
|
/**
|
|
89
89
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
90
90
|
*/
|
|
91
|
-
function authorizeOperator(address operator, bytes32 tokenId) public virtual
|
|
91
|
+
function authorizeOperator(address operator, bytes32 tokenId) public virtual {
|
|
92
92
|
address tokenOwner = tokenOwnerOf(tokenId);
|
|
93
|
-
address caller =
|
|
93
|
+
address caller = msg.sender;
|
|
94
94
|
|
|
95
95
|
if (tokenOwner != caller) {
|
|
96
96
|
revert LSP8NotTokenOwner(tokenOwner, tokenId, caller);
|
|
@@ -105,7 +105,8 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
_operators[tokenId].add(operator);
|
|
108
|
+
bool isAdded = _operators[tokenId].add(operator);
|
|
109
|
+
if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);
|
|
109
110
|
|
|
110
111
|
emit AuthorizedOperator(operator, tokenOwner, tokenId);
|
|
111
112
|
}
|
|
@@ -113,9 +114,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
113
114
|
/**
|
|
114
115
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
115
116
|
*/
|
|
116
|
-
function revokeOperator(address operator, bytes32 tokenId) public virtual
|
|
117
|
+
function revokeOperator(address operator, bytes32 tokenId) public virtual {
|
|
117
118
|
address tokenOwner = tokenOwnerOf(tokenId);
|
|
118
|
-
address caller =
|
|
119
|
+
address caller = msg.sender;
|
|
119
120
|
|
|
120
121
|
if (tokenOwner != caller) {
|
|
121
122
|
revert LSP8NotTokenOwner(tokenOwner, tokenId, caller);
|
|
@@ -140,7 +141,6 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
140
141
|
public
|
|
141
142
|
view
|
|
142
143
|
virtual
|
|
143
|
-
override
|
|
144
144
|
returns (bool)
|
|
145
145
|
{
|
|
146
146
|
_existsOrError(tokenId);
|
|
@@ -155,7 +155,6 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
155
155
|
public
|
|
156
156
|
view
|
|
157
157
|
virtual
|
|
158
|
-
override
|
|
159
158
|
returns (address[] memory)
|
|
160
159
|
{
|
|
161
160
|
_existsOrError(tokenId);
|
|
@@ -185,8 +184,8 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
185
184
|
bytes32 tokenId,
|
|
186
185
|
bool force,
|
|
187
186
|
bytes memory data
|
|
188
|
-
) public virtual
|
|
189
|
-
address operator =
|
|
187
|
+
) public virtual {
|
|
188
|
+
address operator = msg.sender;
|
|
190
189
|
|
|
191
190
|
if (!_isOperatorOrOwner(operator, tokenId)) {
|
|
192
191
|
revert LSP8NotTokenOperator(tokenId, operator);
|
|
@@ -204,14 +203,14 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
204
203
|
bytes32[] memory tokenId,
|
|
205
204
|
bool force,
|
|
206
205
|
bytes[] memory data
|
|
207
|
-
)
|
|
206
|
+
) public virtual {
|
|
208
207
|
if (
|
|
209
208
|
from.length != to.length || from.length != tokenId.length || from.length != data.length
|
|
210
209
|
) {
|
|
211
210
|
revert LSP8InvalidTransferBatch();
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
for (uint256 i = 0; i < from.length; i
|
|
213
|
+
for (uint256 i = 0; i < from.length; i = GasLib.uncheckedIncrement(i)) {
|
|
215
214
|
transfer(from[i], to[i], tokenId[i], force, data[i]);
|
|
216
215
|
}
|
|
217
216
|
}
|
|
@@ -221,12 +220,13 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
221
220
|
address tokenOwner,
|
|
222
221
|
bytes32 tokenId
|
|
223
222
|
) internal virtual {
|
|
224
|
-
_operators[tokenId].remove(operator);
|
|
223
|
+
bool isRemoved = _operators[tokenId].remove(operator);
|
|
224
|
+
if (!isRemoved) revert LSP8NonExistingOperator(operator, tokenId);
|
|
225
225
|
emit RevokedOperator(operator, tokenOwner, tokenId);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function _clearOperators(address tokenOwner, bytes32 tokenId) internal virtual {
|
|
229
|
-
//
|
|
229
|
+
// here is a good example of why having multiple operators will be expensive.. we
|
|
230
230
|
// need to clear them on token transfer
|
|
231
231
|
//
|
|
232
232
|
// NOTE: this may cause a tx to fail if there is too many operators to clear, in which case
|
|
@@ -235,7 +235,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
235
235
|
EnumerableSet.AddressSet storage operatorsForTokenId = _operators[tokenId];
|
|
236
236
|
|
|
237
237
|
uint256 operatorListLength = operatorsForTokenId.length();
|
|
238
|
-
for (uint256 i = 0; i < operatorListLength; i
|
|
238
|
+
for (uint256 i = 0; i < operatorListLength; i = GasLib.uncheckedIncrement(i)) {
|
|
239
239
|
// we are emptying the list, always remove from index 0
|
|
240
240
|
address operator = operatorsForTokenId.at(0);
|
|
241
241
|
_revokeOperator(operator, tokenOwner, tokenId);
|
|
@@ -285,7 +285,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
285
285
|
revert LSP8TokenIdAlreadyMinted(tokenId);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
address operator =
|
|
288
|
+
address operator = msg.sender;
|
|
289
289
|
|
|
290
290
|
_beforeTokenTransfer(address(0), to, tokenId);
|
|
291
291
|
|
|
@@ -308,7 +308,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
308
308
|
*/
|
|
309
309
|
function _burn(bytes32 tokenId, bytes memory data) internal virtual {
|
|
310
310
|
address tokenOwner = tokenOwnerOf(tokenId);
|
|
311
|
-
address operator =
|
|
311
|
+
address operator = msg.sender;
|
|
312
312
|
|
|
313
313
|
_beforeTokenTransfer(tokenOwner, address(0), tokenId);
|
|
314
314
|
|
|
@@ -339,6 +339,10 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
339
339
|
bool force,
|
|
340
340
|
bytes memory data
|
|
341
341
|
) internal virtual {
|
|
342
|
+
if (from == to) {
|
|
343
|
+
revert LSP8CannotSendToSelf();
|
|
344
|
+
}
|
|
345
|
+
|
|
342
346
|
address tokenOwner = tokenOwnerOf(tokenId);
|
|
343
347
|
if (tokenOwner != from) {
|
|
344
348
|
revert LSP8NotTokenOwner(tokenOwner, tokenId, from);
|
|
@@ -348,7 +352,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
348
352
|
revert LSP8CannotSendToAddressZero();
|
|
349
353
|
}
|
|
350
354
|
|
|
351
|
-
address operator =
|
|
355
|
+
address operator = msg.sender;
|
|
352
356
|
|
|
353
357
|
_beforeTokenTransfer(from, to, tokenId);
|
|
354
358
|
|
|
@@ -378,11 +382,8 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
378
382
|
function _beforeTokenTransfer(
|
|
379
383
|
address from,
|
|
380
384
|
address to,
|
|
381
|
-
bytes32 tokenId
|
|
385
|
+
bytes32 tokenId // solhint-disable no-unused-vars
|
|
382
386
|
) internal virtual {
|
|
383
|
-
// silence compiler warning about unused variable
|
|
384
|
-
tokenId;
|
|
385
|
-
|
|
386
387
|
// token being minted
|
|
387
388
|
if (from == address(0)) {
|
|
388
389
|
_existingTokens += 1;
|
|
@@ -7,7 +7,9 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
|
7
7
|
// modules
|
|
8
8
|
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
9
9
|
import {LSP8IdentifiableDigitalAssetCore} from "./LSP8IdentifiableDigitalAssetCore.sol";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
LSP4DigitalAssetMetadataInitAbstract
|
|
12
|
+
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol";
|
|
11
13
|
|
|
12
14
|
// constants
|
|
13
15
|
import {_INTERFACEID_LSP8} from "./LSP8Constants.sol";
|