4.5.1 • Published 2 years ago

@energyweb/iam-contracts v4.5.1

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
2 years ago

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"
    }
  ]
}
3.8.0

2 years ago

4.4.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.2.1

2 years ago

3.7.1

2 years ago

3.7.0

2 years ago

4.5.0

2 years ago

4.3.1

2 years ago

4.5.1

2 years ago

4.1.0

2 years ago

4.3.0

2 years ago

3.6.0

2 years ago

3.4.0

3 years ago

3.3.1

3 years ago

3.5.0

2 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

2.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.17.2

3 years ago

1.17.1

3 years ago

1.16.2

3 years ago

1.17.0

3 years ago

1.16.1

3 years ago

1.16.0

3 years ago

1.15.0

3 years ago

1.15.2

3 years ago

1.15.1

3 years ago

1.14.0

3 years ago

1.13.0

3 years ago

1.12.0

3 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.9.0

3 years ago

1.11.0

3 years ago

1.10.1

3 years ago

1.10.0

3 years ago

1.8.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago