1.0.1 • Published 5 years ago

@laborx/actions-tracking-contracts v1.0.1

Weekly downloads
-
License
AGPL-3.0
Repository
gitlab
Last release
5 years ago

Actions Tracking smart contracts

Provides smart contract to track user actions and register them with certain payload.

Details

  • ActionsTracker smart contract
  • support code to deploy and interpret contract outputs (like error codes).

Usage

Install package using npm or yarn package managers:

yarn add `@laborx/actions-tracking-contracts`

or

npm install `@laborx/actions-tracking-contracts`

Smart contracts

Import smart contract as you usually do with external libraries

import "@laborx/actions-tracking-contracts/contracts/ActionsTracker.sol";

contract ExtendedTracker is ActionsTracker {
	// ...
}

Support

There are two main areas for support functionality:

  • deployment scripts
  • constants

Deployment scripts

Deployment of a contract could be run with truffle framework by providing deployment context from @truffle-types/deployment-context package.

const deployerAccount = "0x...";
const deploymentContext = new ContractDeploymentContext(
	web3,
	artifacts,
	undefined,
	"path to deployed-addresses.json file"
);

await ActionsTrackerDeployment.deployActionsTracker(
	deploymentContext,
	deployerAccount,
	{ eventsHistory: "EventsHistoryContractKey" },
	{ actionsTracker: "ActionsTrackerContractKey" },
	{ redeploy: false, owners: [] }
);

Support constants

Provides the next constants:

  • revert reasons (ActionsTrackerRevertReasons)
  • error codes (errorsLibrary)
  • names for deployed addresses file (ContractNames)