This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@energyweb/iam-contracts
TypeScript icon, indicating that this package has built-in type declarations

4.5.1 • Public • Published

Overview

This package consists of EVM smart contracts related to EnergyWeb IAM.

Usage

DomainReader

The DomainReader class can be used as shown to read a domain definition.

import {
  DomainReader,
  VOLTA_ENS_REGISTRY_ADDRESS,
} from "@energyweb/iam-contracts";
import { providers, utils } from "ethers";

(async () => {
  const provider = new providers.JsonRpcProvider(
    "https://volta-rpc.energyweb.org"
  );
  const reader = new DomainReader({
    ensRegistryAddress: VOLTA_ENS_REGISTRY_ADDRESS,
    provider,
  });
  const roleDefinition = await reader.read({
    node: utils.namehash("manufacturer.roles.flex.apps.exampleco.iam.ewc"),
  });
})();

Contract Descriptions

RoleDefinitionResolver.sol

This is an implementation of an ENS resolver that represents a role definition. It extends the ENS Public Resolver with additional resolver profiles, specifically for the use case of issuing and verify role claims using a smart contract. In other words, this custom ENS resolver allows some properties of a role definition to be (usefully) readable by another smart contract.

Development

Install dependencies:

$ npm install

Compile contracts, generate contract types and compile typescript:

$ npm run build

Run tests:

$ npm test

Debugging Tests

In vs code, the tests (which are run using Mocha), can be debugged with the following launch.json config. Before debugging the tests, start a local chain using npm run ganache.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Mocha All",
      "program": "${workspaceFolder}/contracts/node_modules/mocha/bin/_mocha",
      "args": [
          "-r",
          "ts-node/register",
          "--timeout",
          "999999",
          "--colors",
          "${workspaceFolder}/contracts/test/**/*Test.ts",
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "protocol": "inspector",
      "cwd": "${workspaceFolder}/contracts"
    }
  ]
}

Readme

Keywords

none

Package Sidebar

Install

npm i @energyweb/iam-contracts

Weekly Downloads

4

Version

4.5.1

License

GPL-3.0-or-later

Unpacked Size

17.5 MB

Total Files

95

Last publish

Collaborators

  • aznagy
  • bagaric
  • drgorb
  • energywebdev
  • kroy
  • kyleiankian
  • manihagh
  • pkosin