@aurigami/sdk 0.1.6 → 0.2.3

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.
@@ -1,14 +1,13 @@
1
- import { Signer } from '@ethersproject/abstract-signer';
2
- import { ProviderOrSigner } from './types';
1
+ import { NetworkConnection } from './types';
3
2
  export declare class BlockchainEntityRead {
4
- protected _providerOrSigner: ProviderOrSigner;
5
- constructor(providerOrSigner: ProviderOrSigner);
3
+ protected _networkConnection: NetworkConnection;
4
+ constructor(networkConnection: NetworkConnection);
6
5
  }
7
6
  export declare class BlockchainEntityReadWrite extends BlockchainEntityRead {
8
- constructor(signer: Signer);
7
+ constructor(networkConnection: NetworkConnection);
9
8
  }
10
9
  export declare class BlockchainEntity {
11
10
  constructor();
12
- read(provider: ProviderOrSigner): BlockchainEntityRead;
13
- readWrite(signer: Signer): BlockchainEntityReadWrite;
11
+ read(networkConnection: NetworkConnection): BlockchainEntityRead;
12
+ readWrite(networkConnection: NetworkConnection): BlockchainEntityReadWrite;
14
13
  }
@@ -1,24 +1,37 @@
1
1
  import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
2
- import { ProviderOrSigner, MoneyMarketDetails } from './types';
3
- import { Address, CurrencyAmount } from '@pendle/sdk-core';
4
- import { Contract } from 'ethers';
2
+ import { MoneyMarketDetails, NetworkConnection, Address } from './types';
3
+ import { AuErc20, AuETH, Comptroller } from "@aurigami/contracts/typechain";
5
4
  import { TransactionResponse } from '@ethersproject/abstract-provider';
5
+ import BigNumber from "bignumber.js";
6
+ import { Token } from './token';
7
+ import { TokenAmount } from './tokenAmount';
6
8
  export declare class MoneyMarketRead extends BlockchainEntityRead {
7
- protected _auToken: Contract;
8
- constructor(providerOrSigner: ProviderOrSigner, auToken: Address);
9
+ underlying: Token;
10
+ auToken: AuErc20 | AuETH;
11
+ protected _comptroller: Comptroller;
12
+ constructor(networkConnection: NetworkConnection, auToken: Address, underlyingAsset: Address);
13
+ getTotalTokenBorrowed(): Promise<TokenAmount>;
14
+ getTotalTokenDeposited(): Promise<TokenAmount>;
15
+ getDepositAPY(): Promise<BigNumber>;
16
+ getBorrowAPY(): Promise<BigNumber>;
17
+ getCollateralRatio(): Promise<BigNumber>;
18
+ getBorrowPlyAPY(): Promise<BigNumber>;
19
+ getDepositPlyAPY(): Promise<BigNumber>;
9
20
  getDetails(): Promise<MoneyMarketDetails>;
21
+ getUserBorrowBalance(userAddress: string): Promise<TokenAmount>;
22
+ getUserDepositBalance(userAddress: string): Promise<TokenAmount>;
10
23
  }
11
24
  export declare class MoneyMarketReadWrite extends MoneyMarketRead {
12
- dummyTransaction: () => Promise<TransactionResponse>;
13
- deposit(amount: CurrencyAmount): Promise<TransactionResponse>;
14
- borrow(amount: CurrencyAmount): Promise<TransactionResponse>;
15
- withdraw(amount: CurrencyAmount): Promise<TransactionResponse>;
16
- repay(amount: CurrencyAmount): Promise<TransactionResponse>;
25
+ deposit(amount: TokenAmount): Promise<TransactionResponse>;
26
+ borrow(amount: TokenAmount): Promise<TransactionResponse>;
27
+ withdraw(amount: TokenAmount): Promise<TransactionResponse>;
28
+ repay(amount: TokenAmount): Promise<TransactionResponse>;
17
29
  enableCollateral(): Promise<TransactionResponse>;
18
30
  disableCollateral(): Promise<TransactionResponse>;
19
31
  }
20
32
  export declare class MoneyMarket extends BlockchainEntity {
21
33
  protected address: Address;
22
- constructor(address: string);
23
- read(provider: ProviderOrSigner): MoneyMarketRead;
34
+ protected underlying: Address;
35
+ constructor(address: string, underlying: string);
36
+ read(networkConnection: NetworkConnection): MoneyMarketRead;
24
37
  }
package/dist/SDK.d.ts CHANGED
@@ -1,23 +1,29 @@
1
1
  import { BlockchainEntity, BlockchainEntityRead } from './BlockchainEntity';
2
- import { LockingDetails, PlyAuroraPoolDetails, ProviderOrSigner, UserDetails } from './types';
3
- import { Token, CurrencyAmount } from '@pendle/sdk-core';
2
+ import { LockingDetails, PlyAuroraPoolDetails, NetworkConnection, UserDetails, CurrencyAmount } from './types';
4
3
  import { TransactionResponse } from '@ethersproject/abstract-provider';
4
+ import { Contract, providers } from 'ethers';
5
+ import { AuriFairLaunch, Comptroller, TokenLock } from '@aurigami/contracts/typechain';
6
+ import { TokenAmount } from './tokenAmount';
7
+ import { Token } from './token';
5
8
  export declare class SdkRead extends BlockchainEntityRead {
6
- constructor(providerOrSigner: ProviderOrSigner);
9
+ protected _comptroller: Comptroller;
10
+ protected _tokenLock: TokenLock;
11
+ protected _auriFairLaunch: AuriFairLaunch;
12
+ protected _auriLens: Contract;
13
+ constructor(networkConnection: NetworkConnection);
7
14
  getLockingDetails(): Promise<LockingDetails>;
8
15
  getUserDetails(userAddress: string): Promise<UserDetails>;
9
16
  getPlyAuroraPoolDetails(): Promise<PlyAuroraPoolDetails>;
10
17
  getTokenPrice(token: Token): Promise<CurrencyAmount>;
11
- stakeBalanceOf(user: string): Promise<CurrencyAmount>;
18
+ stakeBalanceOf(user: string): Promise<TokenAmount>;
12
19
  }
13
20
  export declare class SdkReadWrite extends SdkRead {
14
- dummyTransaction: () => Promise<TransactionResponse>;
15
21
  claim(): Promise<TransactionResponse>;
16
- stake(amount: CurrencyAmount): Promise<TransactionResponse>;
17
- unstake(amount: CurrencyAmount): Promise<TransactionResponse>;
22
+ stake(amount: TokenAmount): Promise<TransactionResponse>;
23
+ unstake(amount: TokenAmount): Promise<TransactionResponse>;
18
24
  }
19
25
  export declare class SDK extends BlockchainEntity {
20
26
  constructor();
21
- read(provider: ProviderOrSigner): SdkRead;
22
- static defaultProvider(): ProviderOrSigner;
27
+ read(networkConnection: NetworkConnection): SdkRead;
28
+ static defaultProvider(): providers.Provider;
23
29
  }
@@ -1,6 +1,23 @@
1
- import { Token } from '@pendle/sdk-core';
1
+ import BigNumber from 'bignumber.js';
2
2
  import { Signer } from 'ethers';
3
- export declare const DOLLAR: Token;
4
3
  export declare const AVAX_DEFAULT_PROVIDER_URL = "https://api.avax.network/ext/bc/C/rpc";
5
4
  export declare const AVAX_DEFAULT_PROVIDER: any;
5
+ export declare const dummyAddress: string;
6
+ export declare const ETHAddress: string;
6
7
  export declare const AVAX_DEFAULT_SIGNER: Signer;
8
+ export declare const AURORA_CHAINID = 1313161554;
9
+ export declare const DECIMAL_PRECISION = 6;
10
+ export declare type NetworkAddresses = {
11
+ auTokens: {
12
+ address: string;
13
+ underlying: string;
14
+ }[];
15
+ misc: Record<string, string>;
16
+ tokens: Record<string, string>;
17
+ };
18
+ export declare const networkAddresses: NetworkAddresses;
19
+ export declare const BORROW_LIMIT_BUFFER: BigNumber;
20
+ export declare const REWARDCLAIMSTART = 1673280000;
21
+ export declare const ONE_DAY = 86400;
22
+ export declare const ONE_YEAR: number;
23
+ export declare const AurPlyPid = 1;
@@ -0,0 +1 @@
1
+ export declare const decimalRecords: Record<string, number>;
package/dist/dummy.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { Token, CurrencyAmount } from '@pendle/sdk-core';
1
+ import { Token } from './token';
2
+ import { TokenAmount } from './tokenAmount';
2
3
  import { UserMarketDetails } from './types';
3
4
  export declare const dummyToken: Token;
4
5
  export declare const dummyPly: Token;
5
6
  export declare const dummyPlyAurora: Token;
6
- export declare const dummyTokenAmount: CurrencyAmount;
7
- export declare const dummyZeroTokenAmount: CurrencyAmount;
8
- export declare const dummyTokenAmount2: CurrencyAmount;
9
- export declare const dummyTokenAmount3: CurrencyAmount;
7
+ export declare const dummyTokenAmount: TokenAmount;
8
+ export declare const dummyZeroTokenAmount: TokenAmount;
9
+ export declare const dummyTokenAmount2: TokenAmount;
10
+ export declare const dummyTokenAmount3: TokenAmount;
10
11
  export declare const dummyMarketAddress = "0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f";
11
12
  export declare const dummyUserMarketDetails: UserMarketDetails;
package/dist/helpers.d.ts CHANGED
@@ -1 +1,10 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { providers } from "ethers";
3
+ import { Address } from "./types";
1
4
  export declare function formatObject(object: Object): string;
5
+ export declare function decimalFactor(decimal: number): string;
6
+ export declare const isSameAddress: (address1: Address, address2: Address) => boolean;
7
+ export declare const getCurrentTimestamp: (provider: providers.Provider) => Promise<number>;
8
+ export declare function validateAndParseAddress(address: Address): Address;
9
+ export declare function getDecimal(address: Address): number;
10
+ export declare function calcLMRewardApr(rewardsValue: BigNumber, totalStakeValue: BigNumber, frequencyPerYear: number): BigNumber;
package/dist/index.d.ts CHANGED
@@ -4,4 +4,7 @@ export * from './BlockchainEntity';
4
4
  export * from './helpers';
5
5
  export * from './constants';
6
6
  export * from './dummy';
7
- export declare function sum(a: number, b: number): number;
7
+ export * from './priceFetcher';
8
+ export * from './token';
9
+ export * from './tokenAmount';
10
+ export * from './types';
@@ -0,0 +1,18 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { providers, BigNumber as BN } from "ethers";
3
+ import { TokenAmount } from "./tokenAmount";
4
+ import { Address } from "./types";
5
+ export declare function fetchPriceFromCoingeckoAPI(id: string): Promise<BigNumber>;
6
+ export declare function fetchPriceFromCoingecko(address: Address): Promise<BigNumber>;
7
+ export declare function fetchLPPositions(LPAddress: Address, provider: providers.Provider): Promise<{
8
+ token0: Address;
9
+ token1: Address;
10
+ reserve0: BN;
11
+ reserve1: BN;
12
+ totalSupply: BN;
13
+ }>;
14
+ export declare function fetchLPPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
15
+ export declare function fetchPriceFromOracle(auTokenAddress: Address, underlyingDecimal: number, provider: providers.Provider): Promise<BigNumber>;
16
+ export declare function fetchUnderlyingTokensPrices(provider: providers.Provider): Promise<any>;
17
+ export declare function fetchPrice(address: Address, provider: providers.Provider): Promise<BigNumber>;
18
+ export declare function fetchValuation(tokenAmount: TokenAmount, provider: providers.Provider, price?: BigNumber): Promise<BigNumber>;