@lagoon-protocol/v0-core 0.1.2
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/README.md +98 -0
- package/dist/addresses.d.ts +66 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/chain.d.ts +250 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +533 -0
- package/dist/math/MathLib.d.ts +103 -0
- package/dist/math/MathLib.d.ts.map +1 -0
- package/dist/math/index.d.ts +2 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/token/Token.d.ts +52 -0
- package/dist/token/Token.d.ts.map +1 -0
- package/dist/token/index.d.ts +2 -0
- package/dist/token/index.d.ts.map +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/vault/Vault.d.ts +91 -0
- package/dist/vault/Vault.d.ts.map +1 -0
- package/dist/vault/VaultUtils.d.ts +18 -0
- package/dist/vault/VaultUtils.d.ts.map +1 -0
- package/dist/vault/index.d.ts +3 -0
- package/dist/vault/index.d.ts.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @lagoon-protocol/v0-core
|
|
2
|
+
|
|
3
|
+
Framework-agnostic package that defines Lagoon vault entity classes, inspired by [@morpho-org/blue-sdk](https://github.com/morpho-org/sdks/tree/main/packages/blue-sdk) architecture:
|
|
4
|
+
|
|
5
|
+
- [**Vault**](./src/vault/Vault.ts): represents the state of a Lagoon vault
|
|
6
|
+
|
|
7
|
+
- [**Token**](./src/token/Token.ts): represents an ERC20 token
|
|
8
|
+
|
|
9
|
+
## How to install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @lagoon-protocol/v0-core
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun install @lagoon-protocol/v0-core
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How to use
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { Vault, Token } from '@lagoon-protocol/v0-core';
|
|
23
|
+
import { VaultUtils } from "@lagoon-protocol/v0-core";
|
|
24
|
+
import { addresses, ChainId, Version } from "@lagoon-protocol/v0-core";
|
|
25
|
+
|
|
26
|
+
const UINT256_MAX = 2n ** 256n - 1n;
|
|
27
|
+
|
|
28
|
+
const tacUSN = new Vault({
|
|
29
|
+
address: '0x7895A046b26CC07272B022a0C9BAFC046E6F6396',
|
|
30
|
+
name: 'Noon tacUSN',
|
|
31
|
+
symbol: 'tacUSN',
|
|
32
|
+
decimals: 18,
|
|
33
|
+
price: undefined,
|
|
34
|
+
asset: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
35
|
+
underlyingDecimals: 6,
|
|
36
|
+
totalAssets: 0n,
|
|
37
|
+
newTotalAssets: UINT256_MAX,
|
|
38
|
+
depositEpochId: 1,
|
|
39
|
+
depositSettleId: 1,
|
|
40
|
+
lastDepositEpochIdSettled: 0,
|
|
41
|
+
redeemEpochId: 2,
|
|
42
|
+
redeemSettleId: 2,
|
|
43
|
+
lastRedeemEpochIdSettled: 0,
|
|
44
|
+
pendingSilo: '0x65D57bb5fB43fc227518D7c983e83388D4017687',
|
|
45
|
+
wrappedNativeToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
46
|
+
decimalsOffset: 12,
|
|
47
|
+
totalAssetsExpiration: 0n,
|
|
48
|
+
totalAssetsLifespan: 0n,
|
|
49
|
+
feeRegistry: addresses[ChainId.EthMainnet].feeRegistry,
|
|
50
|
+
newRatesTimestamp: 1744463627n,
|
|
51
|
+
lastFeeTime: 0n,
|
|
52
|
+
highWaterMark: 1000000n,
|
|
53
|
+
cooldown: 0n,
|
|
54
|
+
feeRates: { managementRate: 50, performanceRate: 1000 },
|
|
55
|
+
owner: '0xA766CdA5848FfD7D33cE3861f6dc0A5EE38f3550',
|
|
56
|
+
pendingOwner: '0x0000000000000000000000000000000000000000',
|
|
57
|
+
whitelistManager: '0x0000000000000000000000000000000000000000',
|
|
58
|
+
feeReceiver: '0xa336DA6a81EFfa40362D2763d81643a67C82D151',
|
|
59
|
+
safe: '0xA766CdA5848FfD7D33cE3861f6dc0A5EE38f3550',
|
|
60
|
+
valuationManager: '0xF53eAeB7e6f15CBb6dB990eaf2A26702e1D986d8',
|
|
61
|
+
state: 0,
|
|
62
|
+
isWhitelistActivated: false,
|
|
63
|
+
version: Version.v0_4_0,
|
|
64
|
+
totalSupply: 0n
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
tacUSN.name // Noon tacUSN
|
|
68
|
+
tacUSN.simbol // tacUSN
|
|
69
|
+
|
|
70
|
+
tacUSN.convertToShares(BigInt(10 ** tacUSN.underlyingDecimals));
|
|
71
|
+
tacUSN.convertToAssets(VaultUtils.ONE_SHARE);
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Local development:
|
|
77
|
+
|
|
78
|
+
To install dependencies:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bun install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To run:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bun run test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This project was created using `bun init` in bun v1.2.9. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
|
91
|
+
|
|
92
|
+
## Disclaimer ⚠️
|
|
93
|
+
|
|
94
|
+
This SDK is provided on a best-effort basis by the Lagoon team to facilitate integration with Lagoon Vaults. While we strive to ensure the accuracy, reliability, and security of this software, it is provided “as is” without any guarantees or warranties of any kind, express or implied.
|
|
95
|
+
|
|
96
|
+
Lagoon and its contributors accept no responsibility or liability for any loss, damage, or other consequences resulting from the use, misuse, or inability to use this SDK. It is the responsibility of the integrator to perform appropriate testing, due diligence, and security assessments before deploying or relying on this software in production environments.
|
|
97
|
+
|
|
98
|
+
By using this SDK, you acknowledge and agree to assume all associated risks.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
2
|
+
export type ChainAddresses = typeof addresses;
|
|
3
|
+
export declare const addresses: {
|
|
4
|
+
readonly 1: {
|
|
5
|
+
readonly beaconProxyFactory: "0x09C8803f7Dc251f9FaAE5f56E3B91f8A6d0b70ee";
|
|
6
|
+
readonly feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C";
|
|
7
|
+
readonly v0_5_0: "0xe50554ec802375c9c3f9c087a8a7bb8c26d3dedf";
|
|
8
|
+
readonly wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
9
|
+
};
|
|
10
|
+
readonly 42161: {
|
|
11
|
+
readonly beaconProxyFactory: "0x58a7729125acA9e5E9C687018E66bfDd5b2D4490";
|
|
12
|
+
readonly feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C";
|
|
13
|
+
readonly v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf";
|
|
14
|
+
readonly wrappedNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 ";
|
|
15
|
+
/**
|
|
16
|
+
* @dev Events not indexed
|
|
17
|
+
*/
|
|
18
|
+
readonly dev: {
|
|
19
|
+
readonly beaconProxyFactory: "0x29f3dba953C57814A5579e08462724B9C760333e";
|
|
20
|
+
readonly feeRegistry: "0x45BA44B8899D39abdc383a25bB17fcD18240c6Bc";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
readonly 8453: {
|
|
24
|
+
readonly beaconProxyFactory: "0xC953Fd298FdfA8Ed0D38ee73772D3e21Bf19c61b";
|
|
25
|
+
readonly feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C";
|
|
26
|
+
readonly v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf";
|
|
27
|
+
readonly wrappedNative: "0x4200000000000000000000000000000000000006";
|
|
28
|
+
};
|
|
29
|
+
readonly 130: {
|
|
30
|
+
readonly beaconProxyFactory: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c";
|
|
31
|
+
readonly feeRegistry: "0x652716FaD571f04D26a3c8fFd9E593F17123Ab20";
|
|
32
|
+
readonly v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf";
|
|
33
|
+
readonly wrappedNative: "0x4200000000000000000000000000000000000006";
|
|
34
|
+
};
|
|
35
|
+
readonly 80094: {
|
|
36
|
+
readonly beaconProxyFactory: "0x7cf8cf276450bd568187fdc0b0959d30ec599853";
|
|
37
|
+
readonly feeRegistry: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c";
|
|
38
|
+
readonly v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf";
|
|
39
|
+
readonly wrappedNative: "0x6969696969696969696969696969696969696969";
|
|
40
|
+
};
|
|
41
|
+
readonly 146: {
|
|
42
|
+
readonly beaconProxyFactory: "0x99CD0b8b32B15922f0754Fddc21323b5278c5261";
|
|
43
|
+
readonly feeRegistry: "0xab4aC28D10a4Bc279aD073B1D74Bfa0E385C010C";
|
|
44
|
+
readonly v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf";
|
|
45
|
+
readonly wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38";
|
|
46
|
+
};
|
|
47
|
+
readonly 5000: {
|
|
48
|
+
readonly beaconProxyFactory: "0x57D969B556C6AebB3Ac8f54c98CF3a3f921d5659";
|
|
49
|
+
readonly feeRegistry: "0x47A144e67834408716cB40Fa87fc886D63362ddC";
|
|
50
|
+
readonly v0_4_0: "0xA7260Cee56B679eC05a736A7b603b8DA8525Dd69";
|
|
51
|
+
readonly wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8";
|
|
52
|
+
};
|
|
53
|
+
readonly 480: {
|
|
54
|
+
readonly beaconProxyFactory: "0x600fA26581771F56221FC9847A834B3E5fd34AF7";
|
|
55
|
+
readonly feeRegistry: "0x68e793658def657551fd4D3cA6Bc04b4E7723655";
|
|
56
|
+
readonly v0_5_0: "0x1D42DbDde553F4099691A25F712bbd8f2686E355 ";
|
|
57
|
+
readonly wrappedNative: "0x4200000000000000000000000000000000000006";
|
|
58
|
+
};
|
|
59
|
+
readonly 43114: {
|
|
60
|
+
readonly beaconProxyFactory: "0x5e231c6d030a5c0f51fa7d0f891d3f50a928c685";
|
|
61
|
+
readonly feeRegistry: "0xD7F69ba99c6981Eab5579Aa16871Ae94c509d578";
|
|
62
|
+
readonly v0_5_0: "0x33F65C8D025b5418C7f8dd248C2Ec1d31881D465";
|
|
63
|
+
readonly wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../src/addresses.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,+CAA+C,CAAC;AAE3E,MAAM,MAAM,cAAc,GAAG,OAAO,SAAS,CAAC;AAE9C,eAAO,MAAM,SAAS;;;;;;;;;;;;QAYlB;;UAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDI,CAAA"}
|
package/dist/chain.d.ts
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
export declare enum ChainId {
|
|
2
|
+
EthMainnet = 1,
|
|
3
|
+
BaseMainnet = 8453,
|
|
4
|
+
PolygonMainnet = 137,
|
|
5
|
+
ArbitrumMainnet = 42161,
|
|
6
|
+
OptimismMainnet = 10,
|
|
7
|
+
WorldChainMainnet = 480,
|
|
8
|
+
FraxtalMainnet = 252,
|
|
9
|
+
ScrollMainnet = 534352,
|
|
10
|
+
InkMainnet = 57073,
|
|
11
|
+
UnichainMainnet = 130,
|
|
12
|
+
SonicMainnet = 146,
|
|
13
|
+
HemiMainnet = 43111,
|
|
14
|
+
ModeMainnet = 34443,
|
|
15
|
+
CornMainnet = 21000000,
|
|
16
|
+
PlumeMainnet = 98866,
|
|
17
|
+
CampMainnet = 123420001114,
|
|
18
|
+
BerachainMainnet = 80094,
|
|
19
|
+
MantleMainnet = 5000,
|
|
20
|
+
AvalancheMainnet = 43114
|
|
21
|
+
}
|
|
22
|
+
export interface ChainMetadata {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly id: ChainId;
|
|
25
|
+
readonly explorerUrl: string;
|
|
26
|
+
readonly nativeCurrency: {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly symbol: string;
|
|
29
|
+
readonly decimals: number;
|
|
30
|
+
};
|
|
31
|
+
readonly identifier: string;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace ChainUtils {
|
|
34
|
+
const toHexChainId: (chainId: ChainId) => `0x${string}`;
|
|
35
|
+
const getExplorerUrl: <T extends ChainId>(chainId: T) => (typeof ChainUtils.CHAIN_METADATA)[T]["explorerUrl"];
|
|
36
|
+
const getExplorerAddressUrl: <T extends ChainId>(chainId: T, address: string) => `${(typeof ChainUtils.CHAIN_METADATA)[T]["explorerUrl"]}/address/${string}`;
|
|
37
|
+
const getExplorerTransactionUrl: <T extends ChainId>(chainId: T, tx: string) => `${(typeof ChainUtils.CHAIN_METADATA)[T]["explorerUrl"]}/tx/${string}`;
|
|
38
|
+
const CHAIN_METADATA: {
|
|
39
|
+
readonly 1: {
|
|
40
|
+
readonly name: "Ethereum";
|
|
41
|
+
readonly id: ChainId.EthMainnet;
|
|
42
|
+
readonly nativeCurrency: {
|
|
43
|
+
readonly name: "Ether";
|
|
44
|
+
readonly symbol: "ETH";
|
|
45
|
+
readonly decimals: 18;
|
|
46
|
+
};
|
|
47
|
+
readonly explorerUrl: "https://etherscan.io";
|
|
48
|
+
readonly identifier: "mainnet";
|
|
49
|
+
};
|
|
50
|
+
readonly 8453: {
|
|
51
|
+
readonly name: "Base";
|
|
52
|
+
readonly id: ChainId.BaseMainnet;
|
|
53
|
+
readonly nativeCurrency: {
|
|
54
|
+
readonly name: "Ether";
|
|
55
|
+
readonly symbol: "ETH";
|
|
56
|
+
readonly decimals: 18;
|
|
57
|
+
};
|
|
58
|
+
readonly explorerUrl: "https://basescan.org";
|
|
59
|
+
readonly identifier: "base";
|
|
60
|
+
};
|
|
61
|
+
readonly 137: {
|
|
62
|
+
readonly name: "Polygon";
|
|
63
|
+
readonly id: ChainId.PolygonMainnet;
|
|
64
|
+
readonly nativeCurrency: {
|
|
65
|
+
readonly name: "Polygon";
|
|
66
|
+
readonly symbol: "POL";
|
|
67
|
+
readonly decimals: 18;
|
|
68
|
+
};
|
|
69
|
+
readonly explorerUrl: "https://polygonscan.com";
|
|
70
|
+
readonly identifier: "polygon";
|
|
71
|
+
};
|
|
72
|
+
readonly 42161: {
|
|
73
|
+
readonly name: "Arbitrum One";
|
|
74
|
+
readonly id: ChainId.ArbitrumMainnet;
|
|
75
|
+
readonly nativeCurrency: {
|
|
76
|
+
readonly name: "Ether";
|
|
77
|
+
readonly symbol: "ETH";
|
|
78
|
+
readonly decimals: 18;
|
|
79
|
+
};
|
|
80
|
+
readonly explorerUrl: "https://arbiscan.io";
|
|
81
|
+
readonly identifier: "arbitrum";
|
|
82
|
+
};
|
|
83
|
+
readonly 10: {
|
|
84
|
+
readonly name: "OP Mainnet";
|
|
85
|
+
readonly id: ChainId.OptimismMainnet;
|
|
86
|
+
readonly nativeCurrency: {
|
|
87
|
+
readonly name: "Ether";
|
|
88
|
+
readonly symbol: "ETH";
|
|
89
|
+
readonly decimals: 18;
|
|
90
|
+
};
|
|
91
|
+
readonly explorerUrl: "https://optimistic.etherscan.io";
|
|
92
|
+
readonly identifier: "optimism";
|
|
93
|
+
};
|
|
94
|
+
readonly 480: {
|
|
95
|
+
readonly name: "World Chain";
|
|
96
|
+
readonly id: ChainId.WorldChainMainnet;
|
|
97
|
+
readonly nativeCurrency: {
|
|
98
|
+
readonly name: "Ether";
|
|
99
|
+
readonly symbol: "ETH";
|
|
100
|
+
readonly decimals: 18;
|
|
101
|
+
};
|
|
102
|
+
readonly explorerUrl: "https://worldscan.org";
|
|
103
|
+
readonly identifier: "worldchain";
|
|
104
|
+
};
|
|
105
|
+
readonly 252: {
|
|
106
|
+
readonly name: "Fraxtal";
|
|
107
|
+
readonly id: ChainId.FraxtalMainnet;
|
|
108
|
+
readonly nativeCurrency: {
|
|
109
|
+
readonly name: "Frax Ether";
|
|
110
|
+
readonly symbol: "frxETH";
|
|
111
|
+
readonly decimals: 18;
|
|
112
|
+
};
|
|
113
|
+
readonly explorerUrl: "https://fraxscan.com";
|
|
114
|
+
readonly identifier: "fraxtal";
|
|
115
|
+
};
|
|
116
|
+
readonly 534352: {
|
|
117
|
+
readonly name: "Scroll";
|
|
118
|
+
readonly id: ChainId.ScrollMainnet;
|
|
119
|
+
readonly nativeCurrency: {
|
|
120
|
+
readonly name: "Ether";
|
|
121
|
+
readonly symbol: "ETH";
|
|
122
|
+
readonly decimals: 18;
|
|
123
|
+
};
|
|
124
|
+
readonly explorerUrl: "https://scrollscan.com";
|
|
125
|
+
readonly identifier: "scroll";
|
|
126
|
+
};
|
|
127
|
+
readonly 57073: {
|
|
128
|
+
readonly name: "Ink";
|
|
129
|
+
readonly id: ChainId.InkMainnet;
|
|
130
|
+
readonly nativeCurrency: {
|
|
131
|
+
readonly name: "Ether";
|
|
132
|
+
readonly symbol: "ETH";
|
|
133
|
+
readonly decimals: 18;
|
|
134
|
+
};
|
|
135
|
+
readonly explorerUrl: "https://explorer.inkonchain.com";
|
|
136
|
+
readonly identifier: "ink";
|
|
137
|
+
};
|
|
138
|
+
readonly 130: {
|
|
139
|
+
readonly name: "Unichain";
|
|
140
|
+
readonly id: ChainId.UnichainMainnet;
|
|
141
|
+
readonly nativeCurrency: {
|
|
142
|
+
readonly name: "Ether";
|
|
143
|
+
readonly symbol: "ETH";
|
|
144
|
+
readonly decimals: 18;
|
|
145
|
+
};
|
|
146
|
+
readonly explorerUrl: "https://uniscan.xyz";
|
|
147
|
+
readonly identifier: "unichain";
|
|
148
|
+
};
|
|
149
|
+
readonly 146: {
|
|
150
|
+
readonly name: "Sonic";
|
|
151
|
+
readonly id: ChainId.SonicMainnet;
|
|
152
|
+
readonly nativeCurrency: {
|
|
153
|
+
readonly name: "Sonic";
|
|
154
|
+
readonly symbol: "S";
|
|
155
|
+
readonly decimals: 18;
|
|
156
|
+
};
|
|
157
|
+
readonly explorerUrl: "https://sonicscan.org";
|
|
158
|
+
readonly identifier: "sonic";
|
|
159
|
+
};
|
|
160
|
+
readonly 43111: {
|
|
161
|
+
readonly name: "Hemi";
|
|
162
|
+
readonly id: ChainId.HemiMainnet;
|
|
163
|
+
readonly nativeCurrency: {
|
|
164
|
+
readonly name: "Ether";
|
|
165
|
+
readonly symbol: "ETH";
|
|
166
|
+
readonly decimals: 18;
|
|
167
|
+
};
|
|
168
|
+
readonly explorerUrl: "https://explorer.hemi.xyz";
|
|
169
|
+
readonly identifier: "hemi";
|
|
170
|
+
};
|
|
171
|
+
readonly 34443: {
|
|
172
|
+
readonly name: "Mode";
|
|
173
|
+
readonly id: ChainId.ModeMainnet;
|
|
174
|
+
readonly nativeCurrency: {
|
|
175
|
+
readonly name: "Ether";
|
|
176
|
+
readonly symbol: "ETH";
|
|
177
|
+
readonly decimals: 18;
|
|
178
|
+
};
|
|
179
|
+
readonly explorerUrl: "https://modescan.io";
|
|
180
|
+
readonly identifier: "mode";
|
|
181
|
+
};
|
|
182
|
+
readonly 21000000: {
|
|
183
|
+
readonly name: "Corn";
|
|
184
|
+
readonly id: ChainId.CornMainnet;
|
|
185
|
+
readonly nativeCurrency: {
|
|
186
|
+
readonly name: "Bitcoin";
|
|
187
|
+
readonly symbol: "BTCN";
|
|
188
|
+
readonly decimals: 18;
|
|
189
|
+
};
|
|
190
|
+
readonly explorerUrl: "https://cornscan.io";
|
|
191
|
+
readonly identifier: "corn";
|
|
192
|
+
};
|
|
193
|
+
readonly 98866: {
|
|
194
|
+
readonly name: "Plume";
|
|
195
|
+
readonly id: ChainId.PlumeMainnet;
|
|
196
|
+
readonly nativeCurrency: {
|
|
197
|
+
readonly name: "Plume";
|
|
198
|
+
readonly symbol: "PLUME";
|
|
199
|
+
readonly decimals: 18;
|
|
200
|
+
};
|
|
201
|
+
readonly explorerUrl: "https://phoenix-explorer.plumenetwork.xyz";
|
|
202
|
+
readonly identifier: "plume";
|
|
203
|
+
};
|
|
204
|
+
readonly 123420001114: {
|
|
205
|
+
readonly name: "Camp";
|
|
206
|
+
readonly id: ChainId.CampMainnet;
|
|
207
|
+
readonly nativeCurrency: {
|
|
208
|
+
readonly name: "Camp";
|
|
209
|
+
readonly symbol: "CAMP";
|
|
210
|
+
readonly decimals: 18;
|
|
211
|
+
};
|
|
212
|
+
readonly explorerUrl: "https://basecamp.cloud.blockscout.com/";
|
|
213
|
+
readonly identifier: "camp";
|
|
214
|
+
};
|
|
215
|
+
readonly 80094: {
|
|
216
|
+
readonly name: "Berachain";
|
|
217
|
+
readonly id: ChainId.BerachainMainnet;
|
|
218
|
+
readonly nativeCurrency: {
|
|
219
|
+
readonly name: "Bera";
|
|
220
|
+
readonly symbol: "BERA";
|
|
221
|
+
readonly decimals: 18;
|
|
222
|
+
};
|
|
223
|
+
readonly explorerUrl: "https://berascan.com/";
|
|
224
|
+
readonly identifier: "berachain";
|
|
225
|
+
};
|
|
226
|
+
readonly 5000: {
|
|
227
|
+
readonly name: "Mantle";
|
|
228
|
+
readonly id: ChainId.MantleMainnet;
|
|
229
|
+
readonly nativeCurrency: {
|
|
230
|
+
readonly name: "Mantle";
|
|
231
|
+
readonly symbol: "MNT";
|
|
232
|
+
readonly decimals: 18;
|
|
233
|
+
};
|
|
234
|
+
readonly explorerUrl: "https://mantlescan.xyz/";
|
|
235
|
+
readonly identifier: "mantle";
|
|
236
|
+
};
|
|
237
|
+
readonly 43114: {
|
|
238
|
+
readonly name: "Avalanche";
|
|
239
|
+
readonly id: ChainId.AvalancheMainnet;
|
|
240
|
+
readonly nativeCurrency: {
|
|
241
|
+
readonly name: "Avalanche";
|
|
242
|
+
readonly symbol: "AVAX";
|
|
243
|
+
readonly decimals: 18;
|
|
244
|
+
};
|
|
245
|
+
readonly explorerUrl: "https://snowtrace.io";
|
|
246
|
+
readonly identifier: "avalanche";
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO;IACjB,UAAU,IAAI;IACd,WAAW,OAAO;IAClB,cAAc,MAAM;IACpB,eAAe,QAAQ;IACvB,eAAe,KAAK;IACpB,iBAAiB,MAAM;IACvB,cAAc,MAAM;IACpB,aAAa,SAAS;IACtB,UAAU,QAAQ;IAClB,eAAe,MAAM;IACrB,YAAY,MAAM;IAClB,WAAW,QAAQ;IACnB,WAAW,QAAQ;IACnB,WAAW,WAAW;IACtB,YAAY,QAAQ;IACpB,WAAW,eAAe;IAC1B,gBAAgB,QAAQ;IACxB,aAAa,OAAO;IACpB,gBAAgB,QAAQ;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE;QACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,yBAAiB,UAAU,CAAC;IACnB,MAAM,YAAY,GAAI,SAAS,OAAO,KAAG,KAAK,MAAM,EAE1D,CAAC;IAEK,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,EAAE,SAAS,CAAC,KAAG,CAAC,OAAO,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,aAAa,CAEjH,CAAC;IAEK,MAAM,qBAAqB,GAAI,CAAC,SAAS,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,MAAM,KAAG,GAAG,CAAC,OAAO,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,MAAM,EAE/J,CAAC;IAEK,MAAM,yBAAyB,GAAI,CAAC,SAAS,OAAO,EAAE,SAAS,CAAC,EAAE,IAAI,MAAM,KAAG,GAAG,CAAC,OAAO,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,MAAM,EAEzJ,CAAC;IAEK,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsIjB,CAAA;CACX"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
// src/math/MathLib.ts
|
|
2
|
+
var MathLib;
|
|
3
|
+
((MathLib) => {
|
|
4
|
+
MathLib.WAD = 1000000000000000000n;
|
|
5
|
+
MathLib.RAY = 1000000000000000000000000000n;
|
|
6
|
+
MathLib.MAX_UINT_256 = maxUint(256);
|
|
7
|
+
MathLib.MAX_UINT_160 = maxUint(160);
|
|
8
|
+
MathLib.MAX_UINT_128 = maxUint(128);
|
|
9
|
+
MathLib.MAX_UINT_48 = maxUint(48);
|
|
10
|
+
function maxUint(nBits) {
|
|
11
|
+
if (nBits % 4 !== 0)
|
|
12
|
+
throw new Error(`Invalid number of bits: ${nBits}`);
|
|
13
|
+
return BigInt(`0x${"f".repeat(nBits / 4)}`);
|
|
14
|
+
}
|
|
15
|
+
MathLib.maxUint = maxUint;
|
|
16
|
+
function abs(a) {
|
|
17
|
+
a = BigInt(a);
|
|
18
|
+
return a >= 0 ? a : -a;
|
|
19
|
+
}
|
|
20
|
+
MathLib.abs = abs;
|
|
21
|
+
function min(...xs) {
|
|
22
|
+
return xs.map(BigInt).reduce((x, y) => x <= y ? x : y);
|
|
23
|
+
}
|
|
24
|
+
MathLib.min = min;
|
|
25
|
+
function max(...xs) {
|
|
26
|
+
return xs.map(BigInt).reduce((x, y) => x <= y ? y : x);
|
|
27
|
+
}
|
|
28
|
+
MathLib.max = max;
|
|
29
|
+
function zeroFloorSub(x, y) {
|
|
30
|
+
x = BigInt(x);
|
|
31
|
+
y = BigInt(y);
|
|
32
|
+
return x <= y ? 0n : x - y;
|
|
33
|
+
}
|
|
34
|
+
MathLib.zeroFloorSub = zeroFloorSub;
|
|
35
|
+
function wMulDown(x, y) {
|
|
36
|
+
return MathLib.wMul(x, y, "Down");
|
|
37
|
+
}
|
|
38
|
+
MathLib.wMulDown = wMulDown;
|
|
39
|
+
function wMulUp(x, y) {
|
|
40
|
+
return MathLib.wMul(x, y, "Up");
|
|
41
|
+
}
|
|
42
|
+
MathLib.wMulUp = wMulUp;
|
|
43
|
+
function wMul(x, y, rounding) {
|
|
44
|
+
return MathLib.mulDiv(x, y, MathLib.WAD, rounding);
|
|
45
|
+
}
|
|
46
|
+
MathLib.wMul = wMul;
|
|
47
|
+
function wDivDown(x, y) {
|
|
48
|
+
return MathLib.wDiv(x, y, "Down");
|
|
49
|
+
}
|
|
50
|
+
MathLib.wDivDown = wDivDown;
|
|
51
|
+
function wDivUp(x, y) {
|
|
52
|
+
return MathLib.wDiv(x, y, "Up");
|
|
53
|
+
}
|
|
54
|
+
MathLib.wDivUp = wDivUp;
|
|
55
|
+
function wDiv(x, y, rounding) {
|
|
56
|
+
return MathLib.mulDiv(x, MathLib.WAD, y, rounding);
|
|
57
|
+
}
|
|
58
|
+
MathLib.wDiv = wDiv;
|
|
59
|
+
function mulDivDown(x, y, denominator) {
|
|
60
|
+
x = BigInt(x);
|
|
61
|
+
y = BigInt(y);
|
|
62
|
+
denominator = BigInt(denominator);
|
|
63
|
+
if (denominator === 0n)
|
|
64
|
+
throw Error("MathLib: DIVISION_BY_ZERO");
|
|
65
|
+
return x * y / denominator;
|
|
66
|
+
}
|
|
67
|
+
MathLib.mulDivDown = mulDivDown;
|
|
68
|
+
function mulDivUp(x, y, denominator) {
|
|
69
|
+
x = BigInt(x);
|
|
70
|
+
y = BigInt(y);
|
|
71
|
+
denominator = BigInt(denominator);
|
|
72
|
+
if (denominator === 0n)
|
|
73
|
+
throw Error("MathLib: DIVISION_BY_ZERO");
|
|
74
|
+
const roundup = x * y % denominator > 0 ? 1n : 0n;
|
|
75
|
+
return x * y / denominator + roundup;
|
|
76
|
+
}
|
|
77
|
+
MathLib.mulDivUp = mulDivUp;
|
|
78
|
+
function mulDiv(x, y, denominator, rounding) {
|
|
79
|
+
return MathLib[`mulDiv${rounding}`](x, y, denominator);
|
|
80
|
+
}
|
|
81
|
+
MathLib.mulDiv = mulDiv;
|
|
82
|
+
function wTaylorCompounded(x, n) {
|
|
83
|
+
const firstTerm = BigInt(x) * BigInt(n);
|
|
84
|
+
const secondTerm = MathLib.mulDivDown(firstTerm, firstTerm, 2n * MathLib.WAD);
|
|
85
|
+
const thirdTerm = MathLib.mulDivDown(secondTerm, firstTerm, 3n * MathLib.WAD);
|
|
86
|
+
return firstTerm + secondTerm + thirdTerm;
|
|
87
|
+
}
|
|
88
|
+
MathLib.wTaylorCompounded = wTaylorCompounded;
|
|
89
|
+
function wToRay(x) {
|
|
90
|
+
return BigInt(x) * 1000000000n;
|
|
91
|
+
}
|
|
92
|
+
MathLib.wToRay = wToRay;
|
|
93
|
+
})(MathLib ||= {});
|
|
94
|
+
// src/token/Token.ts
|
|
95
|
+
class Test {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
class Token {
|
|
99
|
+
address;
|
|
100
|
+
name;
|
|
101
|
+
symbol;
|
|
102
|
+
decimals;
|
|
103
|
+
totalSupply;
|
|
104
|
+
price;
|
|
105
|
+
constructor({
|
|
106
|
+
address,
|
|
107
|
+
name,
|
|
108
|
+
symbol,
|
|
109
|
+
decimals = 0,
|
|
110
|
+
totalSupply,
|
|
111
|
+
price
|
|
112
|
+
}) {
|
|
113
|
+
this.address = address;
|
|
114
|
+
this.name = name;
|
|
115
|
+
this.symbol = symbol;
|
|
116
|
+
this.decimals = Number(decimals);
|
|
117
|
+
this.totalSupply = BigInt(totalSupply);
|
|
118
|
+
if (price != null)
|
|
119
|
+
this.price = BigInt(price);
|
|
120
|
+
}
|
|
121
|
+
fromUsd(amount, rounding = "Down") {
|
|
122
|
+
if (this.price == null)
|
|
123
|
+
return;
|
|
124
|
+
return MathLib.mulDiv(amount, 10n ** BigInt(this.decimals), this.price, rounding);
|
|
125
|
+
}
|
|
126
|
+
toUsd(amount, rounding = "Down") {
|
|
127
|
+
if (this.price == null)
|
|
128
|
+
return;
|
|
129
|
+
return MathLib.mulDiv(amount, this.price, 10n ** BigInt(this.decimals), rounding);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/vault/VaultUtils.ts
|
|
134
|
+
var VaultUtils;
|
|
135
|
+
((VaultUtils) => {
|
|
136
|
+
VaultUtils.VIRTUAL_ASSETS = 1n;
|
|
137
|
+
VaultUtils.ONE_SHARE = 10n ** 18n;
|
|
138
|
+
function decimalsOffset(decimals) {
|
|
139
|
+
return MathLib.zeroFloorSub(18n, decimals);
|
|
140
|
+
}
|
|
141
|
+
VaultUtils.decimalsOffset = decimalsOffset;
|
|
142
|
+
function convertToAssets(shares, {
|
|
143
|
+
totalAssets,
|
|
144
|
+
totalSupply,
|
|
145
|
+
decimalsOffset: decimalsOffset2
|
|
146
|
+
}, rounding = "Down") {
|
|
147
|
+
return MathLib.mulDiv(shares, BigInt(totalAssets) + VaultUtils.VIRTUAL_ASSETS, BigInt(totalSupply) + 10n ** BigInt(decimalsOffset2), rounding);
|
|
148
|
+
}
|
|
149
|
+
VaultUtils.convertToAssets = convertToAssets;
|
|
150
|
+
function convertToShares(assets, {
|
|
151
|
+
totalAssets,
|
|
152
|
+
totalSupply,
|
|
153
|
+
decimalsOffset: decimalsOffset2
|
|
154
|
+
}, rounding = "Up") {
|
|
155
|
+
return MathLib.mulDiv(assets, BigInt(totalSupply) + 10n ** BigInt(decimalsOffset2), BigInt(totalAssets) + VaultUtils.VIRTUAL_ASSETS, rounding);
|
|
156
|
+
}
|
|
157
|
+
VaultUtils.convertToShares = convertToShares;
|
|
158
|
+
})(VaultUtils ||= {});
|
|
159
|
+
|
|
160
|
+
// src/vault/Vault.ts
|
|
161
|
+
var Version;
|
|
162
|
+
((Version2) => {
|
|
163
|
+
Version2["v0_5_0"] = "v0.5.0";
|
|
164
|
+
Version2["v0_4_0"] = "v0.4.0";
|
|
165
|
+
Version2["v0_3_0"] = "v0.3.0";
|
|
166
|
+
Version2["v0_2_0"] = "v0.2.0";
|
|
167
|
+
Version2["v0_1_0"] = "v0.1.0";
|
|
168
|
+
})(Version ||= {});
|
|
169
|
+
var LATEST_VERSION = "v0.5.0" /* v0_5_0 */;
|
|
170
|
+
function resolveVersion(version) {
|
|
171
|
+
return version === "latest" ? LATEST_VERSION : version;
|
|
172
|
+
}
|
|
173
|
+
var State;
|
|
174
|
+
((State2) => {
|
|
175
|
+
State2[State2["Open"] = 0] = "Open";
|
|
176
|
+
State2[State2["Closing"] = 1] = "Closing";
|
|
177
|
+
State2[State2["Closed"] = 2] = "Closed";
|
|
178
|
+
})(State ||= {});
|
|
179
|
+
|
|
180
|
+
class Vault extends Token {
|
|
181
|
+
asset;
|
|
182
|
+
underlyingDecimals;
|
|
183
|
+
totalAssets;
|
|
184
|
+
newTotalAssets;
|
|
185
|
+
depositEpochId;
|
|
186
|
+
depositSettleId;
|
|
187
|
+
lastDepositEpochIdSettled;
|
|
188
|
+
redeemEpochId;
|
|
189
|
+
redeemSettleId;
|
|
190
|
+
lastRedeemEpochIdSettled;
|
|
191
|
+
pendingSilo;
|
|
192
|
+
wrappedNativeToken;
|
|
193
|
+
decimalsOffset;
|
|
194
|
+
totalAssetsExpiration;
|
|
195
|
+
totalAssetsLifespan;
|
|
196
|
+
feeRegistry;
|
|
197
|
+
newRatesTimestamp;
|
|
198
|
+
lastFeeTime;
|
|
199
|
+
highWaterMark;
|
|
200
|
+
cooldown;
|
|
201
|
+
feeRates;
|
|
202
|
+
owner;
|
|
203
|
+
pendingOwner;
|
|
204
|
+
whitelistManager;
|
|
205
|
+
feeReceiver;
|
|
206
|
+
safe;
|
|
207
|
+
valuationManager;
|
|
208
|
+
state;
|
|
209
|
+
isWhitelistActivated;
|
|
210
|
+
version;
|
|
211
|
+
constructor({
|
|
212
|
+
asset,
|
|
213
|
+
underlyingDecimals,
|
|
214
|
+
totalAssets,
|
|
215
|
+
newTotalAssets,
|
|
216
|
+
depositEpochId,
|
|
217
|
+
depositSettleId,
|
|
218
|
+
lastDepositEpochIdSettled,
|
|
219
|
+
redeemEpochId,
|
|
220
|
+
redeemSettleId,
|
|
221
|
+
lastRedeemEpochIdSettled,
|
|
222
|
+
pendingSilo,
|
|
223
|
+
wrappedNativeToken,
|
|
224
|
+
decimalsOffset,
|
|
225
|
+
totalAssetsExpiration,
|
|
226
|
+
totalAssetsLifespan,
|
|
227
|
+
feeRegistry,
|
|
228
|
+
newRatesTimestamp,
|
|
229
|
+
lastFeeTime,
|
|
230
|
+
highWaterMark,
|
|
231
|
+
cooldown,
|
|
232
|
+
feeRates,
|
|
233
|
+
owner,
|
|
234
|
+
pendingOwner,
|
|
235
|
+
whitelistManager,
|
|
236
|
+
feeReceiver,
|
|
237
|
+
safe,
|
|
238
|
+
valuationManager,
|
|
239
|
+
state,
|
|
240
|
+
isWhitelistActivated,
|
|
241
|
+
version,
|
|
242
|
+
...config
|
|
243
|
+
}) {
|
|
244
|
+
super({ ...config, decimals: 18 });
|
|
245
|
+
this.asset = asset;
|
|
246
|
+
this.underlyingDecimals = underlyingDecimals;
|
|
247
|
+
this.totalAssets = totalAssets;
|
|
248
|
+
this.newTotalAssets = newTotalAssets;
|
|
249
|
+
this.depositEpochId = depositEpochId;
|
|
250
|
+
this.depositSettleId = depositSettleId;
|
|
251
|
+
this.lastDepositEpochIdSettled = lastDepositEpochIdSettled;
|
|
252
|
+
this.redeemEpochId = redeemEpochId;
|
|
253
|
+
this.redeemSettleId = redeemSettleId;
|
|
254
|
+
this.lastRedeemEpochIdSettled = lastRedeemEpochIdSettled;
|
|
255
|
+
this.pendingSilo = pendingSilo;
|
|
256
|
+
this.wrappedNativeToken = wrappedNativeToken;
|
|
257
|
+
this.decimalsOffset = decimalsOffset;
|
|
258
|
+
this.totalAssetsExpiration = totalAssetsExpiration;
|
|
259
|
+
this.totalAssetsLifespan = totalAssetsLifespan;
|
|
260
|
+
this.feeRegistry = feeRegistry;
|
|
261
|
+
this.newRatesTimestamp = newRatesTimestamp;
|
|
262
|
+
this.lastFeeTime = lastFeeTime;
|
|
263
|
+
this.highWaterMark = highWaterMark;
|
|
264
|
+
this.cooldown = cooldown;
|
|
265
|
+
this.feeRates = feeRates;
|
|
266
|
+
this.owner = owner;
|
|
267
|
+
this.pendingOwner = pendingOwner;
|
|
268
|
+
this.whitelistManager = whitelistManager;
|
|
269
|
+
this.feeReceiver = feeReceiver;
|
|
270
|
+
this.safe = safe;
|
|
271
|
+
this.valuationManager = valuationManager;
|
|
272
|
+
this.state = state;
|
|
273
|
+
this.isWhitelistActivated = isWhitelistActivated;
|
|
274
|
+
this.version = version;
|
|
275
|
+
}
|
|
276
|
+
convertToAssets(shares, rounding) {
|
|
277
|
+
return VaultUtils.convertToAssets(shares, { totalAssets: this.totalAssets, totalSupply: this.totalSupply, decimalsOffset: this.decimalsOffset }, rounding);
|
|
278
|
+
}
|
|
279
|
+
convertToShares(assets, rounding) {
|
|
280
|
+
return VaultUtils.convertToShares(assets, { totalAssets: this.totalAssets, totalSupply: this.totalSupply, decimalsOffset: this.decimalsOffset }, rounding);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// src/chain.ts
|
|
284
|
+
var ChainId;
|
|
285
|
+
((ChainId2) => {
|
|
286
|
+
ChainId2[ChainId2["EthMainnet"] = 1] = "EthMainnet";
|
|
287
|
+
ChainId2[ChainId2["BaseMainnet"] = 8453] = "BaseMainnet";
|
|
288
|
+
ChainId2[ChainId2["PolygonMainnet"] = 137] = "PolygonMainnet";
|
|
289
|
+
ChainId2[ChainId2["ArbitrumMainnet"] = 42161] = "ArbitrumMainnet";
|
|
290
|
+
ChainId2[ChainId2["OptimismMainnet"] = 10] = "OptimismMainnet";
|
|
291
|
+
ChainId2[ChainId2["WorldChainMainnet"] = 480] = "WorldChainMainnet";
|
|
292
|
+
ChainId2[ChainId2["FraxtalMainnet"] = 252] = "FraxtalMainnet";
|
|
293
|
+
ChainId2[ChainId2["ScrollMainnet"] = 534352] = "ScrollMainnet";
|
|
294
|
+
ChainId2[ChainId2["InkMainnet"] = 57073] = "InkMainnet";
|
|
295
|
+
ChainId2[ChainId2["UnichainMainnet"] = 130] = "UnichainMainnet";
|
|
296
|
+
ChainId2[ChainId2["SonicMainnet"] = 146] = "SonicMainnet";
|
|
297
|
+
ChainId2[ChainId2["HemiMainnet"] = 43111] = "HemiMainnet";
|
|
298
|
+
ChainId2[ChainId2["ModeMainnet"] = 34443] = "ModeMainnet";
|
|
299
|
+
ChainId2[ChainId2["CornMainnet"] = 21000000] = "CornMainnet";
|
|
300
|
+
ChainId2[ChainId2["PlumeMainnet"] = 98866] = "PlumeMainnet";
|
|
301
|
+
ChainId2[ChainId2["CampMainnet"] = 123420001114] = "CampMainnet";
|
|
302
|
+
ChainId2[ChainId2["BerachainMainnet"] = 80094] = "BerachainMainnet";
|
|
303
|
+
ChainId2[ChainId2["MantleMainnet"] = 5000] = "MantleMainnet";
|
|
304
|
+
ChainId2[ChainId2["AvalancheMainnet"] = 43114] = "AvalancheMainnet";
|
|
305
|
+
})(ChainId ||= {});
|
|
306
|
+
var ChainUtils;
|
|
307
|
+
((ChainUtils) => {
|
|
308
|
+
ChainUtils.toHexChainId = (chainId) => {
|
|
309
|
+
return `0x${chainId.toString(16)}`;
|
|
310
|
+
};
|
|
311
|
+
ChainUtils.getExplorerUrl = (chainId) => {
|
|
312
|
+
return ChainUtils.CHAIN_METADATA[chainId].explorerUrl;
|
|
313
|
+
};
|
|
314
|
+
ChainUtils.getExplorerAddressUrl = (chainId, address) => {
|
|
315
|
+
return `${ChainUtils.getExplorerUrl(chainId)}/address/${address}`;
|
|
316
|
+
};
|
|
317
|
+
ChainUtils.getExplorerTransactionUrl = (chainId, tx) => {
|
|
318
|
+
return `${ChainUtils.getExplorerUrl(chainId)}/tx/${tx}`;
|
|
319
|
+
};
|
|
320
|
+
ChainUtils.CHAIN_METADATA = {
|
|
321
|
+
[1 /* EthMainnet */]: {
|
|
322
|
+
name: "Ethereum",
|
|
323
|
+
id: 1 /* EthMainnet */,
|
|
324
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
325
|
+
explorerUrl: "https://etherscan.io",
|
|
326
|
+
identifier: "mainnet"
|
|
327
|
+
},
|
|
328
|
+
[8453 /* BaseMainnet */]: {
|
|
329
|
+
name: "Base",
|
|
330
|
+
id: 8453 /* BaseMainnet */,
|
|
331
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
332
|
+
explorerUrl: "https://basescan.org",
|
|
333
|
+
identifier: "base"
|
|
334
|
+
},
|
|
335
|
+
[137 /* PolygonMainnet */]: {
|
|
336
|
+
name: "Polygon",
|
|
337
|
+
id: 137 /* PolygonMainnet */,
|
|
338
|
+
nativeCurrency: { name: "Polygon", symbol: "POL", decimals: 18 },
|
|
339
|
+
explorerUrl: "https://polygonscan.com",
|
|
340
|
+
identifier: "polygon"
|
|
341
|
+
},
|
|
342
|
+
[42161 /* ArbitrumMainnet */]: {
|
|
343
|
+
name: "Arbitrum One",
|
|
344
|
+
id: 42161 /* ArbitrumMainnet */,
|
|
345
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
346
|
+
explorerUrl: "https://arbiscan.io",
|
|
347
|
+
identifier: "arbitrum"
|
|
348
|
+
},
|
|
349
|
+
[10 /* OptimismMainnet */]: {
|
|
350
|
+
name: "OP Mainnet",
|
|
351
|
+
id: 10 /* OptimismMainnet */,
|
|
352
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
353
|
+
explorerUrl: "https://optimistic.etherscan.io",
|
|
354
|
+
identifier: "optimism"
|
|
355
|
+
},
|
|
356
|
+
[480 /* WorldChainMainnet */]: {
|
|
357
|
+
name: "World Chain",
|
|
358
|
+
id: 480 /* WorldChainMainnet */,
|
|
359
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
360
|
+
explorerUrl: "https://worldscan.org",
|
|
361
|
+
identifier: "worldchain"
|
|
362
|
+
},
|
|
363
|
+
[252 /* FraxtalMainnet */]: {
|
|
364
|
+
name: "Fraxtal",
|
|
365
|
+
id: 252 /* FraxtalMainnet */,
|
|
366
|
+
nativeCurrency: { name: "Frax Ether", symbol: "frxETH", decimals: 18 },
|
|
367
|
+
explorerUrl: "https://fraxscan.com",
|
|
368
|
+
identifier: "fraxtal"
|
|
369
|
+
},
|
|
370
|
+
[534352 /* ScrollMainnet */]: {
|
|
371
|
+
name: "Scroll",
|
|
372
|
+
id: 534352 /* ScrollMainnet */,
|
|
373
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
374
|
+
explorerUrl: "https://scrollscan.com",
|
|
375
|
+
identifier: "scroll"
|
|
376
|
+
},
|
|
377
|
+
[57073 /* InkMainnet */]: {
|
|
378
|
+
name: "Ink",
|
|
379
|
+
id: 57073 /* InkMainnet */,
|
|
380
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
381
|
+
explorerUrl: "https://explorer.inkonchain.com",
|
|
382
|
+
identifier: "ink"
|
|
383
|
+
},
|
|
384
|
+
[130 /* UnichainMainnet */]: {
|
|
385
|
+
name: "Unichain",
|
|
386
|
+
id: 130 /* UnichainMainnet */,
|
|
387
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
388
|
+
explorerUrl: "https://uniscan.xyz",
|
|
389
|
+
identifier: "unichain"
|
|
390
|
+
},
|
|
391
|
+
[146 /* SonicMainnet */]: {
|
|
392
|
+
name: "Sonic",
|
|
393
|
+
id: 146 /* SonicMainnet */,
|
|
394
|
+
nativeCurrency: { name: "Sonic", symbol: "S", decimals: 18 },
|
|
395
|
+
explorerUrl: "https://sonicscan.org",
|
|
396
|
+
identifier: "sonic"
|
|
397
|
+
},
|
|
398
|
+
[43111 /* HemiMainnet */]: {
|
|
399
|
+
name: "Hemi",
|
|
400
|
+
id: 43111 /* HemiMainnet */,
|
|
401
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
402
|
+
explorerUrl: "https://explorer.hemi.xyz",
|
|
403
|
+
identifier: "hemi"
|
|
404
|
+
},
|
|
405
|
+
[34443 /* ModeMainnet */]: {
|
|
406
|
+
name: "Mode",
|
|
407
|
+
id: 34443 /* ModeMainnet */,
|
|
408
|
+
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
409
|
+
explorerUrl: "https://modescan.io",
|
|
410
|
+
identifier: "mode"
|
|
411
|
+
},
|
|
412
|
+
[21000000 /* CornMainnet */]: {
|
|
413
|
+
name: "Corn",
|
|
414
|
+
id: 21000000 /* CornMainnet */,
|
|
415
|
+
nativeCurrency: { name: "Bitcoin", symbol: "BTCN", decimals: 18 },
|
|
416
|
+
explorerUrl: "https://cornscan.io",
|
|
417
|
+
identifier: "corn"
|
|
418
|
+
},
|
|
419
|
+
[98866 /* PlumeMainnet */]: {
|
|
420
|
+
name: "Plume",
|
|
421
|
+
id: 98866 /* PlumeMainnet */,
|
|
422
|
+
nativeCurrency: { name: "Plume", symbol: "PLUME", decimals: 18 },
|
|
423
|
+
explorerUrl: "https://phoenix-explorer.plumenetwork.xyz",
|
|
424
|
+
identifier: "plume"
|
|
425
|
+
},
|
|
426
|
+
[123420001114 /* CampMainnet */]: {
|
|
427
|
+
name: "Camp",
|
|
428
|
+
id: 123420001114 /* CampMainnet */,
|
|
429
|
+
nativeCurrency: { name: "Camp", symbol: "CAMP", decimals: 18 },
|
|
430
|
+
explorerUrl: "https://basecamp.cloud.blockscout.com/",
|
|
431
|
+
identifier: "camp"
|
|
432
|
+
},
|
|
433
|
+
[80094 /* BerachainMainnet */]: {
|
|
434
|
+
name: "Berachain",
|
|
435
|
+
id: 80094 /* BerachainMainnet */,
|
|
436
|
+
nativeCurrency: { name: "Bera", symbol: "BERA", decimals: 18 },
|
|
437
|
+
explorerUrl: "https://berascan.com/",
|
|
438
|
+
identifier: "berachain"
|
|
439
|
+
},
|
|
440
|
+
[5000 /* MantleMainnet */]: {
|
|
441
|
+
name: "Mantle",
|
|
442
|
+
id: 5000 /* MantleMainnet */,
|
|
443
|
+
nativeCurrency: { name: "Mantle", symbol: "MNT", decimals: 18 },
|
|
444
|
+
explorerUrl: "https://mantlescan.xyz/",
|
|
445
|
+
identifier: "mantle"
|
|
446
|
+
},
|
|
447
|
+
[43114 /* AvalancheMainnet */]: {
|
|
448
|
+
name: "Avalanche",
|
|
449
|
+
id: 43114 /* AvalancheMainnet */,
|
|
450
|
+
nativeCurrency: { name: "Avalanche", symbol: "AVAX", decimals: 18 },
|
|
451
|
+
explorerUrl: "https://snowtrace.io",
|
|
452
|
+
identifier: "avalanche"
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
})(ChainUtils ||= {});
|
|
456
|
+
|
|
457
|
+
// src/addresses.ts
|
|
458
|
+
var NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
459
|
+
var addresses = {
|
|
460
|
+
[1 /* EthMainnet */]: {
|
|
461
|
+
beaconProxyFactory: "0x09C8803f7Dc251f9FaAE5f56E3B91f8A6d0b70ee",
|
|
462
|
+
feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
|
|
463
|
+
v0_5_0: "0xe50554ec802375c9c3f9c087a8a7bb8c26d3dedf",
|
|
464
|
+
wrappedNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
465
|
+
},
|
|
466
|
+
[42161 /* ArbitrumMainnet */]: {
|
|
467
|
+
beaconProxyFactory: "0x58a7729125acA9e5E9C687018E66bfDd5b2D4490",
|
|
468
|
+
feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
|
|
469
|
+
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
470
|
+
wrappedNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1 ",
|
|
471
|
+
dev: {
|
|
472
|
+
beaconProxyFactory: "0x29f3dba953C57814A5579e08462724B9C760333e",
|
|
473
|
+
feeRegistry: "0x45BA44B8899D39abdc383a25bB17fcD18240c6Bc"
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
[8453 /* BaseMainnet */]: {
|
|
477
|
+
beaconProxyFactory: "0xC953Fd298FdfA8Ed0D38ee73772D3e21Bf19c61b",
|
|
478
|
+
feeRegistry: "0x6dA4D1859bA1d02D095D2246142CdAd52233e27C",
|
|
479
|
+
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
480
|
+
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
481
|
+
},
|
|
482
|
+
[130 /* UnichainMainnet */]: {
|
|
483
|
+
beaconProxyFactory: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
|
|
484
|
+
feeRegistry: "0x652716FaD571f04D26a3c8fFd9E593F17123Ab20",
|
|
485
|
+
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
486
|
+
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
487
|
+
},
|
|
488
|
+
[80094 /* BerachainMainnet */]: {
|
|
489
|
+
beaconProxyFactory: "0x7cf8cf276450bd568187fdc0b0959d30ec599853",
|
|
490
|
+
feeRegistry: "0xaba1A2e157Dae248f8630cA550bd826725Ff745c",
|
|
491
|
+
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
492
|
+
wrappedNative: "0x6969696969696969696969696969696969696969"
|
|
493
|
+
},
|
|
494
|
+
[146 /* SonicMainnet */]: {
|
|
495
|
+
beaconProxyFactory: "0x99CD0b8b32B15922f0754Fddc21323b5278c5261",
|
|
496
|
+
feeRegistry: "0xab4aC28D10a4Bc279aD073B1D74Bfa0E385C010C",
|
|
497
|
+
v0_5_0: "0xE50554ec802375C9c3F9c087a8a7bb8C26d3DEDf",
|
|
498
|
+
wrappedNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38"
|
|
499
|
+
},
|
|
500
|
+
[5000 /* MantleMainnet */]: {
|
|
501
|
+
beaconProxyFactory: "0x57D969B556C6AebB3Ac8f54c98CF3a3f921d5659",
|
|
502
|
+
feeRegistry: "0x47A144e67834408716cB40Fa87fc886D63362ddC",
|
|
503
|
+
v0_4_0: "0xA7260Cee56B679eC05a736A7b603b8DA8525Dd69",
|
|
504
|
+
wrappedNative: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"
|
|
505
|
+
},
|
|
506
|
+
[480 /* WorldChainMainnet */]: {
|
|
507
|
+
beaconProxyFactory: "0x600fA26581771F56221FC9847A834B3E5fd34AF7",
|
|
508
|
+
feeRegistry: "0x68e793658def657551fd4D3cA6Bc04b4E7723655",
|
|
509
|
+
v0_5_0: "0x1D42DbDde553F4099691A25F712bbd8f2686E355 ",
|
|
510
|
+
wrappedNative: "0x4200000000000000000000000000000000000006"
|
|
511
|
+
},
|
|
512
|
+
[43114 /* AvalancheMainnet */]: {
|
|
513
|
+
beaconProxyFactory: "0x5e231c6d030a5c0f51fa7d0f891d3f50a928c685",
|
|
514
|
+
feeRegistry: "0xD7F69ba99c6981Eab5579Aa16871Ae94c509d578",
|
|
515
|
+
v0_5_0: "0x33F65C8D025b5418C7f8dd248C2Ec1d31881D465",
|
|
516
|
+
wrappedNative: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
export {
|
|
520
|
+
resolveVersion,
|
|
521
|
+
addresses,
|
|
522
|
+
Version,
|
|
523
|
+
VaultUtils,
|
|
524
|
+
Vault,
|
|
525
|
+
Token,
|
|
526
|
+
Test,
|
|
527
|
+
State,
|
|
528
|
+
NATIVE_ADDRESS,
|
|
529
|
+
MathLib,
|
|
530
|
+
LATEST_VERSION,
|
|
531
|
+
ChainUtils,
|
|
532
|
+
ChainId
|
|
533
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { BigIntish } from "../types";
|
|
2
|
+
export type RoundingDirection = "Up" | "Down";
|
|
3
|
+
/**
|
|
4
|
+
* Library to manage fixed-point arithmetic.
|
|
5
|
+
* https://github.com/morpho-org/morpho-blue/blob/main/src/libraries/MathLib.sol
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace MathLib {
|
|
8
|
+
const WAD = 1000000000000000000n;
|
|
9
|
+
const RAY = 1000000000000000000000000000n;
|
|
10
|
+
const MAX_UINT_256: bigint;
|
|
11
|
+
const MAX_UINT_160: bigint;
|
|
12
|
+
const MAX_UINT_128: bigint;
|
|
13
|
+
const MAX_UINT_48: bigint;
|
|
14
|
+
function maxUint(nBits: number): bigint;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the absolute value of a number
|
|
17
|
+
* @param a The number
|
|
18
|
+
*/
|
|
19
|
+
function abs(a: BigIntish): bigint;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the smallest number given as param
|
|
22
|
+
* @param x The first number
|
|
23
|
+
* @param y The second number
|
|
24
|
+
*/
|
|
25
|
+
function min(...xs: BigIntish[]): bigint;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the greatest number given as param
|
|
28
|
+
* @param x The first number
|
|
29
|
+
* @param y The second number
|
|
30
|
+
*/
|
|
31
|
+
function max(...xs: BigIntish[]): bigint;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the subtraction of b from a, floored to zero if negative
|
|
34
|
+
* @param x The first number
|
|
35
|
+
* @param y The second number
|
|
36
|
+
*/
|
|
37
|
+
function zeroFloorSub(x: BigIntish, y: BigIntish): bigint;
|
|
38
|
+
/**
|
|
39
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded down
|
|
40
|
+
* @param x The first number
|
|
41
|
+
* @param y The second number
|
|
42
|
+
*/
|
|
43
|
+
function wMulDown(x: BigIntish, y: BigIntish): bigint;
|
|
44
|
+
/**
|
|
45
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded up
|
|
46
|
+
* @param x The first number
|
|
47
|
+
* @param y The second number
|
|
48
|
+
*/
|
|
49
|
+
function wMulUp(x: BigIntish, y: BigIntish): bigint;
|
|
50
|
+
/**
|
|
51
|
+
* Perform the WAD-based multiplication of 2 numbers with a provided rounding direction
|
|
52
|
+
* @param x The first number
|
|
53
|
+
* @param y The second number
|
|
54
|
+
*/
|
|
55
|
+
function wMul(x: BigIntish, y: BigIntish, rounding: RoundingDirection): bigint;
|
|
56
|
+
/**
|
|
57
|
+
* Perform the WAD-based division of 2 numbers, rounded down
|
|
58
|
+
* @param x The first number
|
|
59
|
+
* @param y The second number
|
|
60
|
+
*/
|
|
61
|
+
function wDivDown(x: BigIntish, y: BigIntish): bigint;
|
|
62
|
+
/**
|
|
63
|
+
* Perform the WAD-based multiplication of 2 numbers, rounded up
|
|
64
|
+
* @param x The first number
|
|
65
|
+
* @param y The second number
|
|
66
|
+
*/
|
|
67
|
+
function wDivUp(x: BigIntish, y: BigIntish): bigint;
|
|
68
|
+
/**
|
|
69
|
+
* Perform the WAD-based multiplication of 2 numbers with a provided rounding direction
|
|
70
|
+
* @param x The first number
|
|
71
|
+
* @param y The second number
|
|
72
|
+
*/
|
|
73
|
+
function wDiv(x: BigIntish, y: BigIntish, rounding: RoundingDirection): bigint;
|
|
74
|
+
/**
|
|
75
|
+
* Multiply two numbers and divide by a denominator, rounding down the result
|
|
76
|
+
* @param x The first number
|
|
77
|
+
* @param y The second number
|
|
78
|
+
* @param denominator The denominator
|
|
79
|
+
*/
|
|
80
|
+
function mulDivDown(x: BigIntish, y: BigIntish, denominator: BigIntish): bigint;
|
|
81
|
+
/**
|
|
82
|
+
* Multiply two numbers and divide by a denominator, rounding up the result
|
|
83
|
+
* @param x The first number
|
|
84
|
+
* @param y The second number
|
|
85
|
+
* @param denominator The denominator
|
|
86
|
+
*/
|
|
87
|
+
function mulDivUp(x: BigIntish, y: BigIntish, denominator: BigIntish): bigint;
|
|
88
|
+
function mulDiv(x: BigIntish, y: BigIntish, denominator: BigIntish, rounding: RoundingDirection): bigint;
|
|
89
|
+
/**
|
|
90
|
+
* The sum of the first three non-zero terms of a Taylor expansion of e^(nx) - 1,
|
|
91
|
+
* to approximate a continuously compounded interest rate.
|
|
92
|
+
*
|
|
93
|
+
* @param x The base of the exponent
|
|
94
|
+
* @param n The exponent
|
|
95
|
+
*/
|
|
96
|
+
function wTaylorCompounded(x: BigIntish, n: BigIntish): bigint;
|
|
97
|
+
/**
|
|
98
|
+
* Converts a WAD-based quantity to a RAY-based quantity.
|
|
99
|
+
* @param x The WAD-based quantity.
|
|
100
|
+
*/
|
|
101
|
+
function wToRay(x: BigIntish): bigint;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=MathLib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MathLib.d.ts","sourceRoot":"","sources":["../../src/math/MathLib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9C;;;GAGG;AACH,yBAAiB,OAAO,CAAC;IAChB,MAAM,GAAG,uBAAwB,CAAC;IAClC,MAAM,GAAG,gCAAiC,CAAC;IAE3C,MAAM,YAAY,QAAe,CAAC;IAClC,MAAM,YAAY,QAAe,CAAC;IAClC,MAAM,YAAY,QAAe,CAAC;IAClC,MAAM,WAAW,QAAc,CAAC;IAEvC,SAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,UAIpC;IAED;;;OAGG;IACH,SAAgB,GAAG,CAAC,CAAC,EAAE,SAAS,UAI/B;IAED;;;;OAIG;IACH,SAAgB,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAErC;IAED;;;;OAIG;IACH,SAAgB,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,UAErC;IAED;;;;OAIG;IACH,SAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAKtD;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAElD;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAEhD;IAED;;;;OAIG;IACH,SAAgB,IAAI,CAClB,CAAC,EAAE,SAAS,EACZ,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,iBAAiB,UAG5B;IAED;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAElD;IAED;;;;OAIG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAEhD;IAED;;;;OAIG;IACH,SAAgB,IAAI,CAClB,CAAC,EAAE,SAAS,EACZ,CAAC,EAAE,SAAS,EACZ,QAAQ,EAAE,iBAAiB,UAG5B;IAED;;;;;OAKG;IACH,SAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,CAAC,EAAE,SAAS,EACZ,WAAW,EAAE,SAAS,UAQvB;IAED;;;;;OAKG;IACH,SAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,UAS1E;IAED,SAAgB,MAAM,CACpB,CAAC,EAAE,SAAS,EACZ,CAAC,EAAE,SAAS,EACZ,WAAW,EAAE,SAAS,EACtB,QAAQ,EAAE,iBAAiB,UAG5B;IAED;;;;;;OAMG;IACH,SAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,UAc3D;IAED;;;OAGG;IACH,SAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,UAElC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type RoundingDirection } from "../math/index";
|
|
2
|
+
import type { Address, BigIntish } from "../types";
|
|
3
|
+
export interface IToken {
|
|
4
|
+
address: Address;
|
|
5
|
+
name?: string;
|
|
6
|
+
symbol?: string;
|
|
7
|
+
decimals?: BigIntish;
|
|
8
|
+
price?: BigIntish;
|
|
9
|
+
totalSupply: bigint;
|
|
10
|
+
}
|
|
11
|
+
export declare class Test {
|
|
12
|
+
}
|
|
13
|
+
export declare class Token implements IToken {
|
|
14
|
+
/**
|
|
15
|
+
* The token's address.
|
|
16
|
+
*/
|
|
17
|
+
readonly address: Address;
|
|
18
|
+
/**
|
|
19
|
+
* The token's name.
|
|
20
|
+
*/
|
|
21
|
+
readonly name?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The token's symbol.
|
|
24
|
+
*/
|
|
25
|
+
readonly symbol?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The token's number of decimals. Defaults to 0.
|
|
28
|
+
*/
|
|
29
|
+
readonly decimals: number;
|
|
30
|
+
/**
|
|
31
|
+
* The vault's total supply of shares.
|
|
32
|
+
*/
|
|
33
|
+
totalSupply: bigint;
|
|
34
|
+
/**
|
|
35
|
+
* Price of the token in USD (scaled by WAD).
|
|
36
|
+
*/
|
|
37
|
+
price?: bigint;
|
|
38
|
+
constructor({ address, name, symbol, decimals, totalSupply, price, }: IToken);
|
|
39
|
+
/**
|
|
40
|
+
* Quotes an amount in USD (scaled by WAD) in this token.
|
|
41
|
+
* Returns `undefined` iff the token's price is undefined.
|
|
42
|
+
* @param amount The amount of USD to quote.
|
|
43
|
+
*/
|
|
44
|
+
fromUsd(amount: bigint, rounding?: RoundingDirection): bigint | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Quotes an amount of tokens in USD (scaled by WAD).
|
|
47
|
+
* Returns `undefined` iff the token's price is undefined.
|
|
48
|
+
* @param amount The amount of tokens to quote.
|
|
49
|
+
*/
|
|
50
|
+
toUsd(amount: bigint, rounding?: RoundingDirection): bigint | undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=Token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Token.d.ts","sourceRoot":"","sources":["../../src/token/Token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,IAAI;CAAI;AAErB,qBAAa,KAAM,YAAW,MAAM;IAClC;;OAEG;IACH,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAE9B;;OAEG;IACH,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC;;QAEI;IACG,WAAW,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACI,KAAK,CAAC,EAAE,MAAM,CAAC;gBAGV,EACV,OAAO,EACP,IAAI,EACJ,MAAM,EACN,QAAY,EACZ,WAAW,EACX,KAAK,GACN,EAAE,MAAM;IAUT;;;;OAIG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,iBAA0B;IAW5D;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,iBAA0B;CAU3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/token/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,MAAM,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type RoundingDirection } from "../math";
|
|
2
|
+
import { type IToken, Token } from "../token/Token";
|
|
3
|
+
import { type Address } from "../types";
|
|
4
|
+
export declare enum Version {
|
|
5
|
+
v0_5_0 = "v0.5.0",
|
|
6
|
+
v0_4_0 = "v0.4.0",
|
|
7
|
+
v0_3_0 = "v0.3.0",
|
|
8
|
+
v0_2_0 = "v0.2.0",
|
|
9
|
+
v0_1_0 = "v0.1.0"
|
|
10
|
+
}
|
|
11
|
+
export declare const LATEST_VERSION = Version.v0_5_0;
|
|
12
|
+
export type VersionOrLatest = Version | "latest";
|
|
13
|
+
export declare function resolveVersion(version: VersionOrLatest): Version;
|
|
14
|
+
export declare enum State {
|
|
15
|
+
Open = 0,
|
|
16
|
+
Closing = 1,
|
|
17
|
+
Closed = 2
|
|
18
|
+
}
|
|
19
|
+
export interface Rates {
|
|
20
|
+
managementRate: number;
|
|
21
|
+
performanceRate: number;
|
|
22
|
+
}
|
|
23
|
+
export interface IVault extends IToken {
|
|
24
|
+
asset: Address;
|
|
25
|
+
underlyingDecimals: number;
|
|
26
|
+
owner: Address;
|
|
27
|
+
pendingOwner: Address;
|
|
28
|
+
whitelistManager: Address;
|
|
29
|
+
feeReceiver: Address;
|
|
30
|
+
safe: Address;
|
|
31
|
+
feeRegistry: Address;
|
|
32
|
+
valuationManager: Address;
|
|
33
|
+
newRatesTimestamp: bigint;
|
|
34
|
+
lastFeeTime: bigint;
|
|
35
|
+
highWaterMark: bigint;
|
|
36
|
+
cooldown: bigint;
|
|
37
|
+
feeRates: Rates;
|
|
38
|
+
totalAssets: bigint;
|
|
39
|
+
newTotalAssets: bigint;
|
|
40
|
+
depositEpochId: number;
|
|
41
|
+
depositSettleId: number;
|
|
42
|
+
lastDepositEpochIdSettled: number;
|
|
43
|
+
redeemEpochId: number;
|
|
44
|
+
redeemSettleId: number;
|
|
45
|
+
lastRedeemEpochIdSettled: number;
|
|
46
|
+
pendingSilo: Address;
|
|
47
|
+
wrappedNativeToken: Address;
|
|
48
|
+
decimals: number;
|
|
49
|
+
decimalsOffset: number;
|
|
50
|
+
totalAssetsExpiration: bigint;
|
|
51
|
+
totalAssetsLifespan: bigint;
|
|
52
|
+
state: State;
|
|
53
|
+
isWhitelistActivated: boolean;
|
|
54
|
+
version: Version;
|
|
55
|
+
}
|
|
56
|
+
export declare class Vault extends Token implements IVault {
|
|
57
|
+
readonly asset: Address;
|
|
58
|
+
readonly underlyingDecimals: number;
|
|
59
|
+
readonly totalAssets: bigint;
|
|
60
|
+
readonly newTotalAssets: bigint;
|
|
61
|
+
readonly depositEpochId: number;
|
|
62
|
+
readonly depositSettleId: number;
|
|
63
|
+
readonly lastDepositEpochIdSettled: number;
|
|
64
|
+
readonly redeemEpochId: number;
|
|
65
|
+
readonly redeemSettleId: number;
|
|
66
|
+
readonly lastRedeemEpochIdSettled: number;
|
|
67
|
+
readonly pendingSilo: Address;
|
|
68
|
+
readonly wrappedNativeToken: Address;
|
|
69
|
+
readonly decimalsOffset: number;
|
|
70
|
+
readonly totalAssetsExpiration: bigint;
|
|
71
|
+
readonly totalAssetsLifespan: bigint;
|
|
72
|
+
readonly feeRegistry: Address;
|
|
73
|
+
readonly newRatesTimestamp: bigint;
|
|
74
|
+
readonly lastFeeTime: bigint;
|
|
75
|
+
readonly highWaterMark: bigint;
|
|
76
|
+
readonly cooldown: bigint;
|
|
77
|
+
readonly feeRates: Rates;
|
|
78
|
+
readonly owner: Address;
|
|
79
|
+
readonly pendingOwner: Address;
|
|
80
|
+
readonly whitelistManager: Address;
|
|
81
|
+
readonly feeReceiver: Address;
|
|
82
|
+
readonly safe: Address;
|
|
83
|
+
readonly valuationManager: Address;
|
|
84
|
+
readonly state: State;
|
|
85
|
+
readonly isWhitelistActivated: boolean;
|
|
86
|
+
readonly version: Version;
|
|
87
|
+
constructor({ asset, underlyingDecimals, totalAssets, newTotalAssets, depositEpochId, depositSettleId, lastDepositEpochIdSettled, redeemEpochId, redeemSettleId, lastRedeemEpochIdSettled, pendingSilo, wrappedNativeToken, decimalsOffset, totalAssetsExpiration, totalAssetsLifespan, feeRegistry, newRatesTimestamp, lastFeeTime, highWaterMark, cooldown, feeRates, owner, pendingOwner, whitelistManager, feeReceiver, safe, valuationManager, state, isWhitelistActivated, version, ...config }: IVault);
|
|
88
|
+
convertToAssets(shares: bigint, rounding?: RoundingDirection): bigint;
|
|
89
|
+
convertToShares(assets: bigint, rounding?: RoundingDirection): bigint;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=Vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vault.d.ts","sourceRoot":"","sources":["../../src/vault/Vault.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RoundingDirection } from "../math/index.js";
|
|
2
|
+
import type { BigIntish } from "../types.js";
|
|
3
|
+
export declare namespace VaultUtils {
|
|
4
|
+
const VIRTUAL_ASSETS = 1n;
|
|
5
|
+
const ONE_SHARE: bigint;
|
|
6
|
+
function decimalsOffset(decimals: BigIntish): bigint;
|
|
7
|
+
function convertToAssets(shares: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: {
|
|
8
|
+
totalAssets: BigIntish;
|
|
9
|
+
totalSupply: BigIntish;
|
|
10
|
+
decimalsOffset: BigIntish;
|
|
11
|
+
}, rounding?: RoundingDirection): bigint;
|
|
12
|
+
function convertToShares(assets: BigIntish, { totalAssets, totalSupply, decimalsOffset, }: {
|
|
13
|
+
totalAssets: BigIntish;
|
|
14
|
+
totalSupply: BigIntish;
|
|
15
|
+
decimalsOffset: BigIntish;
|
|
16
|
+
}, rounding?: RoundingDirection): bigint;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=VaultUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VaultUtils.d.ts","sourceRoot":"","sources":["../../src/vault/VaultUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,yBAAiB,UAAU,CAAC;IACnB,MAAM,cAAc,KAAK,CAAC;IAE1B,MAAM,SAAS,QAAa,CAAC;IAEpC,SAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,UAEjD;IAED,SAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,EACE,WAAW,EACX,WAAW,EACX,cAAc,GACf,EAAE;QACD,WAAW,EAAE,SAAS,CAAC;QACvB,WAAW,EAAE,SAAS,CAAC;QACvB,cAAc,EAAE,SAAS,CAAC;KAC3B,EACD,QAAQ,GAAE,iBAA0B,UAQrC;IACD,SAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,EACE,WAAW,EACX,WAAW,EACX,cAAc,GACf,EAAE;QACD,WAAW,EAAE,SAAS,CAAC;QACvB,WAAW,EAAE,SAAS,CAAC;QACvB,cAAc,EAAE,SAAS,CAAC;KAC3B,EACD,QAAQ,GAAE,iBAAwB,UAQnC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vault/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lagoon-protocol/v0-core",
|
|
3
|
+
"description": "Framework-agnostic package that defines Lagoon related entity classes (such as Vault)",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"module": "src/index.ts",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"../../LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -p tsconfig.json && bun build ./src/index.ts --outdir ./dist --target node --format esm",
|
|
23
|
+
"test": "bun test",
|
|
24
|
+
"dev": "bun run --watch src/index.ts"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/bun": "latest"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"typescript": "^5"
|
|
31
|
+
},
|
|
32
|
+
"private": false,
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"tag": "next",
|
|
35
|
+
"main": "lib/index.js",
|
|
36
|
+
"types": "lib/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
}
|