# interaction-control-contract

> InteractionControl combines different smart contracts to grant total control of your functions if desired. From who calls them to in which order and even with which inputs' values.

Latest version **1.0.3** (published 2023-06-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install interaction-control-contract
pnpm add interaction-control-contract
yarn add interaction-control-contract
bun add interaction-control-contract
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-06-04 |
| First published | 2023-06-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | carlosalegre |
| Maintainers | carlosalegre |
| Keywords | solidity, smartcontract, call, input, order, function, blockchain, interaction, control, evm, hardhat |

## Links

- npm: https://www.npmjs.com/package/interaction-control-contract
- Repository: https://github.com/CarlosAlegreUr/InteractionControl-SmartContract
- Homepage: https://github.com/CarlosAlegreUr/InteractionControl-SmartContract#readme
- Issues: https://github.com/CarlosAlegreUr/InteractionControl-SmartContract/issues
- npm.io page: https://npm.io/package/interaction-control-contract

## Dependencies (2)

- [input-control-contract](https://npm.io/package/input-control-contract.md) ^3.0.0
- [call-order-control-contract](https://npm.io/package/call-order-control-contract.md) 2.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-06-04
- 1.0.2 — 2023-06-04
- 1.0.1 — 2023-06-04
- 1.0.0 — 2023-06-04

## README

<hr/>
<hr/>

<a name="readme-top"></a>

# InteractionControl Contract

<hr/>

# Combines different smart contracts to grant total control of your functions if desired. From who calls them to in which order and even with which inputs' values.

## 💽Testing and implementation example repo => [(click)](https://github.com/CarlosAlegreUr/InteractionControl-SmartContract-Testing) 💽

## 💽NPM repo => [(click)](https://www.npmjs.com/package/interaction-control-contract) 💽

<hr/>

If further elaboration or development please mention me in your work.

😉 https://github.com/CarlosAlegreUr 😉

<hr/>

## 🤖 General usecase explanation 🤖

InteractionControl can be used to have total control of your functions if desired.

From who calls them to in which order and even with which inputs' values.

<hr/>

## ✨ How to use ✨

1. Make your contract inherit InteractionControl and add the isAllowedInteraction()
   modifier in the functions you desire to fully control.

   The isAllowedInteraction() has 3 parameters:

   1.1 => function selector of the function where it's being applied:
   bytes4(keccak256(bytes("funcSignatureAsString")))

   1.2 => msg.sender => to know who is calling.

   1.3 => a unique identifier of the inputs and it's values:
   keccak256(abi.encode(\_newNumber))

   Btw it's essential you use abi.enconde() and not abi.encodePakced() because abi.encodePakced()
   can give the same output to different inputs.

2. Additionally you can override callAllowInputsFor() or and callAllowFuncCallsFor() if you please mixing this
   InteractionControl with, for example, other useful ones like Ownable or AccessControl contracts from [OpenZeppelin](https://docs.openzeppelin.com/contracts/4.x/access-control).

As InteractionControl inherits from [CallOrderControl.sol](https://github.com/CarlosAlegreUr/CallOrderControl-SmartContract-DesignPattern/blob/main/CallOrderControl.sol) and [InputControl.sol](https://github.com/CarlosAlegreUr/InputControl-SmartContract-DesignPattern/blob/main/InputControl.sol) you can use just their modifier directly in a function
if pleased.

Check a simple implemented example at [UseCaseContract.sol](https://github.com/CarlosAlegreUr/InteractionControl-SmartContract-Testing/blob/main/contracts/UseCaseContract.sol).

<hr/>

## ⚙️ DEPENDENCIES ⚙️

#### npm packages

- ### [InputControl](https://www.npmjs.com/package/input-control-contract)

- ### [CallOrderControl](https://www.npmjs.com/package/call-order-control-contract)

<hr />

## 🎉 FUTURE IMPROVEMENTS 🎉

- Improve and review (static analysis, audit...) code's tests.
- Test in testnet.

<hr/>

<a name="realcase"></a>

## 📨 Contact 📨

Carlos Alegre Urquizú - calegreu@gmail.com

<hr/>

## ☕ Buy me a CryptoCoffee ☕

Buy me a crypto coffe in ETH, MATIC or BNB ☕🧐☕
(or tokens if you please :p )

0x2365bf29236757bcfD141Fdb5C9318183716d866

<hr/>

## 📜 License 📜

Distributed under the MIT License. See [LICENSE](https://github.com/CarlosAlegreUr/InteractionControl-SmartContract-DesignPattern/blob/main/LICENSE) in the repository for more information.

---
_Source: https://npm.io/package/interaction-control-contract · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
