Skip to content

Commit

Permalink
Merge pull request ERC725Alliance#183 from ERC725Alliance/add-super-p…
Browse files Browse the repository at this point in the history
…ermissions

improvement: add super permissions encoding and decoding
  • Loading branch information
Hugoo authored Jun 13, 2022
2 parents 7c457c1 + 94a2284 commit 6c7f168
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: true,
TRANSFERVALUE: true,
SIGN: true,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x00000000000000000000000000000000000000000000000000000000000003ff',
},
Expand All @@ -932,6 +937,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: false,
TRANSFERVALUE: false,
SIGN: false,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000000',
},
Expand All @@ -947,6 +957,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: false,
TRANSFERVALUE: true,
SIGN: true,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000310',
},
Expand All @@ -962,6 +977,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: false,
TRANSFERVALUE: false,
SIGN: false,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000018',
},
Expand All @@ -977,6 +997,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: false,
TRANSFERVALUE: false,
SIGN: false,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x000000000000000000000000000000000000000000000000000000000000000a',
},
Expand All @@ -992,6 +1017,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: false,
TRANSFERVALUE: true,
SIGN: false,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
},
hex: '0x0000000000000000000000000000000000000000000000000000000000000110',
},
Expand Down Expand Up @@ -1060,6 +1090,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: true,
TRANSFERVALUE: true,
SIGN: true,
SUPER_SETDATA: true,
SUPER_TRANSFERVALUE: true,
SUPER_CALL: true,
SUPER_STATICCALL: true,
SUPER_DELEGATECALL: true,
},
);
assert.deepStrictEqual(
Expand All @@ -1077,6 +1112,11 @@ describe('Running @erc725/erc725.js tests...', () => {
DEPLOY: true,
TRANSFERVALUE: true,
SIGN: true,
SUPER_SETDATA: true,
SUPER_TRANSFERVALUE: true,
SUPER_CALL: true,
SUPER_STATICCALL: true,
SUPER_DELEGATECALL: true,
},
);
});
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ export class ERC725 {
DEPLOY: false,
TRANSFERVALUE: false,
SIGN: false,
SUPER_SETDATA: false,
SUPER_TRANSFERVALUE: false,
SUPER_CALL: false,
SUPER_STATICCALL: false,
SUPER_DELEGATECALL: false,
};

const permissionsToTest = Object.keys(LSP6_DEFAULT_PERMISSIONS);
Expand Down
10 changes: 10 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ export const LSP6_DEFAULT_PERMISSIONS = {
TRANSFERVALUE:
'0x0000000000000000000000000000000000000000000000000000000000000100',
SIGN: '0x0000000000000000000000000000000000000000000000000000000000000200',
SUPER_SETDATA:
'0x0000000000000000000000000000000000000000000000000000000000000400',
SUPER_TRANSFERVALUE:
'0x0000000000000000000000000000000000000000000000000000000000000800',
SUPER_CALL:
'0x0000000000000000000000000000000000000000000000000000000000001000',
SUPER_STATICCALL:
'0x0000000000000000000000000000000000000000000000000000000000002000',
SUPER_DELEGATECALL:
'0x0000000000000000000000000000000000000000000000000000000000004000',
};

export const LSP6_ALL_PERMISSIONS =
Expand Down
5 changes: 5 additions & 0 deletions src/types/Method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ export interface Permissions {
DEPLOY?: boolean;
TRANSFERVALUE?: boolean;
SIGN?: boolean;
SUPER_SETDATA?: boolean;
SUPER_TRANSFERVALUE?: boolean;
SUPER_CALL?: boolean;
SUPER_STATICCALL?: boolean;
SUPER_DELEGATECALL?: boolean;
}

0 comments on commit 6c7f168

Please sign in to comment.