@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
|
@@ -10,11 +10,18 @@ import {LSP6KeyManagerInitAbstract} from "./LSP6KeyManagerInitAbstract.sol";
|
|
|
10
10
|
* @dev all the permissions can be set on the ERC725 Account using `setData(...)` with the keys constants below
|
|
11
11
|
*/
|
|
12
12
|
contract LSP6KeyManagerInit is LSP6KeyManagerInitAbstract {
|
|
13
|
+
/**
|
|
14
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
15
|
+
*/
|
|
16
|
+
constructor() {
|
|
17
|
+
_disableInitializers();
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
/**
|
|
14
21
|
* @notice Initiate the account with the address of the ERC725Account contract and sets LSP6KeyManager InterfaceId
|
|
15
|
-
* @param
|
|
22
|
+
* @param target_ The address of the ER725Account to control
|
|
16
23
|
*/
|
|
17
|
-
function initialize(address
|
|
18
|
-
LSP6KeyManagerInitAbstract._initialize(
|
|
24
|
+
function initialize(address target_) public virtual initializer {
|
|
25
|
+
LSP6KeyManagerInitAbstract._initialize(target_);
|
|
19
26
|
}
|
|
20
27
|
}
|
|
@@ -5,6 +5,7 @@ pragma solidity ^0.8.6;
|
|
|
5
5
|
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
6
6
|
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
7
7
|
import {LSP6KeyManagerCore} from "./LSP6KeyManagerCore.sol";
|
|
8
|
+
import {InvalidLSP6Target} from "./LSP6Errors.sol";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @title Proxy implementation of a contract acting as a controller of an ERC725 Account, using permissions stored in the ERC725Y storage
|
|
@@ -12,7 +13,8 @@ import {LSP6KeyManagerCore} from "./LSP6KeyManagerCore.sol";
|
|
|
12
13
|
* @dev all the permissions can be set on the ERC725 Account using `setData(...)` with the keys constants below
|
|
13
14
|
*/
|
|
14
15
|
abstract contract LSP6KeyManagerInitAbstract is Initializable, LSP6KeyManagerCore {
|
|
15
|
-
function _initialize(address
|
|
16
|
-
|
|
16
|
+
function _initialize(address target_) internal virtual onlyInitializing {
|
|
17
|
+
if (target_ == address(0)) revert InvalidLSP6Target();
|
|
18
|
+
target = target_;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -14,90 +14,86 @@ import "../LSP6KeyManager/LSP6Constants.sol";
|
|
|
14
14
|
library LSP6Utils {
|
|
15
15
|
using LSP2Utils for bytes12;
|
|
16
16
|
|
|
17
|
-
function getPermissionsFor(IERC725Y
|
|
18
|
-
|
|
19
|
-
view
|
|
20
|
-
returns (bytes32)
|
|
21
|
-
{
|
|
22
|
-
bytes memory permissions = _account.getData(
|
|
17
|
+
function getPermissionsFor(IERC725Y target, address caller) internal view returns (bytes32) {
|
|
18
|
+
bytes memory permissions = target.getData(
|
|
23
19
|
LSP2Utils.generateMappingWithGroupingKey(
|
|
24
20
|
_LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
|
|
25
|
-
bytes20(
|
|
21
|
+
bytes20(caller)
|
|
26
22
|
)
|
|
27
23
|
);
|
|
28
24
|
|
|
29
25
|
return bytes32(permissions);
|
|
30
26
|
}
|
|
31
27
|
|
|
32
|
-
function getAllowedAddressesFor(IERC725Y
|
|
28
|
+
function getAllowedAddressesFor(IERC725Y target, address caller)
|
|
33
29
|
internal
|
|
34
30
|
view
|
|
35
31
|
returns (bytes memory)
|
|
36
32
|
{
|
|
37
33
|
return
|
|
38
|
-
|
|
34
|
+
target.getData(
|
|
39
35
|
LSP2Utils.generateMappingWithGroupingKey(
|
|
40
36
|
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDADDRESSES_PREFIX,
|
|
41
|
-
bytes20(
|
|
37
|
+
bytes20(caller)
|
|
42
38
|
)
|
|
43
39
|
);
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
function getAllowedFunctionsFor(IERC725Y
|
|
42
|
+
function getAllowedFunctionsFor(IERC725Y target, address caller)
|
|
47
43
|
internal
|
|
48
44
|
view
|
|
49
45
|
returns (bytes memory)
|
|
50
46
|
{
|
|
51
47
|
return
|
|
52
|
-
|
|
48
|
+
target.getData(
|
|
53
49
|
LSP2Utils.generateMappingWithGroupingKey(
|
|
54
50
|
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDFUNCTIONS_PREFIX,
|
|
55
|
-
bytes20(
|
|
51
|
+
bytes20(caller)
|
|
56
52
|
)
|
|
57
53
|
);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
function getAllowedStandardsFor(IERC725Y
|
|
56
|
+
function getAllowedStandardsFor(IERC725Y target, address caller)
|
|
61
57
|
internal
|
|
62
58
|
view
|
|
63
59
|
returns (bytes memory)
|
|
64
60
|
{
|
|
65
61
|
return
|
|
66
|
-
|
|
62
|
+
target.getData(
|
|
67
63
|
LSP2Utils.generateMappingWithGroupingKey(
|
|
68
64
|
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDSTANDARDS_PREFIX,
|
|
69
|
-
bytes20(
|
|
65
|
+
bytes20(caller)
|
|
70
66
|
)
|
|
71
67
|
);
|
|
72
68
|
}
|
|
73
69
|
|
|
74
|
-
function getAllowedERC725YKeysFor(IERC725Y
|
|
70
|
+
function getAllowedERC725YKeysFor(IERC725Y target, address caller)
|
|
75
71
|
internal
|
|
76
72
|
view
|
|
77
73
|
returns (bytes memory)
|
|
78
74
|
{
|
|
79
75
|
return
|
|
80
|
-
|
|
76
|
+
target.getData(
|
|
81
77
|
LSP2Utils.generateMappingWithGroupingKey(
|
|
82
78
|
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDERC725YKEYS_PREFIX,
|
|
83
|
-
bytes20(
|
|
79
|
+
bytes20(caller)
|
|
84
80
|
)
|
|
85
81
|
);
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
/**
|
|
89
|
-
* @dev compare the permissions `
|
|
90
|
-
* to check if they includes the permissions `
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
93
|
-
* @return true if `
|
|
85
|
+
* @dev compare the permissions `addressPermissions` of an address
|
|
86
|
+
* to check if they includes the permissions `permissionToCheck`
|
|
87
|
+
* @param addressPermission the permissions of an address stored on an ERC725 account
|
|
88
|
+
* @param permissionToCheck the permissions to check
|
|
89
|
+
* @return true if `addressPermissions` includes `permissionToCheck`, false otherwise
|
|
94
90
|
*/
|
|
95
|
-
function hasPermission(bytes32
|
|
91
|
+
function hasPermission(bytes32 addressPermission, bytes32 permissionToCheck)
|
|
96
92
|
internal
|
|
97
93
|
pure
|
|
98
94
|
returns (bool)
|
|
99
95
|
{
|
|
100
|
-
return (
|
|
96
|
+
return (addressPermission & permissionToCheck) == permissionToCheck;
|
|
101
97
|
}
|
|
102
98
|
|
|
103
99
|
function setDataViaKeyManager(
|
|
@@ -16,6 +16,10 @@ import {_INTERFACEID_LSP7} from "./LSP7Constants.sol";
|
|
|
16
16
|
* @title LSP7DigitalAsset contract
|
|
17
17
|
* @author Matthew Stevens
|
|
18
18
|
* @dev Implementation of a LSP7 compliant contract.
|
|
19
|
+
*
|
|
20
|
+
* This implementation is agnostic to the way tokens are created.
|
|
21
|
+
* A supply mechanism has to be added in a derived contract using {_mint}
|
|
22
|
+
* For a generic mechanism, see {LSP7Mintable}.
|
|
19
23
|
*/
|
|
20
24
|
contract LSP7DigitalAsset is LSP4DigitalAssetMetadata, LSP7DigitalAssetCore {
|
|
21
25
|
/**
|
|
@@ -25,6 +25,8 @@ import {_TYPEID_LSP7_TOKENSSENDER, _TYPEID_LSP7_TOKENSRECIPIENT} from "./LSP7Con
|
|
|
25
25
|
* @title LSP7DigitalAsset contract
|
|
26
26
|
* @author Matthew Stevens
|
|
27
27
|
* @dev Core Implementation of a LSP7 compliant contract.
|
|
28
|
+
*
|
|
29
|
+
* This contract implement the core logic of the functions for the {ILSP7DigitalAsset} interface.
|
|
28
30
|
*/
|
|
29
31
|
abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
30
32
|
using Address for address;
|
|
@@ -133,7 +135,7 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
133
135
|
uint256[] memory amount,
|
|
134
136
|
bool force,
|
|
135
137
|
bytes[] memory data
|
|
136
|
-
)
|
|
138
|
+
) public virtual override {
|
|
137
139
|
if (
|
|
138
140
|
from.length != to.length || from.length != amount.length || from.length != data.length
|
|
139
141
|
) {
|
|
@@ -8,8 +8,19 @@ import {LSP7DigitalAssetInitAbstract} from "./LSP7DigitalAssetInitAbstract.sol";
|
|
|
8
8
|
* @title LSP7DigitalAsset contract
|
|
9
9
|
* @author Matthew Stevens
|
|
10
10
|
* @dev Proxy Implementation of a LSP7 compliant contract.
|
|
11
|
+
*
|
|
12
|
+
* This implementation is agnostic to the way tokens are created.
|
|
13
|
+
* A supply mechanism has to be added in a derived contract using {_mint}
|
|
14
|
+
* For a generic mechanism, see {LSP7Mintable}.
|
|
11
15
|
*/
|
|
12
16
|
contract LSP7DigitalAssetInit is LSP7DigitalAssetInitAbstract {
|
|
17
|
+
/**
|
|
18
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
_disableInitializers();
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
/**
|
|
14
25
|
* @notice Sets the token-Metadata
|
|
15
26
|
* @param name_ The name of the token
|
|
@@ -6,7 +6,9 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
|
6
6
|
|
|
7
7
|
// modules
|
|
8
8
|
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
LSP4DigitalAssetMetadataInitAbstract
|
|
11
|
+
} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol";
|
|
10
12
|
import {LSP7DigitalAssetCore} from "./LSP7DigitalAssetCore.sol";
|
|
11
13
|
|
|
12
14
|
// constants
|
|
@@ -6,9 +6,9 @@ pragma solidity ^0.8.0;
|
|
|
6
6
|
import {ILSP7DigitalAsset} from "../ILSP7DigitalAsset.sol";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @dev
|
|
9
|
+
* @dev LSP7 extension, for compatibility for clients / tools that expect ERC20.
|
|
10
10
|
*/
|
|
11
|
-
interface
|
|
11
|
+
interface ILSP7CompatibleERC20 is ILSP7DigitalAsset {
|
|
12
12
|
/**
|
|
13
13
|
* @notice To provide compatibility with indexing ERC20 events.
|
|
14
14
|
* @dev Emitted when `amount` tokens is transferred from `from` to `to`.
|
|
@@ -32,7 +32,7 @@ interface ILSP7CompatibilityForERC20 is ILSP7DigitalAsset {
|
|
|
32
32
|
* @param to The receiving address
|
|
33
33
|
* @param amount The amount of tokens to transfer
|
|
34
34
|
*/
|
|
35
|
-
function transfer(address to, uint256 amount) external;
|
|
35
|
+
function transfer(address to, uint256 amount) external returns (bool);
|
|
36
36
|
|
|
37
37
|
/*
|
|
38
38
|
* @dev Compatible with ERC20 transferFrom
|
|
@@ -44,14 +44,14 @@ interface ILSP7CompatibilityForERC20 is ILSP7DigitalAsset {
|
|
|
44
44
|
address from,
|
|
45
45
|
address to,
|
|
46
46
|
uint256 amount
|
|
47
|
-
) external;
|
|
47
|
+
) external returns (bool);
|
|
48
48
|
|
|
49
49
|
/*
|
|
50
50
|
* @dev Compatible with ERC20 approve
|
|
51
51
|
* @param operator The address to approve for `amount`
|
|
52
52
|
* @param amount The amount to approve
|
|
53
53
|
*/
|
|
54
|
-
function approve(address operator, uint256 amount) external;
|
|
54
|
+
function approve(address operator, uint256 amount) external returns (bool);
|
|
55
55
|
|
|
56
56
|
/*
|
|
57
57
|
* @dev Compatible with ERC20 allowance
|
|
@@ -59,5 +59,5 @@ interface ILSP7CompatibilityForERC20 is ILSP7DigitalAsset {
|
|
|
59
59
|
* @param operator The address approved by the `tokenOwner`
|
|
60
60
|
* @return The amount `operator` is approved by `tokenOwner`
|
|
61
61
|
*/
|
|
62
|
-
function allowance(address tokenOwner, address operator) external returns (uint256);
|
|
62
|
+
function allowance(address tokenOwner, address operator) external view returns (uint256);
|
|
63
63
|
}
|
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import {
|
|
6
|
+
import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
|
|
7
7
|
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
8
|
import {LSP7CappedSupplyCore} from "./LSP7CappedSupplyCore.sol";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @dev LSP7 extension, adds token supply cap.
|
|
12
12
|
*/
|
|
13
|
-
abstract contract LSP7CappedSupplyInitAbstract is
|
|
13
|
+
abstract contract LSP7CappedSupplyInitAbstract is
|
|
14
|
+
LSP7DigitalAssetInitAbstract,
|
|
15
|
+
LSP7CappedSupplyCore
|
|
16
|
+
{
|
|
14
17
|
function _initialize(uint256 tokenSupplyCap_) internal virtual onlyInitializing {
|
|
15
18
|
if (tokenSupplyCap_ == 0) {
|
|
16
19
|
revert LSP7CappedSupplyRequired();
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.0;
|
|
4
3
|
|
|
5
4
|
// modules
|
|
6
5
|
import {LSP7DigitalAsset, LSP4DigitalAssetMetadata, ERC725YCore} from "../LSP7DigitalAsset.sol";
|
|
7
6
|
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
-
import {
|
|
7
|
+
import {LSP7CompatibleERC20Core} from "./LSP7CompatibleERC20Core.sol";
|
|
9
8
|
|
|
10
|
-
contract
|
|
9
|
+
contract LSP7CompatibleERC20 is LSP7DigitalAsset, LSP7CompatibleERC20Core {
|
|
11
10
|
/* solhint-disable no-empty-blocks */
|
|
12
11
|
/**
|
|
13
12
|
* @notice Sets the name, the symbol and the owner of the token
|
|
@@ -26,7 +25,7 @@ contract LSP7CompatibilityForERC20 is LSP7DigitalAsset, LSP7CompatibilityForERC2
|
|
|
26
25
|
function authorizeOperator(address operator, uint256 amount)
|
|
27
26
|
public
|
|
28
27
|
virtual
|
|
29
|
-
override(LSP7DigitalAssetCore,
|
|
28
|
+
override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core)
|
|
30
29
|
{
|
|
31
30
|
super.authorizeOperator(operator, amount);
|
|
32
31
|
}
|
|
@@ -35,7 +34,7 @@ contract LSP7CompatibilityForERC20 is LSP7DigitalAsset, LSP7CompatibilityForERC2
|
|
|
35
34
|
address from,
|
|
36
35
|
uint256 amount,
|
|
37
36
|
bytes memory data
|
|
38
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
37
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
39
38
|
super._burn(from, amount, data);
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -44,7 +43,7 @@ contract LSP7CompatibilityForERC20 is LSP7DigitalAsset, LSP7CompatibilityForERC2
|
|
|
44
43
|
uint256 amount,
|
|
45
44
|
bool force,
|
|
46
45
|
bytes memory data
|
|
47
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
46
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
48
47
|
super._mint(to, amount, force, data);
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -54,7 +53,7 @@ contract LSP7CompatibilityForERC20 is LSP7DigitalAsset, LSP7CompatibilityForERC2
|
|
|
54
53
|
uint256 amount,
|
|
55
54
|
bool force,
|
|
56
55
|
bytes memory data
|
|
57
|
-
) internal virtual override(LSP7DigitalAssetCore,
|
|
56
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibleERC20Core) {
|
|
58
57
|
super._transfer(from, to, amount, force, data);
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -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,23 +13,26 @@ 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 override 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
38
|
override
|
|
@@ -39,16 +42,17 @@ abstract contract LSP7CompatibilityForERC20Core is
|
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
|
-
* @inheritdoc
|
|
45
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
43
46
|
* @dev Compatible with ERC20 transfer.
|
|
44
47
|
* Using force=true so that EOA and any contract may receive the tokens.
|
|
45
48
|
*/
|
|
46
|
-
function transfer(address to, uint256 amount)
|
|
47
|
-
|
|
49
|
+
function transfer(address to, uint256 amount) public virtual override returns (bool) {
|
|
50
|
+
transfer(_msgSender(), to, amount, true, "");
|
|
51
|
+
return true;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
* @inheritdoc
|
|
55
|
+
* @inheritdoc ILSP7CompatibleERC20
|
|
52
56
|
* @dev Compatible with ERC20 transferFrom.
|
|
53
57
|
* Using force=true so that EOA and any contract may receive the tokens.
|
|
54
58
|
*/
|
|
@@ -56,12 +60,11 @@ abstract contract LSP7CompatibilityForERC20Core is
|
|
|
56
60
|
address from,
|
|
57
61
|
address to,
|
|
58
62
|
uint256 amount
|
|
59
|
-
)
|
|
60
|
-
|
|
63
|
+
) public virtual override returns (bool) {
|
|
64
|
+
transfer(from, to, amount, true, "");
|
|
65
|
+
return true;
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
// --- Overrides
|
|
64
|
-
|
|
65
68
|
function authorizeOperator(address operator, uint256 amount)
|
|
66
69
|
public
|
|
67
70
|
virtual
|
|
@@ -72,6 +75,8 @@ abstract contract LSP7CompatibilityForERC20Core is
|
|
|
72
75
|
emit Approval(_msgSender(), operator, amount);
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
// --- Internals
|
|
79
|
+
|
|
75
80
|
function _transfer(
|
|
76
81
|
address from,
|
|
77
82
|
address to,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7CompatibleERC20InitAbstract} from "./LSP7CompatibleERC20InitAbstract.sol";
|
|
7
|
+
|
|
8
|
+
contract LSP7CompatibleERC20Init is LSP7CompatibleERC20InitAbstract {
|
|
9
|
+
/**
|
|
10
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
_disableInitializers();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @notice Sets the name, the symbol and the owner of the token
|
|
18
|
+
* @param name_ The name of the token
|
|
19
|
+
* @param symbol_ The symbol of the token
|
|
20
|
+
* @param newOwner_ The owner of the token
|
|
21
|
+
*/
|
|
22
|
+
function initialize(
|
|
23
|
+
string memory name_,
|
|
24
|
+
string memory symbol_,
|
|
25
|
+
address newOwner_
|
|
26
|
+
) public virtual initializer {
|
|
27
|
+
LSP7CompatibleERC20InitAbstract._initialize(name_, symbol_, newOwner_);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -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,11 +1,12 @@
|
|
|
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";
|
|
7
8
|
|
|
8
|
-
contract
|
|
9
|
+
contract LSP7CompatibleERC20MintableInit is LSP7CompatibleERC20MintableInitAbstract {
|
|
9
10
|
/**
|
|
10
11
|
* @notice Sets the name, the symbol and the owner of the token
|
|
11
12
|
* @param name_ The name of the token
|
|
@@ -17,6 +18,6 @@ contract LSP7CompatibilityForERC20Init is LSP7CompatibilityForERC20InitAbstract
|
|
|
17
18
|
string memory symbol_,
|
|
18
19
|
address newOwner_
|
|
19
20
|
) public virtual initializer {
|
|
20
|
-
|
|
21
|
+
LSP7CompatibleERC20MintableInitAbstract._initialize(name_, symbol_, newOwner_);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -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
|
+
}
|
|
@@ -9,6 +9,13 @@ 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
|
|
@@ -21,7 +28,7 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
|
|
|
21
28
|
string memory symbol_,
|
|
22
29
|
address newOwner_,
|
|
23
30
|
bool isNFT_
|
|
24
|
-
) public virtual
|
|
31
|
+
) public virtual initializer {
|
|
25
32
|
LSP7MintableInitAbstract._initialize(name_, symbol_, newOwner_, isNFT_);
|
|
26
33
|
}
|
|
27
34
|
}
|
|
@@ -10,7 +10,7 @@ import {LSP7MintableCore} from "./LSP7MintableCore.sol";
|
|
|
10
10
|
/**
|
|
11
11
|
* @dev LSP7 extension, mintable.
|
|
12
12
|
*/
|
|
13
|
-
abstract contract LSP7MintableInitAbstract is
|
|
13
|
+
abstract contract LSP7MintableInitAbstract is LSP7DigitalAssetInitAbstract, LSP7MintableCore {
|
|
14
14
|
function _initialize(
|
|
15
15
|
string memory name_,
|
|
16
16
|
string memory symbol_,
|
|
@@ -204,7 +204,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is Context, ILSP8Identifiable
|
|
|
204
204
|
bytes32[] memory tokenId,
|
|
205
205
|
bool force,
|
|
206
206
|
bytes[] memory data
|
|
207
|
-
)
|
|
207
|
+
) public virtual override {
|
|
208
208
|
if (
|
|
209
209
|
from.length != to.length || from.length != tokenId.length || from.length != data.length
|
|
210
210
|
) {
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
LSP8IdentifiableDigitalAssetInitAbstract
|
|
7
|
+
} from "./LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @title LSP8IdentifiableDigitalAsset contract
|
|
@@ -10,6 +12,13 @@ import {LSP8IdentifiableDigitalAssetInitAbstract} from "./LSP8IdentifiableDigita
|
|
|
10
12
|
* @dev Proxy Implementation of a LSP8 compliant contract.
|
|
11
13
|
*/
|
|
12
14
|
contract LSP8IdentifiableDigitalAssetInit is LSP8IdentifiableDigitalAssetInitAbstract {
|
|
15
|
+
/**
|
|
16
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
17
|
+
*/
|
|
18
|
+
constructor() {
|
|
19
|
+
_disableInitializers();
|
|
20
|
+
}
|
|
21
|
+
|
|
13
22
|
/**
|
|
14
23
|
* @notice Sets the token-Metadata
|
|
15
24
|
* @param name_ The name of the token
|