# artkdev-staking

> [![Build Status](https://app.travis-ci.com/artkdev2020/ArtKDev-Staking.svg?branch=main)](https://app.travis-ci.com/artkdev2020/ArtKDev-Staking) [![codecov](https://codecov.io/gh/artkdev2020/ArtKDev-Staking/branch/main/graph/badge.svg?token=TZRY1TKBBL)](h

Latest version **1.3.2** (published 2022-10-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install artkdev-staking
pnpm add artkdev-staking
yarn add artkdev-staking
bun add artkdev-staking
```

## 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.3.2 |
| Published | 2022-10-26 |
| First published | 2022-09-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 42.1 KB |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | dmytropodelnik |
| Maintainers | dmytropodelnik |

## Links

- npm: https://www.npmjs.com/package/artkdev-staking
- Repository: https://github.com/artkdev2020/ArtKDev-Staking
- Homepage: https://github.com/artkdev2020/ArtKDev-Staking#readme
- Issues: https://github.com/artkdev2020/ArtKDev-Staking/issues
- npm.io page: https://npm.io/package/artkdev-staking

## Dependencies (12)

- [truffle](https://npm.io/package/truffle.md) 5.5.28
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.1.0
- [artkdev-helper](https://npm.io/package/artkdev-helper.md) ^3.0.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.26.0
- [babel-register](https://npm.io/package/babel-register.md) ^6.26.0
- [solidity-coverage](https://npm.io/package/solidity-coverage.md) ^0.7.22
- [truffle-assertions](https://npm.io/package/truffle-assertions.md) ^0.9.2
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1
- [ganache-time-traveler](https://npm.io/package/ganache-time-traveler.md) ^1.0.16
- [@openzeppelin/contracts](https://npm.io/package/@openzeppelin/contracts.md) 4.7.3
- [@openzeppelin/test-helpers](https://npm.io/package/@openzeppelin/test-helpers.md) ^0.5.16
- [@truffle/hdwallet-provider](https://npm.io/package/@truffle/hdwallet-provider.md) 2.0.13

## Recent versions

- 1.3.2 (latest) — 2022-10-26
- 1.3.1 — 2022-10-19
- 1.3.0 — 2022-10-18
- 1.2.1 — 2022-10-12
- 1.2.0 — 2022-10-07
- 1.1.1 — 2022-10-03
- 1.1.0 — 2022-09-26
- 1.0.3 — 2022-09-26
- 1.0.2 — 2022-09-13
- 1.0.1 — 2022-09-13
- 1.0.0 — 2022-09-12

## README

# Staking

[![Build Status](https://app.travis-ci.com/artkdev2020/ArtKDev-Staking.svg?branch=main)](https://app.travis-ci.com/artkdev2020/ArtKDev-Staking)
[![codecov](https://codecov.io/gh/artkdev2020/ArtKDev-Staking/branch/main/graph/badge.svg?token=TZRY1TKBBL)](https://codecov.io/gh/artkdev2020/ArtKDev-Staking)
[![CodeFactor](https://www.codefactor.io/repository/github/artkdev2020/artkdev-staking/badge)](https://www.codefactor.io/repository/github/artkdev2020/artkdev-staking)

Mainnet contract: [link]()<br>
Testnet contract: [link](https://testnet.bscscan.com/address/0x8C35dB7a70490aa762719ab87f9CDdAd4258d8cb#code)

The main idea of the ArtKDev-Staking contract is to stake ERC-20 tokens.

### Navigation

- [Installation](#installation)
- [Admin](#admin-privileges)
- [Owner of a staking pool](#owner-of-a-staking-pool)
- [User](#user)
- [License](#license)

#### Installation

```console
npm install
```

#### Testing

```console
truffle run coverage
```

#### Deploy

```console
truffle dashboard
```

```console
truffle migrate --network dashboard
```

## Admin privileges

### Setting a locking address

<pre><b>ATTENTION!
You can set a new locking contract's address if it is not equal to previous.</b></pre>

If you want to set a new locking contract's address, you should use a SetLockingAddress() function.

```solidity
  function SetLockingAddress(address _newAddress) external;
```

Testnet tx: [link](https://testnet.bscscan.com/tx/0xaecfb03aa283481e6df79369fc243fb9c70e2d6269b58c62c58763b34bbdb5a7)

### Pausing the staking

If you want to pause the staking, you should use a Pause() function.

```solidity
  function Pause() external;
```

Testnet tx: [link](https://testnet.bscscan.com/tx/0xcb038b5b1f4c87379cbbd0171dd882f22c566302ff571bfa574d7bab15993978)

### Unpausing the staking

If you want to unpause the staking, you should use a Unpause() function.

```solidity
  function Unpause() external;
```

Testnet tx: [link](https://testnet.bscscan.com/tx/0x86e3657a4cd1ee7089e6a9b862885a2bdd4f6c40153e8aa2c6029543f26bbf03)

## Owner of a staking pool

### Creating a new staking pool

If you want to create a new staking pool, you should use a CreateNewStakingPool() function.

```solidity
  function CreateNewStakingPool(
        address _lockingToken,     // address of a locking token
        address _rewardToken,      // address of a reward token
        uint256 _tokensAmount,     // reward tokens amount
        uint256 _startTime,        // time when pool will be started to stake
        uint256 _finishTime,       // time when pool will be finished of staking
        uint256 _profit,           // annual percentage of reward
        uint256 _minDuration,      // min duration of staking
        uint256 _maxDuration,      // max duration of staking
        uint256 _minAmount,        // min amount of tokens to stake
        uint256 _maxAmount,        // max amount of tokens to stake
        uint256 _earlierWithdraw   // amount of tokens to withdraw earlier than ordinary
    )
     external;
```

Testnet tx: [link](https://testnet.bscscan.com/tx/0x5637358698a4436c48f3dc74ff773f696c403092f13650557780709564c6a3f6)

### Withdrawing a balance

If you want to withdraw a balance, you should use a WithdrawBalance() function.

```solidity
  function WithdrawBalance(uint256 _id) external;
```

## User privileges

### Staking

If you want to stake some tokens, you should use a Stake() function.

```solidity
  function Stake(
        uint256 _id,
        uint256 _amount,
        uint256 _duration  // in seconds
    ) external;
```

Testnet tx: [link](https://testnet.bscscan.com/tx/0x8f483adffa2aa3b73b5bdc588e13fde78130ec7f26564ff3ed794f196ba67165)

## License

ArtKDev's contracts is released under the MIT License.

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