@aurigami/sdk 1.9.4 → 1.9.5

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.9.4",
2
+ "version": "1.9.5",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -4,6 +4,7 @@ import BigNumber from 'bignumber.js';
4
4
  import { BigNumber as BN, Contract } from 'ethers';
5
5
  import * as abis from '../abis';
6
6
  import * as consts from '../consts';
7
+ import { ONE_DAY } from '../consts';
7
8
  import {
8
9
  AuriEnv,
9
10
  BlockchainEntity,
@@ -74,16 +75,19 @@ export class MoneyMarketRead extends BlockchainEntityRead {
74
75
 
75
76
  public async getDepositAPY(): Promise<BigNumber> {
76
77
  const supplyRatePerTimestamp = await this.auToken.supplyRatePerTimestamp();
77
- return new BigNumber(supplyRatePerTimestamp.toString())
78
- .multipliedBy(60 * 60 * 24 * 365)
78
+ const supplyRatePerDay = new BigNumber(supplyRatePerTimestamp.toString())
79
+ .multipliedBy(ONE_DAY)
79
80
  .div(helpers.decimalFactor(18));
81
+
82
+ return new BigNumber(supplyRatePerDay.plus(1)).pow(365).minus(1);
80
83
  }
81
84
 
82
85
  public async getBorrowAPY(): Promise<BigNumber> {
83
86
  const borrowRatePerTimestamp = await this.auToken.borrowRatePerTimestamp();
84
- return new BigNumber(borrowRatePerTimestamp.toString())
85
- .multipliedBy(60 * 60 * 24 * 365)
87
+ const borrowRatePerDay = new BigNumber(borrowRatePerTimestamp.toString())
88
+ .multipliedBy(ONE_DAY)
86
89
  .div(helpers.decimalFactor(18));
90
+ return new BigNumber(borrowRatePerDay.plus(1)).pow(365).minus(1);
87
91
  }
88
92
 
89
93
  public async getCollateralRatio(): Promise<BigNumber> {