# centarus-incentive-sdk

> # 📝 About - Sdk with helper functions to perform actions on the Incentive smart contracts - including data accounts serialization/deserialization

Latest version **1.0.1** (published 2023-04-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install centarus-incentive-sdk
pnpm add centarus-incentive-sdk
yarn add centarus-incentive-sdk
bun add centarus-incentive-sdk
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-04-06 |
| First published | 2023-03-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 289.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Femi Bolaji |
| Maintainers | imef-femi |

## Links

- npm: https://www.npmjs.com/package/centarus-incentive-sdk
- npm.io page: https://npm.io/package/centarus-incentive-sdk

## Dependencies (4)

- [bigint-buffer](https://npm.io/package/bigint-buffer.md) ^1.1.5
- [@solana/web3.js](https://npm.io/package/@solana/web3.js.md) ^1.73.3
- [@solana/spl-token](https://npm.io/package/@solana/spl-token.md) ^0.3.7
- [@project-serum/borsh](https://npm.io/package/@project-serum/borsh.md) ^0.2.5

## Recent versions

- 1.0.1 (latest) — 2023-04-06
- 1.0.0 — 2023-03-16

## README

# SDK for centarus incentive solana

# 📝 About
- Sdk with helper functions to perform actions on the Incentive smart contracts 
- including data accounts serialization/deserialization

## 🔥🔥 Actions:
- `initializeAccounts` -- to be called by any account that has sol
- `wrapTokens` -- to be called by user
- `unwrapTokens`  -- to be called by user
- `refreshPrizePool`  -- to be called by anybody (preferably rewardAuthority)
- `setEmergencyMode` -- can be called by either multisig operator or rewardAuthority. But note that rewardAuthority will be changed once this function is called
- `rewardUser` -- to be called by rewardAuthority
- `confirmUpdateRewardAuthority` -- -- to be called by new rewardAuthority

## 🚀 Multisig Instructions: generated to be called by a multisig
- `getUpdateRewardAuthorityInstruction` -- generate updateRewardAuthority instruction for Multisig
- `getSetEmergencyModeInstruction` -- generate setEmergencyModeInstruction for Multisig


## 🚀 Example:
- Import package
```
import { initializeCentarusAccounts } from "centarus-incentive-solana";
```
- Get reserve Information
```
   const reserveToUse = {
       asset: 'SOL',
       address: '5VVLD7BQp8y3bTgyF5ezm1ResyMTR3PhYsT4iHFU8Sxz',
       collateralMintAddress: 'FzwZWRMc3GCqjSrcpVX3ueJc6UpcV6iWWb7ZMsTXE3Gf',
       collateralSupplyAddress: 'J5KGpESS8Zq2MvK4rtL6wKbeMRYZzb6TEzn8qPsZFgGd',
       liquidityAddress: 'furd3XUtjXZ2gRvSsoUts9A5m8cMJNqdsyR2Rt8vY9s',
       liquidityFeeReceiverAddress: '5kFqzU2k1tEXtoeNayk1TVxLycoAH5k8WsaGnBnanYJH',
       userSupplyCap: 250
   }
```
- Initialize accounts

```
const connection = new Connection("https://api.devnet.solana.com", 'confirmed');
const payer = getKeypair(testAccounts[0].privateKey);
const rewardAuthority = getKeypair(testAccounts[1].privateKey);
const operator = getKeypair(testAccounts[2].privateKey);
const user = getKeypair(testAccounts[3].privateKey);
```
- Call function

```
    await initializeCentarusAccounts({
        connection,
        tokenSymbol: reserveToUse.asset,
        centarusProgramId: CENTARUS_PROGRAM_ID,
        decimals: asset.decimals,
        lendingMarketAddress: new PublicKey(lendingMarket.address),
        multisigOperator: operator.publicKey,
        payer,
        reserveCollateralMintAddress: new PublicKey(reserveToUse.collateralMintAddress),
        rewardAuthority: rewardAuthority.publicKey,
        tokenMintAddress: new PublicKey(asset.mintAddress),
    })
```

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