diff --git a/docs/classes/lsp7-digital-asset.md b/docs/classes/lsp7-digital-asset.md index e0cc7d4c..81a69677 100644 --- a/docs/classes/lsp7-digital-asset.md +++ b/docs/classes/lsp7-digital-asset.md @@ -13,6 +13,12 @@ lspFactory.LSP7DigitalAsset.deploy(digitalAssetProperties [, options]); Deploys a mintable [LSP7 Digital Asset](../../../standards/nft-2.0/LSP7-Digital-Asset). +:::info +By default LSPFactory deploys the [`Mintable`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) implementation of LSP7 digital assets. To call the `mint` function import the `LSP7Mintable` abi from the [lsp-smart-contracts library](https://github.com/lukso-network/lsp-smart-contracts). + +::: + + ### Parameters #### 1. `digitalAssetProperties` - Object diff --git a/docs/classes/lsp8-identifiable-digital-asset.md b/docs/classes/lsp8-identifiable-digital-asset.md index fe2fd635..eea8d5c4 100644 --- a/docs/classes/lsp8-identifiable-digital-asset.md +++ b/docs/classes/lsp8-identifiable-digital-asset.md @@ -3,7 +3,7 @@ sidebar_position: 4 title: LSP8IdentifiableDigitalAsset --- -# LSP8IdentifiableDigtialAsset +# LSP8IdentifiableDigitalAsset ## deploy @@ -13,6 +13,11 @@ lspFactory.LSP8IdentifiableDigitalAsset.deploy(digitalAssetProperties [, options Deploys a mintable [LSP8 Identifiable Digital Asset](../../../standards/nft-2.0/LSP8-Identifiable-Digital-Asset). +:::info +By default LSPFactory deploys the [`Mintable`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) implementation of LSP8 digital assets. To call the `mint` function import the `LSP8Mintable` abi from the [lsp-smart-contracts library](https://github.com/lukso-network/lsp-smart-contracts). + +::: + ### Parameters #### 1. `digitalAssetProperties` - Object diff --git a/docs/deployment/digital-asset.md b/docs/deployment/digital-asset.md index add86e84..a74d9bbd 100644 --- a/docs/deployment/digital-asset.md +++ b/docs/deployment/digital-asset.md @@ -7,18 +7,23 @@ title: Digital Asset LSPFactory enables developers to easily deploy [LSP7] and [LSP8] Digital Asset smart contracts for their [fungible token](./digital-asset.md#fungible-token) or [NFT 2.0](./digital-asset.md#deploying-nft-20) use cases. -To deploy an [LSP7] Digital Asset: +To deploy a mintable [LSP7] Digital Asset: ```javascript await lspFactory.LSP7DigitalAsset.deploy(digitalAssetProperties [, options]); ``` -To deploy an LSP8 Identifiable Digital Asset: +To deploy a mintable LSP8 Identifiable Digital Asset: ```javascript await lspFactory.LSP8IdentifiableDigitalAsset.deploy(digitalAssetProperties [, options]); ``` +:::info +By default LSPFactory deploys the [`Mintable`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) implementation of LSP7 and LSP8 digital assets. To call the `mint` function import the `LSP7Mintable` or `LSP8Mintable` abi from the [lsp-smart-contracts library](https://github.com/lukso-network/lsp-smart-contracts). + +::: + ## Deploying an NFT 2.0 The [LSP7](./digital-asset.md#lsp7-nft-20) and [LSP8](./digital-asset.md#lsp8-nft-20) Digital Assets standards can both be used for NFT 2.0 contracts. diff --git a/package-lock.json b/package-lock.json index 2b77fed4..98994dd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "2.3.0", "license": "MIT", "dependencies": { - "@erc725/erc725.js": "^0.9.0", + "@erc725/erc725.js": "0.14.1", "@ethersproject/abi": "5.5.0", "@ethersproject/experimental": "5.5.0", "@lukso/lsp-smart-contracts": "0.6.0", @@ -1041,11 +1041,58 @@ "dev": true }, "node_modules/@erc725/erc725.js": { - "version": "0.9.0", - "license": "Apache-2.0", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@erc725/erc725.js/-/erc725.js-0.14.1.tgz", + "integrity": "sha512-Ao0aJ5O3P0nYtG1vFZD394r19dt8muXyQ0YOvZgCqLMQ7FNoMQPx2mZnDC+ihXFmSm+SHESZoqsi9J6OK209uw==", + "dependencies": { + "ethereumjs-util": "^7.1.4", + "web3-eth-abi": "^1.7.3", + "web3-utils": "^1.7.3" + } + }, + "node_modules/@erc725/erc725.js/node_modules/@ethersproject/abi": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.7.tgz", + "integrity": "sha512-Cqktk+hSIckwP/W8O47Eef60VwmoSC/L3lY0+dIBhQPCNn9E4V7rwmm2aFrNRRDJfFlGuZ1khkQUOc3oBX+niw==", + "dependencies": { + "@ethersproject/address": "^5.0.4", + "@ethersproject/bignumber": "^5.0.7", + "@ethersproject/bytes": "^5.0.4", + "@ethersproject/constants": "^5.0.4", + "@ethersproject/hash": "^5.0.4", + "@ethersproject/keccak256": "^5.0.3", + "@ethersproject/logger": "^5.0.5", + "@ethersproject/properties": "^5.0.3", + "@ethersproject/strings": "^5.0.4" + } + }, + "node_modules/@erc725/erc725.js/node_modules/web3-eth-abi": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.3.tgz", + "integrity": "sha512-ZlD8DrJro0ocnbZViZpAoMX44x5aYAb73u2tMq557rMmpiluZNnhcCYF/NnVMy6UIkn7SF/qEA45GXA1ne6Tnw==", + "dependencies": { + "@ethersproject/abi": "5.0.7", + "web3-utils": "1.7.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@erc725/erc725.js/node_modules/web3-utils": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.3.tgz", + "integrity": "sha512-g6nQgvb/bUpVUIxJE+ezVN+rYwYmlFyMvMIRSuqpi1dk6ApDD00YNArrk7sPcZnjvxOJ76813Xs2vIN2rgh4lg==", "dependencies": { - "web3-eth-abi": "^1.5.2", - "web3-utils": "^1.5.2" + "bn.js": "^4.11.9", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + }, + "engines": { + "node": ">=8.0.0" } }, "node_modules/@erc725/smart-contracts": { @@ -9922,8 +9969,9 @@ } }, "node_modules/ethereumjs-util": { - "version": "7.1.3", - "license": "MPL-2.0", + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", "dependencies": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", @@ -32232,6 +32280,7 @@ }, "node_modules/web3-eth-abi": { "version": "1.6.1", + "dev": true, "license": "LGPL-3.0", "dependencies": { "@ethersproject/abi": "5.0.7", @@ -32243,6 +32292,7 @@ }, "node_modules/web3-eth-abi/node_modules/@ethersproject/abi": { "version": "5.0.7", + "dev": true, "license": "MIT", "dependencies": { "@ethersproject/address": "^5.0.4", @@ -32526,6 +32576,7 @@ }, "node_modules/web3-utils": { "version": "1.6.1", + "dev": true, "license": "LGPL-3.0", "dependencies": { "bn.js": "^4.11.9", @@ -33716,10 +33767,54 @@ "dev": true }, "@erc725/erc725.js": { - "version": "0.9.0", + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@erc725/erc725.js/-/erc725.js-0.14.1.tgz", + "integrity": "sha512-Ao0aJ5O3P0nYtG1vFZD394r19dt8muXyQ0YOvZgCqLMQ7FNoMQPx2mZnDC+ihXFmSm+SHESZoqsi9J6OK209uw==", "requires": { - "web3-eth-abi": "^1.5.2", - "web3-utils": "^1.5.2" + "ethereumjs-util": "^7.1.4", + "web3-eth-abi": "^1.7.3", + "web3-utils": "^1.7.3" + }, + "dependencies": { + "@ethersproject/abi": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.7.tgz", + "integrity": "sha512-Cqktk+hSIckwP/W8O47Eef60VwmoSC/L3lY0+dIBhQPCNn9E4V7rwmm2aFrNRRDJfFlGuZ1khkQUOc3oBX+niw==", + "requires": { + "@ethersproject/address": "^5.0.4", + "@ethersproject/bignumber": "^5.0.7", + "@ethersproject/bytes": "^5.0.4", + "@ethersproject/constants": "^5.0.4", + "@ethersproject/hash": "^5.0.4", + "@ethersproject/keccak256": "^5.0.3", + "@ethersproject/logger": "^5.0.5", + "@ethersproject/properties": "^5.0.3", + "@ethersproject/strings": "^5.0.4" + } + }, + "web3-eth-abi": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.7.3.tgz", + "integrity": "sha512-ZlD8DrJro0ocnbZViZpAoMX44x5aYAb73u2tMq557rMmpiluZNnhcCYF/NnVMy6UIkn7SF/qEA45GXA1ne6Tnw==", + "requires": { + "@ethersproject/abi": "5.0.7", + "web3-utils": "1.7.3" + } + }, + "web3-utils": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.7.3.tgz", + "integrity": "sha512-g6nQgvb/bUpVUIxJE+ezVN+rYwYmlFyMvMIRSuqpi1dk6ApDD00YNArrk7sPcZnjvxOJ76813Xs2vIN2rgh4lg==", + "requires": { + "bn.js": "^4.11.9", + "ethereum-bloom-filters": "^1.0.6", + "ethereumjs-util": "^7.1.0", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randombytes": "^2.1.0", + "utf8": "3.0.0" + } + } } }, "@erc725/smart-contracts": { @@ -39712,7 +39807,9 @@ } }, "ethereumjs-util": { - "version": "7.1.3", + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", "requires": { "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", @@ -55555,6 +55652,7 @@ }, "web3-eth-abi": { "version": "1.6.1", + "dev": true, "requires": { "@ethersproject/abi": "5.0.7", "web3-utils": "1.6.1" @@ -55562,6 +55660,7 @@ "dependencies": { "@ethersproject/abi": { "version": "5.0.7", + "dev": true, "requires": { "@ethersproject/address": "^5.0.4", "@ethersproject/bignumber": "^5.0.7", @@ -55795,6 +55894,7 @@ }, "web3-utils": { "version": "1.6.1", + "dev": true, "requires": { "bn.js": "^4.11.9", "ethereum-bloom-filters": "^1.0.6", diff --git a/package.json b/package.json index 9f9f241a..e8896768 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "node": ">=10" }, "dependencies": { - "@erc725/erc725.js": "^0.9.0", + "@erc725/erc725.js": "0.14.1", "@ethersproject/abi": "5.5.0", "@ethersproject/experimental": "5.5.0", "@lukso/lsp-smart-contracts": "0.6.0", diff --git a/src/lib/helpers/config.helper.ts b/src/lib/helpers/config.helper.ts index ff3236bc..a3c33c5e 100644 --- a/src/lib/helpers/config.helper.ts +++ b/src/lib/helpers/config.helper.ts @@ -1,3 +1,4 @@ +import { Permissions } from '@erc725/erc725.js/build/main/src/types/Method'; import { keccak256 } from '@ethersproject/keccak256'; import { toUtf8Bytes } from '@ethersproject/strings'; import { Options } from 'ipfs-http-client'; @@ -35,7 +36,7 @@ export const ADDRESS_PERMISSIONS_ARRAY_KEY = export const PREFIX_PERMISSIONS = '0x4b80742de2bf82acb3630000'; // exclude DELEGATECALL for safety -export const DEFAULT_PERMISSIONS = { +export const DEFAULT_PERMISSIONS: Permissions = { CHANGEOWNER: true, CHANGEPERMISSIONS: true, ADDPERMISSIONS: true, @@ -46,6 +47,11 @@ export const DEFAULT_PERMISSIONS = { DEPLOY: true, TRANSFERVALUE: true, SIGN: true, + SUPER_CALL: true, + SUPER_DELEGATECALL: false, + SUPER_SETDATA: true, + SUPER_STATICCALL: true, + SUPER_TRANSFERVALUE: true, }; export const DEFAULT_CONTRACT_VERSION = '0.6.0'; diff --git a/src/lib/helpers/erc725.helper.ts b/src/lib/helpers/erc725.helper.ts index 8a14a818..3a9e87d0 100644 --- a/src/lib/helpers/erc725.helper.ts +++ b/src/lib/helpers/erc725.helper.ts @@ -30,8 +30,9 @@ export function getERC725(address?: string, provider?: providers.Web3Provider) { } export function erc725EncodeData( - data: { LSP4Metadata: LSP4MetadataForEncoding } | { LSP3Profile: LSP3ProfileDataForEncoding } + data: LSP4MetadataForEncoding | LSP3ProfileDataForEncoding, + keyName: string ) { const myERC725 = getERC725(); - return myERC725.encodeData(data); + return myERC725.encodeData([{ keyName, value: data }]); } diff --git a/src/lib/services/digital-asset.service.ts b/src/lib/services/digital-asset.service.ts index fec59a19..fd5f7f95 100644 --- a/src/lib/services/digital-asset.service.ts +++ b/src/lib/services/digital-asset.service.ts @@ -420,11 +420,9 @@ export async function getEncodedLSP4Metadata( lsp4MetadataForEncoding = lsp4Metadata; } - const encodedLSP4Metadata = erc725EncodeData({ - LSP4Metadata: lsp4MetadataForEncoding, - }); + const encodedLSP4Metadata = erc725EncodeData(lsp4MetadataForEncoding, 'LSP4Metadata'); - return encodedLSP4Metadata.LSP4Metadata.value; + return encodedLSP4Metadata.values[0]; } export function setMetadataAndTransferOwnership$( diff --git a/src/lib/services/universal-profile.service.ts b/src/lib/services/universal-profile.service.ts index ddce3c16..c2a9b29b 100644 --- a/src/lib/services/universal-profile.service.ts +++ b/src/lib/services/universal-profile.service.ts @@ -343,9 +343,9 @@ async function getEncodedLSP3ProfileData( lsp3ProfileDataForEncoding = lsp3Profile; } - const encodedDataResult = erc725EncodeData({ LSP3Profile: lsp3ProfileDataForEncoding }); + const encodedDataResult = erc725EncodeData(lsp3ProfileDataForEncoding, 'LSP3Profile'); - return encodedDataResult.LSP3Profile.value; + return encodedDataResult.values[0]; } export function lsp3ProfileUpload$(