@lukso/lsp7-contracts 0.16.3 → 0.16.5

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Package for the LSP7 Digital Asset standard.
4
4
 
5
+ > The contracts [`LSP7Votes`](contracts/extensions/LSP7Votes.sol) and [`LSP7VotesInitiAbstract`](contracts/extensions/LSP7VotesInitAbstract.sol) have not been formally audited by an external third party and are not recommended to be used in production without undergoing an independent security audit.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```console
@@ -10,7 +12,9 @@ npm install @lukso/lsp7-contracts
10
12
 
11
13
  ## Available Constants & Types
12
14
 
13
- The `@lukso/lsp7-contracts` npm package contains useful constants such as interface IDs or ERC725Y data keys related to the LSP7 Standard. You can import and access them as follows:
15
+ The `@lukso/lsp7-contracts` npm package contains useful constants such as interface IDs or ERC725Y data keys related to the LSP7 Standard. You can import and access them as follows.
16
+
17
+ In Javascript.
14
18
 
15
19
  ```js
16
20
  import {
@@ -20,6 +24,22 @@ import {
20
24
  } from "@lukso/lsp7-contracts";
21
25
  ```
22
26
 
27
+ In Solidity.
28
+
29
+ <!-- prettier-ignore -->
30
+ ```solidity
31
+ import {
32
+ _INTERFACEID_LSP7,
33
+ _INTERFACEID_LSP7_V0_12_0,
34
+ _INTERFACEID_LSP7_V0_14_0,
35
+ _TYPEID_LSP7_DELEGATOR,
36
+ _TYPEID_LSP7_DELEGATEE,
37
+ _TYPEID_LSP7_TOKENSSENDER,
38
+ _TYPEID_LSP7_TOKENSRECIPIENT,
39
+ _TYPEID_LSP7_TOKENOPERATOR
40
+ } from "@lukso/lsp7-contracts/contracts/LSP7Constants.sol";
41
+ ```
42
+
23
43
  The `LSP7_TYPE_IDS` includes type IDs for the following type of notifications:
24
44
 
25
45
  ```console
@@ -29,3 +49,21 @@ The `LSP7_TYPE_IDS` includes type IDs for the following type of notifications:
29
49
  'LSP7Tokens_VotesDelegatorNotification';
30
50
  'LSP7Tokens_VotesDelegateeNotification';
31
51
  ```
52
+
53
+ ## Typescript types
54
+
55
+ You can also import the [type-safe ABI](https://abitype.dev/) from the `/abi` path.
56
+
57
+ ```ts
58
+ import {
59
+ // standard version
60
+ lsp7DigitalAssetAbi,
61
+ lsp7CappedSupplyAbi,
62
+ lsp7MintableAbi,
63
+ lsp7VotesAbi
64
+ // proxy version
65
+ lsp7CappedSupplyInitAbstractAbi,
66
+ lsp7DigitalAssetInitAbstractAbi,
67
+ lsp7MintableInitAbi,
68
+ } from '@lukso/lsp7-contracts/abi';
69
+ ```
@@ -250,6 +250,9 @@ interface ILSP7DigitalAsset {
250
250
  *
251
251
  * @custom:info if the `to` address is a contract that implements LSP1, it will always be notified via its `universalReceiver(...)` function, regardless if `force` is set to `true` or `false`.
252
252
  *
253
+ * @custom:info Note that token transfers revert when no allowance is given, including when the `amount` is `0`.
254
+ * This is to prevent this function from being used maliciously, such as performing zero-value token transfer phishing attacks.
255
+ *
253
256
  * @custom:warning Be aware that when either the sender or the recipient can have logic that revert in their `universalReceiver(...)` function when being notified.
254
257
  * This even if the `force` was set to `true`.
255
258
  */
@@ -19,8 +19,8 @@ import {
19
19
  ERC725YInitAbstract
20
20
  } from "@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadataInitAbstract.sol";
21
21
  import {
22
- LSP17Extendable
23
- } from "@lukso/lsp17contractextension-contracts/contracts/LSP17Extendable.sol";
22
+ LSP17ExtendableInitAbstract
23
+ } from "@lukso/lsp17contractextension-contracts/contracts/LSP17ExtendableInitAbstract.sol";
24
24
 
25
25
  // libraries
26
26
  import {LSP1Utils} from "@lukso/lsp1-contracts/contracts/LSP1Utils.sol";
@@ -77,7 +77,7 @@ import {
77
77
  abstract contract LSP7DigitalAssetInitAbstract is
78
78
  ILSP7DigitalAsset,
79
79
  LSP4DigitalAssetMetadataInitAbstract,
80
- LSP17Extendable
80
+ LSP17ExtendableInitAbstract
81
81
  {
82
82
  using EnumerableSet for EnumerableSet.AddressSet;
83
83
 
@@ -236,13 +236,15 @@ abstract contract LSP7DigitalAssetInitAbstract is
236
236
  public
237
237
  view
238
238
  virtual
239
- override(ERC725YInitAbstract, LSP17Extendable)
239
+ override(ERC725YInitAbstract, LSP17ExtendableInitAbstract)
240
240
  returns (bool)
241
241
  {
242
242
  return
243
243
  interfaceId == _INTERFACEID_LSP7 ||
244
244
  super.supportsInterface(interfaceId) ||
245
- LSP17Extendable._supportsInterfaceInERC165Extension(interfaceId);
245
+ LSP17ExtendableInitAbstract._supportsInterfaceInERC165Extension(
246
+ interfaceId
247
+ );
246
248
  }
247
249
 
248
250
  // --- Token queries
@@ -24,6 +24,10 @@ import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
24
24
  *
25
25
  * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
26
26
  * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
27
+ *
28
+ * @custom:warning This extension contract is not formally audited.
29
+ * For any contract intended to be deployed in production that inherits from this extension, it is recommended to conduct
30
+ * an independent security audit, including this extension in the audit scope.
27
31
  */
28
32
  abstract contract LSP7Votes is LSP7DigitalAsset, EIP712, IERC5805 {
29
33
  using Counters for Counters.Counter;
@@ -29,6 +29,10 @@ import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
29
29
  *
30
30
  * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it
31
31
  * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.
32
+ *
33
+ * @custom:warning This extension contract is not formally audited.
34
+ * For any contract intended to be deployed in production that inherits from this extension, it is recommended to conduct
35
+ * an independent security audit, including this extension in the audit scope.
32
36
  */
33
37
  abstract contract LSP7VotesInitAbstract is
34
38
  LSP7DigitalAssetInitAbstract,
@@ -10,7 +10,6 @@ import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
10
10
 
11
11
  /**
12
12
  * @title LSP7DigitalAsset deployable preset contract with a public {mint} function callable only by the contract {owner}.
13
- * @author Jean Cavallera, Yamen Merhi
14
13
  */
15
14
  contract LSP7Mintable is LSP7DigitalAsset, ILSP7Mintable {
16
15
  /**