From 7aa51e1f57eef62df063c7a1b8aff9e306434847 Mon Sep 17 00:00:00 2001 From: b00ste Date: Mon, 4 Sep 2023 16:15:46 +0300 Subject: [PATCH] refactor: update LSP6/LSP7/LSP8 interface IDs --- constants.ts | 6 +++--- contracts/LSP6KeyManager/LSP6Constants.sol | 2 +- contracts/LSP7DigitalAsset/LSP7Constants.sol | 2 +- .../LSP8IdentifiableDigitalAsset/LSP8Constants.sol | 2 +- contracts/Mocks/ERC165Interfaces.sol | 10 +++++++--- docs/_interface_ids_table.mdx | 6 +++--- .../LSP1UniversalReceiverDelegateUP.behaviour.ts | 6 +++--- .../LSP1UniversalReceiverDelegateVault.behaviour.ts | 6 +++--- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/constants.ts b/constants.ts index ef40d0555..fdc8f3ef7 100644 --- a/constants.ts +++ b/constants.ts @@ -26,9 +26,9 @@ export const INTERFACE_IDS = { ERC725Y: '0x629aa694', LSP0ERC725Account: '0x24871b3d', LSP1UniversalReceiver: '0x6bb56a14', - LSP6KeyManager: '0x627ca5d3', - LSP7DigitalAsset: '0xda1f85e4', - LSP8IdentifiableDigitalAsset: '0x622e7a01', + LSP6KeyManager: '0x70b73219', + LSP7DigitalAsset: '0xb8852370', + LSP8IdentifiableDigitalAsset: '0x00b4dc95', LSP9Vault: '0x28af17e6', LSP11BasicSocialRecovery: '0x049a28f1', LSP14Ownable2Step: '0x94be5999', diff --git a/contracts/LSP6KeyManager/LSP6Constants.sol b/contracts/LSP6KeyManager/LSP6Constants.sol index b28617a48..de1be39b7 100644 --- a/contracts/LSP6KeyManager/LSP6Constants.sol +++ b/contracts/LSP6KeyManager/LSP6Constants.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.4; // --- ERC165 interface ids -bytes4 constant _INTERFACEID_LSP6 = 0x627ca5d3; +bytes4 constant _INTERFACEID_LSP6 = 0x70b73219; // --- ERC725Y Data Keys diff --git a/contracts/LSP7DigitalAsset/LSP7Constants.sol b/contracts/LSP7DigitalAsset/LSP7Constants.sol index 24efb631b..fd5043e71 100644 --- a/contracts/LSP7DigitalAsset/LSP7Constants.sol +++ b/contracts/LSP7DigitalAsset/LSP7Constants.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.4; // --- ERC165 interface ids -bytes4 constant _INTERFACEID_LSP7 = 0xda1f85e4; +bytes4 constant _INTERFACEID_LSP7 = 0xb8852370; // --- Token Hooks diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol index 7b2a603ba..2f9c088bb 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.4; // --- ERC165 interface ids -bytes4 constant _INTERFACEID_LSP8 = 0x622e7a01; +bytes4 constant _INTERFACEID_LSP8 = 0x00b4dc95; // --- ERC725Y Data Keys diff --git a/contracts/Mocks/ERC165Interfaces.sol b/contracts/Mocks/ERC165Interfaces.sol index 96d97aca1..af12f7f18 100644 --- a/contracts/Mocks/ERC165Interfaces.sol +++ b/contracts/Mocks/ERC165Interfaces.sol @@ -116,7 +116,9 @@ contract CalculateLSPInterfaces { } function calculateInterfaceLSP6KeyManager() public pure returns (bytes4) { - bytes4 interfaceId = type(ILSP6).interfaceId; + bytes4 interfaceId = type(ILSP6).interfaceId ^ + calculateInterfaceLSP20CallVerifier() ^ + calculateInterfaceLSP25ExecuteRelayCall(); require( interfaceId == _INTERFACEID_LSP6, "hardcoded _INTERFACEID_LSP6 does not match type(ILSP6).interfaceId" @@ -126,7 +128,8 @@ contract CalculateLSPInterfaces { } function calculateInterfaceLSP7() public pure returns (bytes4) { - bytes4 interfaceId = type(ILSP7).interfaceId; + bytes4 interfaceId = type(ILSP7).interfaceId ^ + type(IERC725Y).interfaceId; require( interfaceId == _INTERFACEID_LSP7, "hardcoded _INTERFACEID_LSP7 does not match type(ILSP7).interfaceId" @@ -136,7 +139,8 @@ contract CalculateLSPInterfaces { } function calculateInterfaceLSP8() public pure returns (bytes4) { - bytes4 interfaceId = type(ILSP8).interfaceId; + bytes4 interfaceId = type(ILSP8).interfaceId ^ + type(IERC725Y).interfaceId; require( interfaceId == _INTERFACEID_LSP8, "hardcoded _INTERFACEID_LSP8 does not match type(ILSP8).interfaceId" diff --git a/docs/_interface_ids_table.mdx b/docs/_interface_ids_table.mdx index afbc03a90..b6ad4df44 100644 --- a/docs/_interface_ids_table.mdx +++ b/docs/_interface_ids_table.mdx @@ -6,9 +6,9 @@ | **ERC725Y** | `0x629aa694` | General Data key-value store. | | **LSP0ERC725Account** | `0x24871b3d` | Interface of the [LSP-0-ERC725Account] standard, an account based smart contract that represents an identity on-chain. | | **LSP1UniversalReceiver** | `0x6bb56a14` | Interface of the LSP1 - Universal Receiver standard, an entry function for a contract to receive arbitrary information. | -| **LSP6KeyManager** | `0x627ca5d3` | Interface of the LSP6 - Key Manager standard, a contract acting as a controller of an ERC725 Account using predfined permissions. | -| **LSP7DigitalAsset** | `0xda1f85e4` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | -| **LSP8IdentifiableDigitalAsset** | `0x622e7a01` | Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset. | +| **LSP6KeyManager** | `0x70b73219` | Interface of the LSP6 - Key Manager standard, a contract acting as a controller of an ERC725 Account using predfined permissions. | +| **LSP7DigitalAsset** | `0xb8852370` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | +| **LSP8IdentifiableDigitalAsset** | `0x00b4dc95` | Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset. | | **LSP9Vault** | `0x28af17e6` | Interface of LSP9 - Vault standard, a blockchain vault that can hold assets and interact with other smart contracts. | | **LSP11BasicSocialRecovery** | `0x049a28f1` | Interface of the LSP11 - Basic Social Recovery standard, a contract to recover access control into an account. | | **LSP14Ownable2Step** | `0x94be5999` | Interface of the LSP14 - Ownable 2-step standard, an extension of the [EIP173] (Ownable) standard with 2-step process to transfer or renounce ownership. | diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts index dca738edc..cfdc06da4 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts @@ -1321,7 +1321,7 @@ export const shouldBehaveLikeLSP1Delegate = ( .connect(context.accounts.owner1) .setData( ERC725YDataKeys.LSP5.LSP5ReceivedAssetsMap + token.address.substring(2), - '0xda1f85e400000000000000000000000000000000cafecafe', + '0xb885237000000000000000000000000000000000cafecafe', ); expect( @@ -1329,7 +1329,7 @@ export const shouldBehaveLikeLSP1Delegate = ( ).to.deep.equal([ '0x' + '00'.repeat(15) + '01', token.address.toLowerCase(), - '0xda1f85e400000000000000000000000000000000cafecafe', + '0xb885237000000000000000000000000000000000cafecafe', ]); balance = await token.balanceOf(context.universalProfile1.address); @@ -1386,7 +1386,7 @@ export const shouldBehaveLikeLSP1Delegate = ( ).to.deep.equal([ '0x' + '00'.repeat(15) + '01', token.address.toLowerCase(), - '0xda1f85e400000000000000000000000000000000cafecafe', + '0xb885237000000000000000000000000000000000cafecafe', ]); }); }); diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts index 0049d78f3..24441001d 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts @@ -970,7 +970,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise Promise Promise