@aurigami/sdk 1.17.2 → 1.17.4

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.2",
2
+ "version": "1.17.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/SDK.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TransactionResponse } from '@ethersproject/abstract-provider';
2
2
  import BigNumber from 'bignumber.js';
3
- import { ALL_STAKING_POOLS } from './consts';
3
+ import { ALL_STAKING_POOLS, SD_INCENTIVE_IN_SD } from './consts';
4
4
  import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from './entities';
5
5
  import { MiscRead, StakingRead, StakingReadWrite } from './interactors';
6
6
  import * as types from './types';
@@ -106,6 +106,7 @@ export const networkAddresses = {
106
106
  WNEAR_TRI: '0x84b123875f0f36b966d0b6ca14b31121bd9676ad'.toLowerCase(),
107
107
  AURORA_WNEAR: '0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008'.toLowerCase(),
108
108
  NEARX: '0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375'.toLowerCase(),
109
+ STADER: '0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84'.toLowerCase(),
109
110
  },
110
111
  } as const;
111
112
 
@@ -123,6 +124,7 @@ export const PRICE_WHITELISTED = new Set([
123
124
  networkAddresses.tokens.TRI,
124
125
  networkAddresses.tokens.META,
125
126
  networkAddresses.tokens.stNEAR,
127
+ networkAddresses.tokens.STADER,
126
128
  ]);
127
129
 
128
130
  export const REWARD_CLAIM_START = 1651759200; // Thursday, 5 May 2022 14:00:00 UTC
@@ -182,3 +184,5 @@ export const REFERRAL_CAMPAIGNS: { [k: string]: { start: number; end: number } }
182
184
  ]);
183
185
 
184
186
  export const CACHE_TIMEOUT = 10 * 1000; // 10 seconds
187
+
188
+ export const SD_INCENTIVE_IN_SD = 83.35;
@@ -25,4 +25,5 @@ export const decimalRecords: Record<string, number> = {
25
25
  '0x84b123875f0f36b966d0b6ca14b31121bd9676ad': 18, // WNEAR_TRI,
26
26
  '0x1e0e812fbcd3eb75d8562ad6f310ed94d258d008': 18, // AURORA_WNEAR
27
27
  '0xb39eeb9e168ef6c639f5e282fef1f6bc4dcae375': 24, // NEARX
28
+ '0x078e103d5f9629ac48b8563fa2bfcd2f6d5fde84': 18, // STADER
28
29
  };
@@ -67,6 +67,9 @@ export async function fetchPriceFromCoingecko(id: Address): Promise<BigNumber> {
67
67
  case networkAddresses.tokens.META:
68
68
  return fetchPriceFromCoingeckoAPI('meta-pool');
69
69
 
70
+ case networkAddresses.tokens.STADER:
71
+ return fetchPriceFromCoingeckoAPI('stader');
72
+
70
73
  default:
71
74
  throw Error(`Unknown token ${id} in fetchPriceFromCoingecko`);
72
75
  }
@@ -227,7 +230,8 @@ function shouldFetchFromCoingeckoOrDefiLlama(address: string) {
227
230
  return (
228
231
  address == networkAddresses.tokens.AURORA ||
229
232
  address == networkAddresses.tokens.TRI ||
230
- address == networkAddresses.tokens.META
233
+ address == networkAddresses.tokens.META ||
234
+ address == networkAddresses.tokens.STADER
231
235
  );
232
236
  }
233
237
 
@@ -207,9 +207,11 @@ export class MoneyMarketRead extends BlockchainEntityRead {
207
207
  ]);
208
208
  let depositStaderApy;
209
209
  if (helpers.isSameAddress(this.underlying.address, consts.networkAddresses.tokens.NEARX)) {
210
- // 100$ a day
211
210
  depositStaderApy = helpers.calcLMRewardApr(
212
- new BigNumber(100),
211
+ await fetchValuation(
212
+ TokenAmount.fromAddressAndAmount(consts.networkAddresses.tokens.STADER, '83.35', false),
213
+ this._networkConnection.provider
214
+ ),
213
215
  underlyingPrice.multipliedBy(totalDeposited.formattedAmount()),
214
216
  365
215
217
  );
@@ -21,7 +21,7 @@ export class PulpReadWrite extends PulpRead {
21
21
  recipient: Address,
22
22
  amount: TokenAmount
23
23
  ): Promise<TransactionResponse> {
24
- const amountToRedeem = BN.from(amount.rawAmount);
24
+ const amountToRedeem = BN.from(amount.rawAmount());
25
25
  return this.env.pulp.redeem(recipient, amountToRedeem);
26
26
  }
27
27
  }