# adamoracle-contracts

> Smart contracts and their language abstractions for adamoracle

Latest version **0.0.2** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install adamoracle-contracts
pnpm add adamoracle-contracts
yarn add adamoracle-contracts
bun add adamoracle-contracts
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-05-19 |
| First published | 2021-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 80.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adamoracle devs |
| Maintainers | adamll |

## Links

- npm: https://www.npmjs.com/package/adamoracle-contracts
- Repository: https://github.com/smartcontractadam/adamoracle
- Homepage: https://github.com/smartcontractadam/adamoracle#readme
- Issues: https://github.com/smartcontractadam/adamoracle/issues
- npm.io page: https://npm.io/package/adamoracle-contracts

## Recent versions

- 0.0.2 (latest) — 2021-05-19
- 0.0.1 — 2021-05-19

## README

<br/>
<p align="center">
<a href="https://adam.oracle/" target="_blank" color="#0d2990">
  <img src="https://github.com/smartcontractadam/adamoracle/blob/main/docs/logo-adamoracle.png" width="225" alt="Adamoracle logo">
</a>
</p>
<br/>

## ⚠️ Migration Notice

This package stores all of adamoracle's smart contracts, previously known as the `evm/` directory. The previous package was called `Adamoracle`, now it is `adamoracle-contracts`.

## Installation

```sh
# via Yarn
$ yarn add adamoracle-contracts

# via npm
$ npm install adamoracle-contracts --save
```

## Directory Structure

This package makes use of `adamoracle-contracts/belt` to output artifacts along with ethers.js and truffle contract abstractions from the smart contracts stored within `src`. The resulting structure of the package when published looks like:

```sh
contracts
├── abi # abi output from src/
│   ├── v0.1
├── ethers # ethers contract abstractions codegenned from abis
│   ├── v0.1
├── src # the contracts themselves, in .sol form
│   ├── v0.1
└── truffle  # truffle contract abstractions codegenned from abis
    ├── v0.1
```

## Usage

These smart contracts can be imported as a dependency in various ways described below.

### Solidity

The solidity smart contracts themselves can simply be imported via the `src` directory of `adamoracle-contracts`. If you wanted to consume the v0.4.x version of our Oracle smart contract, you could do the following:

```solidity
import "adamoracle-contracts/src/v0.1/Adamoracleed.sol";
```

### Artifacts

JSON artifacts generated by [sol-compiler](https://sol-compiler.com/) are available under the `abi` directory. If you wanted to consume the v0.4.x version of our Oracle JSON artifact with Javascript, you could do the following:

```js
const OracleV4Json = require('adamoracle-contracts/abi/v0.1/Oracle.json')
```

### Ethers

This library ships with [ethers.js](https://github.com/ethers-io/ethers.js/) contract abstractions generated by [typechain](https://github.com/ethereum-ts/TypeChain). To use these, make sure you have ethers.js installed as a dependency:

```sh
# via Yarn
$ yarn add ethers@^4.0.44

# via npm
$ npm install ethers@^4.0.44 --save
```

If you wanted to consume the v0.4.x version of our Oracle with JavaScript, you could do the following:

```ts
import { OracleFactory } from 'adamoracle-contracts/ethers/v0.1/OracleFactory'
```

This gives a fully typed (if using TypeScript) version of a ethers.js contract factory. See the [ethers.js](https://docs.ethers.io/ethers.js/html/api-contract.html) documentation on usage.

### Truffle

This library ships with [@truffle/contract](https://github.com/trufflesuite/truffle/tree/master/packages/contract#readme) abstractions of each of our smart contracts. To use these, make sure you have @truffle/contract as a dependency.

```sh
# via Yarn
$ yarn add @truffle/contract@^4.1.8

# via npm
$ npm install @truffle/contract@^4.1.8 --save
```

If you wanted to consume the v0.4.x version of our Oracle with JavaScript, you could do the following:

```js
const { Oracle } = require('adamoracle-contracts/truffle/v0.4/Oracle')
```

For usage, see the [@truffle/contract](https://github.com/trufflesuite/truffle/tree/master/packages/contract#readme) documentation.

For ease of use with testing, if the environment variable `NODE_ENV` is set, the imported truffle contract abstraction will automatically set its provider to `web3.currentProvider`, avoiding the need to perform a `setProvider` call before using it during your truffle tests.

```sh
NODE_ENV=true yarn truffle test
```

```bash
# Clone Adamoracle repository
$ git clone https://github.com/smartcontractadam/adamoracle.git

# Continuing via Yarn
$ yarn install
$ yarn setup:contracts

# Continuing via npm
$ npm install
$ npm run setup:contracts
```

## Testing

After completing the above [Development](#Development) commands, run tests with:

```sh
# From this directory, `evm-contracts` via Yarn
$ yarn test

# via npm
$ npm run test

# From project root
$ yarn wsrun adamoracle-contracts test
```

## Contributing

Contributions are welcome! Please refer to
[Adamoracle's contributing guidelines](./docs/CONTRIBUTING.md) for detailed
contribution information.

Thank you!

## License

[MIT](https://choosealicense.com/licenses/mit/)

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