Skip to content

[bug] Permissions: exception thrown while revoking delegate's role #100

@remon-nashid

Description

@remon-nashid

Unfortunately, exception message is not quite useful:

index.browser.js:20792 Uncaught (in promise) Error: 0 value not allowed
    at new t (index.browser.js:20792)
    at Object.assert (index.browser.js:6631)
    at t.<anonymous> (index.browser.js:250734)
    at index.browser.js:250626
    at Object.next (index.browser.js:250574)
    at o (index.browser.js:250527)

You can reproduce the error as follows:

  • If you don't have any, make sure you first create a token on Kovan. Then enable GPM on that token, and allow at least one delegate to manage the GTM. All that can be accomplished on Tokensudio.
  • Visit https://polymathnetwork.github.io/permissions.
  • Select previously created token from tokens select list.
  • Once selected, the app will fetch existing delegates and display them.
  • Try to delete one of them by clicking on delete button.
  • Exception should occur and appear in dev console.

Note that I tried to run to reproduce the issue using the following, minimal js script. That one just fails right away and spits ReferenceError: XMLHttpRequest is not defined error ¯_(ツ)_/¯.

const { Polymath }  = require('@polymathnetwork/sdk');

(async function() {
  const SYMBOL = 'SOMESYMBOL'
  const PERMISSIONS_FEATURE = 'Permissions'
  const ROLE = 'ShareholdersAdministrator'
  const privateKey = 'PRIVATE_KEY_HERE';
  const networkId = 42;
  const networkConfigs = {
    1: {
      polymathRegistryAddress: '0xdfabf3e4793cd30affb47ab6fa4cf4eef26bbc27',
      providerUrl: 'https://mainnet.polymath.network',
      privateKey
    },
    42: {
      polymathRegistryAddress: '0x5b215a7d39ee305ad28da29bf2f0425c6c2a00b3',
      providerUrl: 'https://kovan.polymath.network',
      privateKey
    },
  };
  const config = networkConfigs[networkId];
  const sdk = new Polymath();
  await sdk.connect(config);

  try {
    const token = await sdk.getSecurityToken({symbol: SYMBOL});
    console.log(token)
    const enabled = await token.features.isEnabled({feature: PERMISSIONS_FEATURE})
    if (enabled) {
      console.log('GTM is enabled')
      const delegates = await token.permissions.getDelegatesForRole({role: ROLE})
      if (delegates.length) {
        console.log(delegates)

      }

    }
  } catch(error) {
    console.error(error);
  }
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions