# @laborx/solidity-eventshistory-contracts

> Provides an access to an events history set of contracts

Latest version **1.1.2** (published 2019-10-22) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @laborx/solidity-eventshistory-contracts
pnpm add @laborx/solidity-eventshistory-contracts
yarn add @laborx/solidity-eventshistory-contracts
bun add @laborx/solidity-eventshistory-contracts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2019-10-22 |
| First published | 2019-04-12 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 53.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | LaborX PTY |
| Maintainers | alesanro, aliaksei.hiatsevich, be1box, mike.chronobank, ozalexo |
| Keywords | solidity, ethereum, contracts, events-history |

## Links

- npm: https://www.npmjs.com/package/@laborx/solidity-eventshistory-contracts
- Repository: https://gitlab.chronobank.io:SmartContracts/solidity-libs
- Homepage: https://gitlab.chronobank.io/SmartContracts/solidity-libs/blob/master/contracts/eventshistory/README.md
- Issues: https://gitlab.chronobank.io/SmartContracts/solidity-libs/issues
- npm.io page: https://npm.io/package/@laborx/solidity-eventshistory-contracts

## Dependencies (3)

- [@truffle-types/typescript-types](https://npm.io/package/@truffle-types/typescript-types.md) ~0.1.9
- [@laborx/solidity-shared-contracts](https://npm.io/package/@laborx/solidity-shared-contracts.md) ^1.0.3
- [@truffle-types/deployment-context](https://npm.io/package/@truffle-types/deployment-context.md) ~0.4.2

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2019-10-22
- 1.1.1 — 2019-06-05
- 1.1.0 — 2019-05-31
- 1.0.1 — 2019-05-02
- 1.0.0 — 2019-04-12

## README

# Events History smart contracts library [![Build Status](https://travis-ci.org/ChronoBank/solidity-eventshistory-lib.svg?branch=master)](https://travis-ci.org/ChronoBank/solidity-eventshistory-lib) [![Coverage Status](https://coveralls.io/repos/github/ChronoBank/solidity-eventshistory-lib/badge.svg?branch=master)](https://coveralls.io/github/ChronoBank/solidity-eventshistory-lib?branch=master)

Part of [LaborX project](https://github.com/ChronoBank). Organizes a set of smart contracts that can manage events emitting. _Using this approach all events should have their own public function for emitting_!

- **EventsHistory** - defines a contract that could allow or forbid events with definite signature and source;
- **MultiEventsHistory** - has less restrictions than **EventsHistory**, allows to filter events according to an authorized source;
- **MultiEventsHistoryAdapter** - base contract, other contracts should inherit from it to receive an ability to store events history contract as a separate address and redirect all events to provided contract.

## Installation

Organized as npm package this smart contracts could be easily added to a project by

```bash
npm install -s solidity-eventshistory-lib
```

## Usage

Right before you decided to use them add this library to package dependencies and import any contract according to this pattern, for example:

```javascript
import "solidity-shared-lib/contracts/MultiEventsHistoryAdapter.sol";
```

or

```javascript
import "solidity-shared-lib/contracts/MultiEventsHistory.sol";
```

## Details

Contracts that wants to use events history contract should go with a couple of rules:

1. Define a contract that will hold events history address (it is recommended to inherit from \_MultiEventsHistoryAdapter)

```javascript
contract Manager is MultiEventsHistoryAdapter {
	event LogManagerEvent(address indexed self, uint at);

	//...
}
```

2. Add a public function with event emitting action (\__self()_ is a function from _MultiEventsHistoryAdapter_ contract):

```javascript
//...
function emitManagerEvent(uint _at) public {
	emit ManagerEvent(_self(), _at);
}
//...
```

3. In your business logic you should invoke event emitting with the next command:

```javascript
//...
function actionExample() external returns (bool) {
	//...
	Manager(getEventsHistory()).emitManagerEvent(now);
	return true;
}
//...
```

Since events history contract will be the source of events then to keep information who was the actual source you need to reserve one of the parameters for passing \__self()_ together with event.

    For more information and use cases look at tests.

---
_Source: https://npm.io/package/@laborx/solidity-eventshistory-contracts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
