@lukso/lsp-smart-contracts 0.4.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -9
- package/artifacts/LSP0ERC725Account.json +398 -0
- package/artifacts/LSP0ERC725AccountInit.json +439 -0
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +7 -7
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +7 -7
- package/artifacts/LSP4Compatibility.json +195 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +169 -0
- package/artifacts/LSP4DigitalAssetMetadataInit.json +231 -0
- package/artifacts/LSP6KeyManager.json +50 -28
- package/artifacts/LSP6KeyManagerInit.json +58 -23
- package/artifacts/LSP7CappedSupply.json +136 -11
- package/artifacts/LSP7CappedSupplyInit.json +163 -35
- package/artifacts/LSP7CompatibilityForERC20.json +204 -13
- package/artifacts/LSP7CompatibilityForERC20Init.json +727 -0
- package/artifacts/LSP7DigitalAsset.json +128 -13
- package/artifacts/LSP7DigitalAssetInit.json +152 -34
- package/artifacts/LSP7Mintable.json +129 -14
- package/artifacts/LSP7MintableInit.json +153 -35
- package/artifacts/LSP8CappedSupply.json +137 -11
- package/artifacts/LSP8CappedSupplyInit.json +172 -20
- package/artifacts/LSP8CompatibilityForERC721.json +138 -17
- package/artifacts/LSP8CompatibilityForERC721Init.json +873 -0
- package/artifacts/LSP8IdentifiableDigitalAsset.json +129 -13
- package/artifacts/LSP8IdentifiableDigitalAssetInit.json +161 -19
- package/artifacts/LSP8Mintable.json +141 -14
- package/artifacts/LSP8MintableInit.json +173 -20
- package/artifacts/LSP9Vault.json +374 -0
- package/artifacts/LSP9VaultInit.json +415 -0
- package/artifacts/UniversalFactory.json +127 -0
- package/artifacts/UniversalProfile.json +78 -53
- package/artifacts/UniversalProfileInit.json +117 -53
- package/artifacts/UniversalReceiverAddressStore.json +209 -0
- package/constants.js +500 -0
- package/contracts/Custom/ClaimOwnership.sol +31 -0
- package/contracts/Custom/ERC165Checker.sol +130 -0
- package/contracts/Custom/IClaimOwnership.sol +10 -0
- package/contracts/Factories/UniversalFactory.sol +155 -0
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +5 -9
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +6 -8
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +92 -48
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +5 -5
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +6 -21
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +10 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +3 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +4 -2
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +3 -9
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +61 -165
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +49 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +50 -90
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +40 -6
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +48 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +205 -0
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +11 -0
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +6 -15
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +10 -4
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +11 -8
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +9 -13
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +14 -20
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +10 -0
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +205 -0
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +21 -18
- package/contracts/LSP6KeyManager/LSP6Constants.sol +61 -24
- package/contracts/LSP6KeyManager/LSP6Errors.sol +37 -0
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +3 -4
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +475 -260
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +6 -5
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +7 -15
- package/contracts/LSP6KeyManager/LSP6Utils.sol +111 -0
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +3 -8
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +5 -4
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +22 -8
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +70 -96
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +8 -9
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +23 -21
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +23 -0
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibilityForERC20.sol +22 -6
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -6
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +14 -12
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +3 -8
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +9 -17
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20.sol +37 -45
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Core.sol +107 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Init.sol +22 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20InitAbstract.sol +66 -0
- package/contracts/LSP7DigitalAsset/{extensions → presets}/ILSP7Mintable.sol +1 -1
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7Mintable.sol +4 -3
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableCore.sol +5 -5
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableInit.sol +3 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +34 -0
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +5 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +6 -3
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +22 -0
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +21 -8
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +102 -135
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +8 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +22 -19
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibilityForERC721.sol +17 -22
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +9 -15
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +14 -12
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +3 -8
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +9 -18
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721.sol +37 -189
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Core.sol +187 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Init.sol +25 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721InitAbstract.sol +89 -0
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/ILSP8Mintable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8Mintable.sol +4 -3
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableCore.sol +5 -8
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableInit.sol +4 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +35 -0
- package/contracts/LSP9Vault/LSP9Constants.sol +14 -5
- package/contracts/LSP9Vault/LSP9Vault.sol +15 -37
- package/contracts/LSP9Vault/LSP9VaultCore.sol +105 -85
- package/contracts/LSP9Vault/LSP9VaultInit.sol +5 -4
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +15 -45
- package/contracts/Legacy/Registries/AddressRegistry.sol +43 -0
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +33 -0
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +60 -0
- package/contracts/UniversalProfile.sol +11 -20
- package/contracts/UniversalProfileInit.sol +5 -4
- package/contracts/UniversalProfileInitAbstract.sol +14 -35
- package/contracts/Utils/UtilsLib.sol +47 -11
- package/package.json +23 -9
- package/artifacts/LSP1UniversalReceiverDelegateUPInit.json +0 -66
- package/artifacts/LSP1UniversalReceiverDelegateVaultInit.json +0 -66
- package/constants.ts +0 -350
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPCore.sol +0 -52
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInit.sol +0 -26
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInitAbstract.sol +0 -28
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultCore.sol +0 -41
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInit.sol +0 -23
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInitAbstract.sol +0 -25
- package/contracts/LSP7DigitalAsset/extensions/LSP7MintableInitAbstract.sol +0 -47
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8MintableInitAbstract.sol +0 -44
- package/contracts/UniversalProfileCore.sol +0 -56
- package/contracts/Utils/ERC725Utils.sol +0 -169
- package/contracts/Utils/LSP2Utils.sol +0 -127
- package/contracts/Utils/LSP6Utils.sol +0 -77
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// SPDX-License-Identifier: CC0-1.0
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
// --- Errors
|
|
5
|
+
|
|
6
|
+
error LSP7AmountExceedsBalance(uint256 balance, address tokenOwner, uint256 amount);
|
|
7
|
+
|
|
8
|
+
error LSP7AmountExceedsAuthorizedAmount(
|
|
9
|
+
address tokenOwner,
|
|
10
|
+
uint256 authorizedAmount,
|
|
11
|
+
address operator,
|
|
12
|
+
uint256 amount
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
error LSP7CannotUseAddressZeroAsOperator();
|
|
16
|
+
|
|
17
|
+
error LSP7CannotSendWithAddressZero();
|
|
18
|
+
|
|
19
|
+
error LSP7InvalidTransferBatch();
|
|
20
|
+
|
|
21
|
+
error LSP7NotifyTokenReceiverContractMissingLSP1Interface(address tokenReceiver);
|
|
22
|
+
|
|
23
|
+
error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver);
|
|
@@ -3,21 +3,39 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// interfaces
|
|
6
|
-
import "../ILSP7DigitalAsset.sol";
|
|
6
|
+
import {ILSP7DigitalAsset} from "../ILSP7DigitalAsset.sol";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @dev LSP8 extension, for compatibility for clients / tools that expect ERC20.
|
|
10
10
|
*/
|
|
11
11
|
interface ILSP7CompatibilityForERC20 is ILSP7DigitalAsset {
|
|
12
|
+
/**
|
|
13
|
+
* @notice To provide compatibility with indexing ERC20 events.
|
|
14
|
+
* @dev Emitted when `amount` tokens is transferred from `from` to `to`.
|
|
15
|
+
* @param from The sending address
|
|
16
|
+
* @param to The receiving address
|
|
17
|
+
* @param value The amount of tokens transfered.
|
|
18
|
+
*/
|
|
19
|
+
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @notice To provide compatibility with indexing ERC20 events.
|
|
23
|
+
* @dev Emitted when `owner` enables `spender` for `value` tokens.
|
|
24
|
+
* @param owner The account giving approval
|
|
25
|
+
* @param spender The account receiving approval
|
|
26
|
+
* @param value The amount of tokens `spender` has access to from `owner`
|
|
27
|
+
*/
|
|
28
|
+
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
29
|
+
|
|
12
30
|
/*
|
|
13
|
-
* @dev Compatible with ERC20
|
|
31
|
+
* @dev Compatible with ERC20 transfer
|
|
14
32
|
* @param to The receiving address
|
|
15
33
|
* @param amount The amount of tokens to transfer
|
|
16
34
|
*/
|
|
17
35
|
function transfer(address to, uint256 amount) external;
|
|
18
36
|
|
|
19
37
|
/*
|
|
20
|
-
* @dev Compatible with ERC20
|
|
38
|
+
* @dev Compatible with ERC20 transferFrom
|
|
21
39
|
* @param from The sending address
|
|
22
40
|
* @param to The receiving address
|
|
23
41
|
* @param amount The amount of tokens to transfer
|
|
@@ -41,7 +59,5 @@ interface ILSP7CompatibilityForERC20 is ILSP7DigitalAsset {
|
|
|
41
59
|
* @param operator The address approved by the `tokenOwner`
|
|
42
60
|
* @return The amount `operator` is approved by `tokenOwner`
|
|
43
61
|
*/
|
|
44
|
-
function allowance(address tokenOwner, address operator)
|
|
45
|
-
external
|
|
46
|
-
returns (uint256);
|
|
62
|
+
function allowance(address tokenOwner, address operator) external returns (uint256);
|
|
47
63
|
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import "
|
|
7
|
-
import "../
|
|
6
|
+
import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
|
|
7
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
+
import {LSP7CappedSupplyCore} from "./LSP7CappedSupplyCore.sol";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @dev LSP7 extension, adds token supply cap.
|
|
@@ -15,10 +16,10 @@ abstract contract LSP7CappedSupply is LSP7DigitalAsset, LSP7CappedSupplyCore {
|
|
|
15
16
|
* @param tokenSupplyCap_ The Token max supply
|
|
16
17
|
*/
|
|
17
18
|
constructor(uint256 tokenSupplyCap_) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (tokenSupplyCap_ == 0) {
|
|
20
|
+
revert LSP7CappedSupplyRequired();
|
|
21
|
+
}
|
|
22
|
+
|
|
22
23
|
_tokenSupplyCap = tokenSupplyCap_;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
-
// modules
|
|
6
|
-
import "../LSP7DigitalAssetCore.sol";
|
|
7
|
-
|
|
8
5
|
// interfaces
|
|
9
|
-
import "./ILSP7CappedSupply.sol";
|
|
6
|
+
import {ILSP7CappedSupply} from "./ILSP7CappedSupply.sol";
|
|
7
|
+
|
|
8
|
+
// modules
|
|
9
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @dev LSP7 extension, adds token supply cap.
|
|
13
13
|
*/
|
|
14
|
-
abstract contract LSP7CappedSupplyCore is
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
abstract contract LSP7CappedSupplyCore is LSP7DigitalAssetCore, ILSP7CappedSupply {
|
|
15
|
+
// --- Errors
|
|
16
|
+
|
|
17
|
+
error LSP7CappedSupplyRequired();
|
|
18
|
+
error LSP7CappedSupplyCannotMintOverCap();
|
|
19
|
+
|
|
18
20
|
// --- Storage
|
|
19
21
|
|
|
20
22
|
uint256 internal _tokenSupplyCap;
|
|
@@ -46,10 +48,10 @@ abstract contract LSP7CappedSupplyCore is
|
|
|
46
48
|
bool force,
|
|
47
49
|
bytes memory data
|
|
48
50
|
) internal virtual override {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
if (totalSupply() + amount > tokenSupplyCap()) {
|
|
52
|
+
revert LSP7CappedSupplyCannotMintOverCap();
|
|
53
|
+
}
|
|
54
|
+
|
|
53
55
|
super._mint(to, amount, force, data);
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import "./LSP7CappedSupplyInitAbstract.sol";
|
|
6
|
+
import {LSP7CappedSupplyInitAbstract} from "./LSP7CappedSupplyInitAbstract.sol";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @dev LSP7 extension, adds token supply cap.
|
|
@@ -13,12 +13,7 @@ abstract contract LSP7CappedSupplyInit is LSP7CappedSupplyInitAbstract {
|
|
|
13
13
|
* @notice Sets the token max supply
|
|
14
14
|
* @param tokenSupplyCap_ The Token max supply
|
|
15
15
|
*/
|
|
16
|
-
function initialize(uint256 tokenSupplyCap_)
|
|
17
|
-
|
|
18
|
-
virtual
|
|
19
|
-
override
|
|
20
|
-
initializer
|
|
21
|
-
{
|
|
22
|
-
LSP7CappedSupplyInitAbstract.initialize(tokenSupplyCap_);
|
|
16
|
+
function initialize(uint256 tokenSupplyCap_) public virtual initializer {
|
|
17
|
+
LSP7CappedSupplyInitAbstract._initialize(tokenSupplyCap_);
|
|
23
18
|
}
|
|
24
19
|
}
|
|
@@ -3,27 +3,19 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import "
|
|
7
|
-
import "../
|
|
6
|
+
import {LSP7DigitalAssetInit} from "../LSP7DigitalAssetInit.sol";
|
|
7
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
+
import {LSP7CappedSupplyCore} from "./LSP7CappedSupplyCore.sol";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @dev LSP7 extension, adds token supply cap.
|
|
11
12
|
*/
|
|
12
|
-
abstract contract LSP7CappedSupplyInitAbstract is
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @notice Sets the token max supply
|
|
19
|
-
* @param tokenSupplyCap_ The Token max supply
|
|
20
|
-
*/
|
|
21
|
-
function initialize(uint256 tokenSupplyCap_)
|
|
22
|
-
public
|
|
23
|
-
virtual
|
|
24
|
-
onlyInitializing
|
|
25
|
-
{
|
|
26
|
-
require(tokenSupplyCap_ > 0, "LSP7Capped: tokenSupplyCap is zero");
|
|
13
|
+
abstract contract LSP7CappedSupplyInitAbstract is LSP7DigitalAssetInit, LSP7CappedSupplyCore {
|
|
14
|
+
function _initialize(uint256 tokenSupplyCap_) internal virtual onlyInitializing {
|
|
15
|
+
if (tokenSupplyCap_ == 0) {
|
|
16
|
+
revert LSP7CappedSupplyRequired();
|
|
17
|
+
}
|
|
18
|
+
|
|
27
19
|
_tokenSupplyCap = tokenSupplyCap_;
|
|
28
20
|
}
|
|
29
21
|
|
|
@@ -3,18 +3,11 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// modules
|
|
6
|
-
import "../LSP7DigitalAsset.sol";
|
|
6
|
+
import {LSP7DigitalAsset, LSP4DigitalAssetMetadata, ERC725YCore} from "../LSP7DigitalAsset.sol";
|
|
7
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
+
import {LSP7CompatibilityForERC20Core} from "./LSP7CompatibilityForERC20Core.sol";
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
import "./ILSP7CompatibilityForERC20.sol";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @dev LSP7 extension, for compatibility for clients / tools that expect ERC20.
|
|
13
|
-
*/
|
|
14
|
-
contract LSP7CompatibilityForERC20 is
|
|
15
|
-
ILSP7CompatibilityForERC20,
|
|
16
|
-
LSP7DigitalAsset
|
|
17
|
-
{
|
|
10
|
+
contract LSP7CompatibilityForERC20 is LSP7DigitalAsset, LSP7CompatibilityForERC20Core {
|
|
18
11
|
/* solhint-disable no-empty-blocks */
|
|
19
12
|
/**
|
|
20
13
|
* @notice Sets the name, the symbol and the owner of the token
|
|
@@ -28,49 +21,48 @@ contract LSP7CompatibilityForERC20 is
|
|
|
28
21
|
address newOwner_
|
|
29
22
|
) LSP7DigitalAsset(name_, symbol_, newOwner_, false) {}
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
external
|
|
24
|
+
// --- Overrides
|
|
25
|
+
|
|
26
|
+
function authorizeOperator(address operator, uint256 amount)
|
|
27
|
+
public
|
|
36
28
|
virtual
|
|
37
|
-
override
|
|
29
|
+
override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core)
|
|
38
30
|
{
|
|
39
|
-
|
|
31
|
+
super.authorizeOperator(operator, amount);
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
virtual
|
|
49
|
-
override
|
|
50
|
-
returns (uint256)
|
|
51
|
-
{
|
|
52
|
-
return isOperatorFor(operator, tokenOwner);
|
|
34
|
+
function _burn(
|
|
35
|
+
address from,
|
|
36
|
+
uint256 amount,
|
|
37
|
+
bytes memory data
|
|
38
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
39
|
+
super._burn(from, amount, data);
|
|
53
40
|
}
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
function _mint(
|
|
43
|
+
address to,
|
|
44
|
+
uint256 amount,
|
|
45
|
+
bool force,
|
|
46
|
+
bytes memory data
|
|
47
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
48
|
+
super._mint(to, amount, force, data);
|
|
62
49
|
}
|
|
63
50
|
|
|
64
|
-
|
|
65
|
-
* @inheritdoc ILSP7CompatibilityForERC20
|
|
66
|
-
* @dev Compatible with ERC20 transferFrom.
|
|
67
|
-
* Using force=true so that EOA and any contract may receive the tokens.
|
|
68
|
-
*/
|
|
69
|
-
function transferFrom(
|
|
51
|
+
function _transfer(
|
|
70
52
|
address from,
|
|
71
53
|
address to,
|
|
72
|
-
uint256 amount
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
uint256 amount,
|
|
55
|
+
bool force,
|
|
56
|
+
bytes memory data
|
|
57
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
58
|
+
super._transfer(from, to, amount, force, data);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function _setData(bytes32 key, bytes memory value)
|
|
62
|
+
internal
|
|
63
|
+
virtual
|
|
64
|
+
override(LSP4DigitalAssetMetadata, ERC725YCore)
|
|
65
|
+
{
|
|
66
|
+
super._setData(key, value);
|
|
75
67
|
}
|
|
76
68
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
// interfaces
|
|
6
|
+
import {ILSP7DigitalAsset} from "../ILSP7DigitalAsset.sol";
|
|
7
|
+
import {ILSP7CompatibilityForERC20} from "./ILSP7CompatibilityForERC20.sol";
|
|
8
|
+
|
|
9
|
+
// modules
|
|
10
|
+
import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
|
|
11
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @dev LSP7 extension, for compatibility for clients / tools that expect ERC20.
|
|
15
|
+
*/
|
|
16
|
+
abstract contract LSP7CompatibilityForERC20Core is
|
|
17
|
+
LSP4Compatibility,
|
|
18
|
+
LSP7DigitalAssetCore,
|
|
19
|
+
ILSP7CompatibilityForERC20
|
|
20
|
+
{
|
|
21
|
+
/**
|
|
22
|
+
* @inheritdoc ILSP7CompatibilityForERC20
|
|
23
|
+
*/
|
|
24
|
+
function approve(address operator, uint256 amount) external virtual override {
|
|
25
|
+
return authorizeOperator(operator, amount);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @inheritdoc ILSP7CompatibilityForERC20
|
|
30
|
+
*/
|
|
31
|
+
function allowance(address tokenOwner, address operator)
|
|
32
|
+
external
|
|
33
|
+
view
|
|
34
|
+
virtual
|
|
35
|
+
override
|
|
36
|
+
returns (uint256)
|
|
37
|
+
{
|
|
38
|
+
return isOperatorFor(operator, tokenOwner);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @inheritdoc ILSP7CompatibilityForERC20
|
|
43
|
+
* @dev Compatible with ERC20 transfer.
|
|
44
|
+
* Using force=true so that EOA and any contract may receive the tokens.
|
|
45
|
+
*/
|
|
46
|
+
function transfer(address to, uint256 amount) external virtual override {
|
|
47
|
+
return transfer(_msgSender(), to, amount, true, "");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @inheritdoc ILSP7CompatibilityForERC20
|
|
52
|
+
* @dev Compatible with ERC20 transferFrom.
|
|
53
|
+
* Using force=true so that EOA and any contract may receive the tokens.
|
|
54
|
+
*/
|
|
55
|
+
function transferFrom(
|
|
56
|
+
address from,
|
|
57
|
+
address to,
|
|
58
|
+
uint256 amount
|
|
59
|
+
) external virtual override {
|
|
60
|
+
return transfer(from, to, amount, true, "");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// --- Overrides
|
|
64
|
+
|
|
65
|
+
function authorizeOperator(address operator, uint256 amount)
|
|
66
|
+
public
|
|
67
|
+
virtual
|
|
68
|
+
override(ILSP7DigitalAsset, LSP7DigitalAssetCore)
|
|
69
|
+
{
|
|
70
|
+
super.authorizeOperator(operator, amount);
|
|
71
|
+
|
|
72
|
+
emit Approval(_msgSender(), operator, amount);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function _transfer(
|
|
76
|
+
address from,
|
|
77
|
+
address to,
|
|
78
|
+
uint256 amount,
|
|
79
|
+
bool force,
|
|
80
|
+
bytes memory data
|
|
81
|
+
) internal virtual override {
|
|
82
|
+
super._transfer(from, to, amount, force, data);
|
|
83
|
+
|
|
84
|
+
emit Transfer(from, to, amount);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _mint(
|
|
88
|
+
address to,
|
|
89
|
+
uint256 amount,
|
|
90
|
+
bool force,
|
|
91
|
+
bytes memory data
|
|
92
|
+
) internal virtual override {
|
|
93
|
+
super._mint(to, amount, force, data);
|
|
94
|
+
|
|
95
|
+
emit Transfer(address(0), to, amount);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function _burn(
|
|
99
|
+
address from,
|
|
100
|
+
uint256 amount,
|
|
101
|
+
bytes memory data
|
|
102
|
+
) internal virtual override {
|
|
103
|
+
super._burn(from, amount, data);
|
|
104
|
+
|
|
105
|
+
emit Transfer(from, address(0), amount);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7CompatibilityForERC20InitAbstract} from "./LSP7CompatibilityForERC20InitAbstract.sol";
|
|
7
|
+
|
|
8
|
+
contract LSP7CompatibilityForERC20Init is LSP7CompatibilityForERC20InitAbstract {
|
|
9
|
+
/**
|
|
10
|
+
* @notice Sets the name, the symbol and the owner of the token
|
|
11
|
+
* @param name_ The name of the token
|
|
12
|
+
* @param symbol_ The symbol of the token
|
|
13
|
+
* @param newOwner_ The owner of the token
|
|
14
|
+
*/
|
|
15
|
+
function initialize(
|
|
16
|
+
string memory name_,
|
|
17
|
+
string memory symbol_,
|
|
18
|
+
address newOwner_
|
|
19
|
+
) public virtual initializer {
|
|
20
|
+
LSP7CompatibilityForERC20InitAbstract._initialize(name_, symbol_, newOwner_);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7DigitalAssetInitAbstract, LSP4DigitalAssetMetadataInitAbstract, ERC725YCore} from "../LSP7DigitalAssetInitAbstract.sol";
|
|
7
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
8
|
+
import {LSP7CompatibilityForERC20Core} from "./LSP7CompatibilityForERC20Core.sol";
|
|
9
|
+
|
|
10
|
+
contract LSP7CompatibilityForERC20InitAbstract is
|
|
11
|
+
LSP7DigitalAssetInitAbstract,
|
|
12
|
+
LSP7CompatibilityForERC20Core
|
|
13
|
+
{
|
|
14
|
+
function _initialize(
|
|
15
|
+
string memory name_,
|
|
16
|
+
string memory symbol_,
|
|
17
|
+
address newOwner_
|
|
18
|
+
) internal virtual override onlyInitializing {
|
|
19
|
+
LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, false);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// --- Overrides
|
|
23
|
+
|
|
24
|
+
function authorizeOperator(address operator, uint256 amount)
|
|
25
|
+
public
|
|
26
|
+
virtual
|
|
27
|
+
override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core)
|
|
28
|
+
{
|
|
29
|
+
super.authorizeOperator(operator, amount);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function _burn(
|
|
33
|
+
address from,
|
|
34
|
+
uint256 amount,
|
|
35
|
+
bytes memory data
|
|
36
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
37
|
+
super._burn(from, amount, data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _mint(
|
|
41
|
+
address to,
|
|
42
|
+
uint256 amount,
|
|
43
|
+
bool force,
|
|
44
|
+
bytes memory data
|
|
45
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
46
|
+
super._mint(to, amount, force, data);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _transfer(
|
|
50
|
+
address from,
|
|
51
|
+
address to,
|
|
52
|
+
uint256 amount,
|
|
53
|
+
bool force,
|
|
54
|
+
bytes memory data
|
|
55
|
+
) internal virtual override(LSP7DigitalAssetCore, LSP7CompatibilityForERC20Core) {
|
|
56
|
+
super._transfer(from, to, amount, force, data);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _setData(bytes32 key, bytes memory value)
|
|
60
|
+
internal
|
|
61
|
+
virtual
|
|
62
|
+
override(LSP4DigitalAssetMetadataInitAbstract, ERC725YCore)
|
|
63
|
+
{
|
|
64
|
+
super._setData(key, value);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import "../LSP7DigitalAsset.sol";
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
|
|
7
|
+
import {LSP7MintableCore} from "./LSP7MintableCore.sol";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @title LSP7Mintable
|
|
10
11
|
* @author Jean Cavallera, Yamen Merhi
|
|
11
12
|
* @dev LSP7 extension, mintable.
|
|
12
13
|
*/
|
|
13
|
-
contract LSP7Mintable is
|
|
14
|
+
contract LSP7Mintable is LSP7DigitalAsset, LSP7MintableCore {
|
|
14
15
|
// solhint-disable no-empty-blocks
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
-
// modules
|
|
6
|
-
import "../LSP7DigitalAssetCore.sol";
|
|
7
|
-
|
|
8
5
|
// interfaces
|
|
9
|
-
import "./ILSP7Mintable.sol";
|
|
6
|
+
import {ILSP7Mintable} from "./ILSP7Mintable.sol";
|
|
7
|
+
|
|
8
|
+
// modules
|
|
9
|
+
import {LSP7DigitalAssetCore} from "../LSP7DigitalAssetCore.sol";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @dev LSP7 extension, mintable .
|
|
13
13
|
*/
|
|
14
|
-
abstract contract LSP7MintableCore is
|
|
14
|
+
abstract contract LSP7MintableCore is LSP7DigitalAssetCore, ILSP7Mintable {
|
|
15
15
|
/**
|
|
16
16
|
* @inheritdoc ILSP7Mintable
|
|
17
17
|
*/
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7MintableInitAbstract} from "./LSP7MintableInitAbstract.sol";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @dev LSP7 extension, mintable.
|
|
@@ -21,6 +22,6 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
|
|
|
21
22
|
address newOwner_,
|
|
22
23
|
bool isNFT_
|
|
23
24
|
) public virtual override initializer {
|
|
24
|
-
LSP7MintableInitAbstract.
|
|
25
|
+
LSP7MintableInitAbstract._initialize(name_, symbol_, newOwner_, isNFT_);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.0;
|
|
4
|
+
|
|
5
|
+
// modules
|
|
6
|
+
import {LSP7DigitalAssetInit} from "../LSP7DigitalAssetInit.sol";
|
|
7
|
+
import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
|
|
8
|
+
import {LSP7MintableCore} from "./LSP7MintableCore.sol";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @dev LSP7 extension, mintable.
|
|
12
|
+
*/
|
|
13
|
+
abstract contract LSP7MintableInitAbstract is LSP7DigitalAssetInit, LSP7MintableCore {
|
|
14
|
+
function _initialize(
|
|
15
|
+
string memory name_,
|
|
16
|
+
string memory symbol_,
|
|
17
|
+
address newOwner_,
|
|
18
|
+
bool isNFT_
|
|
19
|
+
) internal virtual override onlyInitializing {
|
|
20
|
+
LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, isNFT_);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @inheritdoc LSP7MintableCore
|
|
25
|
+
*/
|
|
26
|
+
function mint(
|
|
27
|
+
address to,
|
|
28
|
+
uint256 amount,
|
|
29
|
+
bool force,
|
|
30
|
+
bytes memory data
|
|
31
|
+
) public override onlyOwner {
|
|
32
|
+
_mint(to, amount, force, data);
|
|
33
|
+
}
|
|
34
|
+
}
|