@aurigami/sdk 1.3.5 → 1.4.0

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.3.5",
2
+ "version": "1.4.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -8,7 +8,7 @@ import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/Au
8
8
  import EthRepayHelperABI from "@aurigami/contracts/artifacts/contracts/EthRepayHelper.sol/EthRepayHelper.json"
9
9
  import { AuErc20, AuETH, AuriLens, Comptroller, EthRepayHelper } from "@aurigami/contracts/typechain";
10
10
  import { TransactionResponse } from '@ethersproject/abstract-provider';
11
- import { networkAddresses, ETHAddress, ONE_YEAR, INF, ONE_DAY } from "./constants";
11
+ import { networkAddresses, ETHAddress, ONE_YEAR, INF, ONE_DAY, DEPOSIT_NEAR_REWARDS_PER_WEEK, BORROW_NEAR_REWARDS_PER_WEEK } from "./constants";
12
12
  import BigNumber from "bignumber.js";
13
13
  import { decimalFactor, isSameAddress, calcLMRewardApr, getCurrentTimestamp } from './helpers';
14
14
  import { Token, PLYToken } from './token';
@@ -211,9 +211,12 @@ export class MoneyMarketRead extends BlockchainEntityRead {
211
211
 
212
212
  private getDepositNEARRewardPerWeek(): TokenAmount {
213
213
  const NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
214
- const rewardStopTime = 1650463200;
215
- if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC) && getCurrentTimestamp() <= rewardStopTime) {
216
- return new TokenAmount(NEARToken, "1250", false);
214
+ const rewardStartTime = 1650636000;
215
+ const rewardStopTime = 1651845600; // May 06, 2022 2 PM GMT
216
+ const currentTime = getCurrentTimestamp();
217
+ if (currentTime <= rewardStopTime && currentTime > rewardStartTime) {
218
+ const reward = DEPOSIT_NEAR_REWARDS_PER_WEEK[this.underlying.address.toLocaleLowerCase()] ?? "0";
219
+ return new TokenAmount(NEARToken, reward, false);
217
220
  } else {
218
221
  return new TokenAmount(NEARToken, "0");
219
222
  }
@@ -221,9 +224,12 @@ export class MoneyMarketRead extends BlockchainEntityRead {
221
224
 
222
225
  private getBorrowNEARRewardPerWeek(): TokenAmount {
223
226
  const NEARToken = new Token(networkAddresses.tokens.WNEAR, getDecimal(networkAddresses.tokens.WNEAR));
224
- const rewardStopTime = 1650463200;
225
- if (isSameAddress(this.underlying.address, networkAddresses.tokens.USDC) && getCurrentTimestamp() <= rewardStopTime) {
226
- return new TokenAmount(NEARToken, "3750", false);
227
+ const rewardStartTime = 1650636000;
228
+ const rewardStopTime = 1651845600; // May 06, 2022 2 PM GMT
229
+ const currentTime = getCurrentTimestamp();
230
+ if (currentTime <= rewardStopTime && currentTime > rewardStartTime) {
231
+ const reward = BORROW_NEAR_REWARDS_PER_WEEK[this.underlying.address.toLocaleLowerCase()] ?? "0";
232
+ return new TokenAmount(NEARToken, reward, false);
227
233
  } else {
228
234
  return new TokenAmount(NEARToken, "0");
229
235
  }
package/src/constants.ts CHANGED
@@ -98,3 +98,18 @@ export const INF = BN.from(2).pow(256).sub(1)
98
98
  export const AIRDROP_START_TIMESTAMP = 1649858400;
99
99
  export const AIRDROP_END_TIMESTAMP = 1651068000;
100
100
  export const AIRDROP_KEEP_THRESHOLD = 7 * 86400;
101
+
102
+ export const DEPOSIT_NEAR_REWARDS_PER_WEEK: {[k : string]: string} = Object.fromEntries(
103
+ // lower case all addresses
104
+ Object.entries({
105
+ '0xb12bfca5a55806aaf64e99521918a4bf0fc40802': '36375', // USDC
106
+ '0x4988a896b1227218e4a686fde5eabdcabd91571f': '14550', // USDT
107
+ '0xf4eb217ba2454613b15dbdea6e5f22276410e89e': '3638', // WBTC
108
+ '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': '14550', // ETH
109
+ '0xc42c30ac6cc15fac9bd938618bcaa1a1fae8501d': '3638', // WNEAR
110
+ }).map(([k, v]) => [k.toLowerCase(), v])
111
+ );
112
+
113
+ export const BORROW_NEAR_REWARDS_PER_WEEK: {[k : string]: string} = {
114
+ // currently 0 for all markets
115
+ }