Skip to content

Commit

Permalink
Merge pull request #298 from YamenMerhi/permissionName
Browse files Browse the repository at this point in the history
refactor!: change `CHANGEPERMISSION` to `EDITPERMISSION`
  • Loading branch information
Hugoo authored Jul 12, 2023
2 parents 99e202a + cf0326b commit 6a8345b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions docs/classes/ERC725.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ERC725.decodePermissions('0x0000000000000000000000000000000000000000000000000000
/**
{
CHANGEOWNER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDCONTROLLER: false,
SETDATA: false,
CALL: true,
Expand All @@ -239,7 +239,7 @@ ERC725.decodePermissions('0x0000000000000000000000000000000000000000000000000000
/**
{
CHANGEOWNER: false,
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
ADDCONTROLLER: false,
SETDATA: true,
CALL: false,
Expand Down Expand Up @@ -671,7 +671,7 @@ An object with [LSP6 KeyManager Permissions] as keys and a `boolean` as value. A
ERC725.encodePermissions({
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: true,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand Down Expand Up @@ -701,7 +701,7 @@ ERC725.encodePermissions({
}),
// '0x000000000000000000000000000000000000000000000000000000000000000a'
ERC725.encodePermissions({
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
CHANGEEXTENSIONS: true,
CHANGEUNIVERSALRECEIVERDELEGATE: true,
SETDATA: true,
Expand All @@ -711,7 +711,7 @@ ERC725.encodePermissions({

// This method is also available on the instance:
myErc725.encodePermissions({
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
SETDATA: true,
}),
```
Expand Down
4 changes: 2 additions & 2 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ export const HASH_FUNCTIONS: {
// TODO: These values can be imported from lsp-smartcontracts lib after release
// prettier-ignore
export const LSP6_DEFAULT_PERMISSIONS = {
CHANGEOWNER :"0x0000000000000000000000000000000000000000000000000000000000000001",
CHANGEOWNER :"0x0000000000000000000000000000000000000000000000000000000000000001",
ADDCONTROLLER :"0x0000000000000000000000000000000000000000000000000000000000000002",
CHANGEPERMISSIONS :"0x0000000000000000000000000000000000000000000000000000000000000004",
EDITPERMISSIONS :"0x0000000000000000000000000000000000000000000000000000000000000004",
ADDEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000008",
CHANGEEXTENSIONS :"0x0000000000000000000000000000000000000000000000000000000000000010",
ADDUNIVERSALRECEIVERDELEGATE :"0x0000000000000000000000000000000000000000000000000000000000000020",
Expand Down
20 changes: 10 additions & 10 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: true,
ADDCONTROLLER: true,
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
ADDEXTENSIONS: true,
CHANGEEXTENSIONS: true,
ADDUNIVERSALRECEIVERDELEGATE: true,
Expand All @@ -977,7 +977,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand All @@ -1004,7 +1004,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand All @@ -1031,7 +1031,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand All @@ -1058,7 +1058,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand All @@ -1085,7 +1085,7 @@ describe('Running @erc725/erc725.js tests...', () => {
permissions: {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand Down Expand Up @@ -1129,14 +1129,14 @@ describe('Running @erc725/erc725.js tests...', () => {
it('Defaults permissions to false if not passed', () => {
assert.deepStrictEqual(
ERC725.encodePermissions({
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
SETDATA: true,
}),
'0x0000000000000000000000000000000000000000000000000000000000040004',
);
assert.deepStrictEqual(
erc725Instance.encodePermissions({
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
SETDATA: true,
}),
'0x0000000000000000000000000000000000000000000000000000000000040004',
Expand Down Expand Up @@ -1165,7 +1165,7 @@ describe('Running @erc725/erc725.js tests...', () => {
{
CHANGEOWNER: true,
ADDCONTROLLER: true,
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
ADDEXTENSIONS: true,
CHANGEEXTENSIONS: true,
ADDUNIVERSALRECEIVERDELEGATE: true,
Expand Down Expand Up @@ -1194,7 +1194,7 @@ describe('Running @erc725/erc725.js tests...', () => {
{
CHANGEOWNER: true,
ADDCONTROLLER: true,
CHANGEPERMISSIONS: true,
EDITPERMISSIONS: true,
ADDEXTENSIONS: true,
CHANGEEXTENSIONS: true,
ADDUNIVERSALRECEIVERDELEGATE: true,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class ERC725 {
const result = {
CHANGEOWNER: false,
ADDCONTROLLER: false,
CHANGEPERMISSIONS: false,
EDITPERMISSIONS: false,
ADDEXTENSIONS: false,
CHANGEEXTENSIONS: false,
ADDUNIVERSALRECEIVERDELEGATE: false,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/detector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('checkPermissions', () => {
});

it('should return false when one of the literal permissions does not match granted permissions', async () => {
const requiredPermissions = ['CHANGEPERMISSIONS', 'CALL'];
const requiredPermissions = ['EDITPERMISSIONS', 'CALL'];
const grantedPermissions =
'0x000000000000000000000000000000000000000000000000000000000000ff51';
const result = checkPermissions(requiredPermissions, grantedPermissions);
Expand All @@ -177,7 +177,7 @@ describe('checkPermissions', () => {

it('should return true when all the mixed literal and bytes32 permissions match granted permissions', async () => {
const requiredPermissions = [
'CHANGEPERMISSIONS',
'EDITPERMISSIONS',
'0x0000000000000000000000000000000000000000000000000000000000000800',
];
const grantedPermissions =
Expand Down
2 changes: 1 addition & 1 deletion src/types/Method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface MethodData {
export interface Permissions {
CHANGEOWNER?: boolean;
ADDCONTROLLER?: boolean;
CHANGEPERMISSIONS?: boolean;
EDITPERMISSIONS?: boolean;
ADDEXTENSIONS?: boolean;
CHANGEEXTENSIONS?: boolean;
ADDUNIVERSALRECEIVERDELEGATE?: boolean;
Expand Down

0 comments on commit 6a8345b

Please sign in to comment.