@aurigami/sdk 1.17.5 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.17.5",
2
+ "version": "1.18.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/abis/index.ts CHANGED
@@ -15,6 +15,7 @@ import Multicall2ABI from '@aurigami/contracts/artifacts/contracts/mock/Multical
15
15
  import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
16
16
  import ReferralDirectoryV2ABI from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
17
17
  import PlyGameABI from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
18
+ import PlyTokenLockABI from '@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json';
18
19
  export {
19
20
  AuriOracleABI,
20
21
  AuTokenABI,
@@ -33,4 +34,5 @@ export {
33
34
  PulpABI,
34
35
  AuriInternalLensABI,
35
36
  PlyGameABI,
37
+ PlyTokenLockABI,
36
38
  };
@@ -10,6 +10,7 @@ import {
10
10
  PlyGame,
11
11
  PULP,
12
12
  ReferralDirectoryV2,
13
+ PlyTokenLock,
13
14
  } from '@aurigami/contracts/typechain';
14
15
  import { Contract } from 'ethers';
15
16
  import { assert } from '../helpers/helpers';
@@ -29,6 +30,7 @@ export class AuriEnv extends BlockchainEntityRead {
29
30
  private _referralDirectoryV2: ReferralDirectoryV2 | null = null;
30
31
  private _oracle: AuriOracle | null = null;
31
32
  private _plygame: PlyGame | null = null;
33
+ private _plyTokenLock: PlyTokenLock | null = null;
32
34
 
33
35
  public getContract<CType extends Contract>(address: string, abi: any) {
34
36
  return new Contract(address, abi, this._networkConnection.provider) as CType;
@@ -163,4 +165,14 @@ export class AuriEnv extends BlockchainEntityRead {
163
165
  }
164
166
  return this._plygame;
165
167
  }
168
+
169
+ get plyTokenLock(): PlyTokenLock {
170
+ if (!this._plyTokenLock) {
171
+ this._plyTokenLock = this.getContract<PlyTokenLock>(
172
+ networkAddresses.misc.PLY_TOKEN_LOCK,
173
+ abis.PlyTokenLockABI.abi
174
+ );
175
+ }
176
+ return this._plyTokenLock;
177
+ }
166
178
  }
@@ -182,7 +182,7 @@ export class MoneyMarketRead extends BlockchainEntityRead {
182
182
  if (helpers.isSameAddress(this.underlying.address, consts.networkAddresses.tokens.stNEAR)) {
183
183
  depositMETAApy = helpers.calcLMRewardApr(
184
184
  await fetchValuation(
185
- TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.META, '1000000', false),
185
+ TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.META, '750000', false),
186
186
  this._networkConnection.provider
187
187
  ),
188
188
  underlyingPrice.multipliedBy(totalDeposited.formattedAmount()),
@@ -209,7 +209,7 @@ export class MoneyMarketRead extends BlockchainEntityRead {
209
209
  if (helpers.isSameAddress(this.underlying.address, consts.networkAddresses.tokens.NEARX)) {
210
210
  depositStaderApy = helpers.calcLMRewardApr(
211
211
  await fetchValuation(
212
- TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.STADER, '83.35', false),
212
+ TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.STADER, '95', false),
213
213
  this._networkConnection.provider
214
214
  ),
215
215
  underlyingPrice.multipliedBy(totalDeposited.formattedAmount()),
@@ -0,0 +1,47 @@
1
+ import { TransactionResponse } from '@ethersproject/abstract-provider';
2
+ import { BigNumber as BN, utils } from 'ethers';
3
+ import {
4
+ AuriEnv,
5
+ BlockchainEntity,
6
+ BlockchainEntityRead,
7
+ PLYToken,
8
+ Token,
9
+ TokenAmount,
10
+ } from '../entities';
11
+ import * as helpers from '../helpers';
12
+ import { Address, NetworkConnection } from '../types';
13
+
14
+ export class PlyTokenLockRead extends BlockchainEntityRead {
15
+ public readonly env: AuriEnv;
16
+
17
+ public constructor(networkConnection: NetworkConnection) {
18
+ super(networkConnection);
19
+ this.env = new AuriEnv(networkConnection);
20
+ }
21
+
22
+ public async getClaimableAmount(recipient: Address): Promise<TokenAmount> {
23
+ const claimableAmount = await this.env.plyTokenLock.callStatic.claimableBalance(recipient);
24
+ return new TokenAmount(new Token(PLYToken.address, 18), claimableAmount.toString(), true);
25
+ }
26
+ }
27
+
28
+ export class PlyTokenLockReadWrite extends PlyTokenLockRead {
29
+ public async claim(recipient: Address, amount: TokenAmount): Promise<TransactionResponse> {
30
+ const amountToClaim = BN.from(amount.rawAmount());
31
+ return await this.env.plyTokenLock
32
+ .connect(this._networkConnection.signer!)
33
+ .claim(recipient, amountToClaim);
34
+ }
35
+ }
36
+
37
+ export class PlyTokenLock extends BlockchainEntity {
38
+ constructor() {
39
+ super();
40
+ }
41
+ public read(networkConnection: NetworkConnection): PlyTokenLockRead {
42
+ return new PlyTokenLockRead(networkConnection);
43
+ }
44
+ public readWrite(networkConnection: NetworkConnection): PlyTokenLockReadWrite {
45
+ return new PlyTokenLockReadWrite(networkConnection);
46
+ }
47
+ }
@@ -6,3 +6,4 @@ export * from './Pulp';
6
6
  export * from './Referral';
7
7
  export * from './Staking';
8
8
  export * from './misc';
9
+ export * from './PlyTokenLock';