Skip to content

Commit

Permalink
feat: add permission EXECUTE_RELAY_CALL
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Oct 17, 2023
1 parent 4ab134b commit 6db8835
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,28 @@ export const HASH_FUNCTIONS: {
// prettier-ignore
export const LSP6_DEFAULT_PERMISSIONS = {
CHANGEOWNER :"0x0000000000000000000000000000000000000000000000000000000000000001",
ADDCONTROLLER :"0x0000000000000000000000000000000000000000000000000000000000000002",
EDITPERMISSIONS :"0x0000000000000000000000000000000000000000000000000000000000000004",
ADDEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000008",
CHANGEEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000010",
ADDUNIVERSALRECEIVERDELEGATE :"0x0000000000000000000000000000000000000000000000000000000000000020",
CHANGEUNIVERSALRECEIVERDELEGATE :"0x0000000000000000000000000000000000000000000000000000000000000040",
REENTRANCY :"0x0000000000000000000000000000000000000000000000000000000000000080",
SUPER_TRANSFERVALUE :"0x0000000000000000000000000000000000000000000000000000000000000100",
TRANSFERVALUE :"0x0000000000000000000000000000000000000000000000000000000000000200",
SUPER_CALL :"0x0000000000000000000000000000000000000000000000000000000000000400",
CALL :"0x0000000000000000000000000000000000000000000000000000000000000800",
SUPER_STATICCALL :"0x0000000000000000000000000000000000000000000000000000000000001000",
STATICCALL :"0x0000000000000000000000000000000000000000000000000000000000002000",
SUPER_DELEGATECALL :"0x0000000000000000000000000000000000000000000000000000000000004000",
DELEGATECALL :"0x0000000000000000000000000000000000000000000000000000000000008000",
DEPLOY :"0x0000000000000000000000000000000000000000000000000000000000010000",
SUPER_SETDATA :"0x0000000000000000000000000000000000000000000000000000000000020000",
SETDATA :"0x0000000000000000000000000000000000000000000000000000000000040000",
ENCRYPT :"0x0000000000000000000000000000000000000000000000000000000000080000",
DECRYPT :"0x0000000000000000000000000000000000000000000000000000000000100000",
SIGN :"0x0000000000000000000000000000000000000000000000000000000000200000",
ADDCONTROLLER :"0x0000000000000000000000000000000000000000000000000000000000000002",
EDITPERMISSIONS :"0x0000000000000000000000000000000000000000000000000000000000000004",
ADDEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000008",
CHANGEEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000010",
ADDUNIVERSALRECEIVERDELEGATE :"0x0000000000000000000000000000000000000000000000000000000000000020",
CHANGEUNIVERSALRECEIVERDELEGATE :"0x0000000000000000000000000000000000000000000000000000000000000040",
REENTRANCY :"0x0000000000000000000000000000000000000000000000000000000000000080",
SUPER_TRANSFERVALUE :"0x0000000000000000000000000000000000000000000000000000000000000100",
TRANSFERVALUE :"0x0000000000000000000000000000000000000000000000000000000000000200",
SUPER_CALL :"0x0000000000000000000000000000000000000000000000000000000000000400",
CALL :"0x0000000000000000000000000000000000000000000000000000000000000800",
SUPER_STATICCALL :"0x0000000000000000000000000000000000000000000000000000000000001000",
STATICCALL :"0x0000000000000000000000000000000000000000000000000000000000002000",
SUPER_DELEGATECALL :"0x0000000000000000000000000000000000000000000000000000000000004000",
DELEGATECALL :"0x0000000000000000000000000000000000000000000000000000000000008000",
DEPLOY :"0x0000000000000000000000000000000000000000000000000000000000010000",
SUPER_SETDATA :"0x0000000000000000000000000000000000000000000000000000000000020000",
SETDATA :"0x0000000000000000000000000000000000000000000000000000000000040000",
ENCRYPT :"0x0000000000000000000000000000000000000000000000000000000000080000",
DECRYPT :"0x0000000000000000000000000000000000000000000000000000000000100000",
SIGN :"0x0000000000000000000000000000000000000000000000000000000000200000",
EXECUTE_RELAY_CALL :"0x00000000000000000000000000000000000000000000000000000000004400000",
};

export const LSP6_ALL_PERMISSIONS =
Expand Down
8 changes: 8 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: true,
DECRYPT: true,
SIGN: true,
EXECUTE_RELAY_CALL: false

Check failure on line 1063 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1063 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x00000000000000000000000000000000000000000000000000000000003f3f7f',
},
Expand Down Expand Up @@ -1087,6 +1088,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: false,
DECRYPT: false,
SIGN: false,
EXECUTE_RELAY_CALL: false

Check failure on line 1091 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1091 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000000',
},
Expand Down Expand Up @@ -1114,6 +1116,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: false,
DECRYPT: false,
SIGN: true,
EXECUTE_RELAY_CALL: false

Check failure on line 1119 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1119 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x0000000000000000000000000000000000000000000000000000000000200a00',
},
Expand Down Expand Up @@ -1141,6 +1144,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: false,
DECRYPT: false,
SIGN: false,
EXECUTE_RELAY_CALL: false

Check failure on line 1147 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1147 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x0000000000000000000000000000000000000000000000000000000000040800',
},
Expand Down Expand Up @@ -1168,6 +1172,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: false,
DECRYPT: false,
SIGN: false,
EXECUTE_RELAY_CALL: false

Check failure on line 1175 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1175 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x0000000000000000000000000000000000000000000000000000000000040004',
},
Expand Down Expand Up @@ -1195,6 +1200,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: false,
DECRYPT: false,
SIGN: false,
EXECUTE_RELAY_CALL: false

Check failure on line 1203 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1203 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000a00',
},
Expand Down Expand Up @@ -1275,6 +1281,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: true,
DECRYPT: true,
SIGN: true,
EXECUTE_RELAY_CALL: true

Check failure on line 1284 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1284 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
);
assert.deepStrictEqual(
Expand Down Expand Up @@ -1304,6 +1311,7 @@ describe('Running @erc725/erc725.js tests...', () => {
ENCRYPT: true,
DECRYPT: true,
SIGN: true,
EXECUTE_RELAY_CALL: true

Check failure on line 1314 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (14.x)

Insert `,`

Check failure on line 1314 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Insert `,`
},
);
});
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ export class ERC725 {
ENCRYPT: false,
DECRYPT: false,
SIGN: false,
EXECUTE_RELAY_CALL: false,
};

const permissionsToTest = Object.keys(LSP6_DEFAULT_PERMISSIONS);
Expand Down
1 change: 1 addition & 0 deletions src/types/Method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ export interface Permissions {
ENCRYPT?: boolean;
DECRYPT?: boolean;
SIGN?: boolean;
EXECUTE_RELAY_CALL?: boolean;
}

0 comments on commit 6db8835

Please sign in to comment.