Skip to content

Commit

Permalink
refactor: update LSP6/LSP7/LSP8 interface IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Sep 4, 2023
1 parent dc56820 commit 7aa51e1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
6 changes: 3 additions & 3 deletions constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP6KeyManager/LSP6Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP7DigitalAsset/LSP7Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

// --- ERC165 interface ids
bytes4 constant _INTERFACEID_LSP7 = 0xda1f85e4;
bytes4 constant _INTERFACEID_LSP7 = 0xb8852370;

// --- Token Hooks

Expand Down
2 changes: 1 addition & 1 deletion contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 7 additions & 3 deletions contracts/Mocks/ERC165Interfaces.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions docs/_interface_ids_table.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1321,15 +1321,15 @@ export const shouldBehaveLikeLSP1Delegate = (
.connect(context.accounts.owner1)
.setData(
ERC725YDataKeys.LSP5.LSP5ReceivedAssetsMap + token.address.substring(2),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
);

expect(
await context.universalProfile1.getDataBatch([arrayKey, arrayIndexKey, assetMapKey]),
).to.deep.equal([
'0x' + '00'.repeat(15) + '01',
token.address.toLowerCase(),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
]);

balance = await token.balanceOf(context.universalProfile1.address);
Expand Down Expand Up @@ -1386,7 +1386,7 @@ export const shouldBehaveLikeLSP1Delegate = (
).to.deep.equal([
'0x' + '00'.repeat(15) + '01',
token.address.toLowerCase(),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
]);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes

const vaultSetDataCalldata = context.lsp9Vault1.interface.encodeFunctionData('setData', [
ERC725YDataKeys.LSP5.LSP5ReceivedAssetsMap + token.address.substring(2),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
]);

await context.universalProfile
Expand All @@ -982,7 +982,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
).to.deep.equal([
'0x' + '00'.repeat(15) + '01',
token.address.toLowerCase(),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
]);

balance = await token.balanceOf(context.lsp9Vault1.address);
Expand Down Expand Up @@ -1040,7 +1040,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
).to.deep.equal([
'0x' + '00'.repeat(15) + '01',
token.address.toLowerCase(),
'0xda1f85e400000000000000000000000000000000cafecafe',
'0xb885237000000000000000000000000000000000cafecafe',
]);
});
});
Expand Down

0 comments on commit 7aa51e1

Please sign in to comment.