@usdu-core/usdu-core 0.0.1
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/.claude/settings.local.json +12 -0
- package/.env.example +6 -0
- package/.prettierrc.json +7 -0
- package/LICENSE +674 -0
- package/README.md +244 -0
- package/contracts/curve/CurveAdapterV1.sol +310 -0
- package/contracts/curve/CurveAdapterV1_1.sol +198 -0
- package/contracts/curve/helpers/ICurveStableSwapNG.json +566 -0
- package/contracts/curve/helpers/ICurveStableSwapNG.sol +177 -0
- package/contracts/deploy/VaultDeployer.sol +110 -0
- package/contracts/morpho/MorphoAdapterV1.sol +255 -0
- package/contracts/morpho/MorphoAdapterV1_1.sol +137 -0
- package/contracts/morpho/MorphoAdapterV1_2.sol +126 -0
- package/contracts/morpho/helpers/AggregatorV3Interface.sol +24 -0
- package/contracts/morpho/helpers/ChainlinkDataFeedLib.sol +36 -0
- package/contracts/morpho/helpers/ConstantsLib.sol +20 -0
- package/contracts/morpho/helpers/ErrorsLib.sol +17 -0
- package/contracts/morpho/helpers/IERC4626.sol +6 -0
- package/contracts/morpho/helpers/IMetaMorphoV1_1.sol +229 -0
- package/contracts/morpho/helpers/IMetaMorphoV1_1Factory.sol +32 -0
- package/contracts/morpho/helpers/IMorpho.sol +361 -0
- package/contracts/morpho/helpers/IMorphoCallbacks.sol +52 -0
- package/contracts/morpho/helpers/IMorphoChainlinkOracleV2.sol +39 -0
- package/contracts/morpho/helpers/IMorphoChainlinkOracleV2Factory.sol +56 -0
- package/contracts/morpho/helpers/IOracle.sol +15 -0
- package/contracts/morpho/helpers/MarketParamsLib.sol +21 -0
- package/contracts/morpho/helpers/MathLib.sol +45 -0
- package/contracts/morpho/helpers/Morpho.sol.bak +517 -0
- package/contracts/morpho/helpers/MorphoChainlinkOracleV2.sol +157 -0
- package/contracts/morpho/helpers/PendingLib.sol +47 -0
- package/contracts/morpho/helpers/SharesMathLib.sol +45 -0
- package/contracts/morpho/helpers/VaultLib.sol +18 -0
- package/contracts/reward/RewardDistributionV1.sol +110 -0
- package/contracts/reward/RewardRouterV0.sol +63 -0
- package/contracts/reward/Rewards.example.json +72 -0
- package/contracts/stablecoin/IStablecoin.sol +211 -0
- package/contracts/stablecoin/IStablecoinMetadata.sol +27 -0
- package/contracts/stablecoin/IStablecoinModifier.sol +52 -0
- package/contracts/stablecoin/Stablecoin.sol +376 -0
- package/contracts/stablecoin/libraries/ConstantsLib.sol +13 -0
- package/contracts/stablecoin/libraries/ErrorsLib.sol +45 -0
- package/contracts/stablecoin/libraries/EventsLib.sol +74 -0
- package/contracts/stablecoin/libraries/PendingLib.sol +38 -0
- package/contracts/vault/VaultAdapterRecoverV1.sol +29 -0
- package/contracts/vault/VaultAdapterV1.sol +126 -0
- package/dist/index.d.mts +16154 -0
- package/dist/index.d.ts +16154 -0
- package/dist/index.js +21134 -0
- package/dist/index.mjs +21061 -0
- package/docs/CoreVault: Integration of new Markets.md +197 -0
- package/docs/CoreVault: SupplyQueue.md +11 -0
- package/docs/Markets USDC Vault.md +35 -0
- package/docs/Markets USDU Vault.md +89 -0
- package/docs/Markets WETH Vault.md +35 -0
- package/docs/Overview.drawio +117 -0
- package/exports/abis/curve/CurveAdapterV1.ts +599 -0
- package/exports/abis/curve/CurveAdapterV1_1.ts +609 -0
- package/exports/abis/curve/CurveAdapterV1_2.ts +721 -0
- package/exports/abis/curve/helper/ICurveStableSwapNG.ts +1589 -0
- package/exports/abis/morpho/MorphoAdapterV1.ts +516 -0
- package/exports/abis/morpho/MorphoAdapterV1_1.ts +489 -0
- package/exports/abis/morpho/MorphoAdapterV1_2.ts +459 -0
- package/exports/abis/morpho/helper/AggregatorV3Interface.ts +113 -0
- package/exports/abis/morpho/helper/IMetaMorphoV1_1.ts +1483 -0
- package/exports/abis/morpho/helper/IMetaMorphoV1_1Base.ts +607 -0
- package/exports/abis/morpho/helper/IMetaMorphoV1_1StaticTyping.ts +696 -0
- package/exports/abis/morpho/helper/IMorpho.ts +1024 -0
- package/exports/abis/morpho/helper/IMorphoBase.ts +886 -0
- package/exports/abis/morpho/helper/IMorphoChainlinkOracleV2.ts +132 -0
- package/exports/abis/morpho/helper/IMorphoChainlinkOracleV2Factory.ts +109 -0
- package/exports/abis/morpho/helper/IMorphoFlashLoanCallback.ts +20 -0
- package/exports/abis/morpho/helper/IMorphoLiquidateCallback.ts +20 -0
- package/exports/abis/morpho/helper/IMorphoRepayCallback.ts +20 -0
- package/exports/abis/morpho/helper/IMorphoStaticTyping.ts +1003 -0
- package/exports/abis/morpho/helper/IMorphoSupplyCallback.ts +20 -0
- package/exports/abis/morpho/helper/IMorphoSupplyCollateralCallback.ts +20 -0
- package/exports/abis/morpho/helper/IMulticall.ts +21 -0
- package/exports/abis/morpho/helper/IOracle.ts +15 -0
- package/exports/abis/morpho/helper/IOwnable.ts +55 -0
- package/exports/abis/morpho/helper/MorphoChainlinkOracleV2.ts +188 -0
- package/exports/abis/openzeppelin/ERC20.ts +310 -0
- package/exports/abis/openzeppelin/ERC20Permit.ts +520 -0
- package/exports/abis/openzeppelin/IERC20.ts +185 -0
- package/exports/abis/openzeppelin/IERC20Metadata.ts +224 -0
- package/exports/abis/openzeppelin/IERC20Permit.ts +77 -0
- package/exports/abis/openzeppelin/IERC4626.ts +614 -0
- package/exports/abis/reward/RewardDistributionV1.ts +246 -0
- package/exports/abis/stablecoin/ErrorsLib.ts +114 -0
- package/exports/abis/stablecoin/EventsLib.ts +372 -0
- package/exports/abis/stablecoin/IStablecoin.ts +642 -0
- package/exports/abis/stablecoin/IStablecoinMetadata.ts +856 -0
- package/exports/abis/stablecoin/IStablecoinModifier.ts +15 -0
- package/exports/abis/stablecoin/Stablecoin.ts +1922 -0
- package/exports/abis/termmax/ITermMaxVault.ts +2335 -0
- package/exports/abis/vault/VaultAdapterRecoverV1.ts +490 -0
- package/exports/abis/vault/VaultAdapterV1.ts +459 -0
- package/exports/address.config.ts +113 -0
- package/exports/address.types.ts +130 -0
- package/exports/index.ts +61 -0
- package/hardhat.config.ts +231 -0
- package/helper/store.args.ts +17 -0
- package/helper/wallet.info.ts +3 -0
- package/helper/wallet.ts +41 -0
- package/install-macos.sh +46 -0
- package/package.json +73 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +10 -0
package/exports/index.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// helpers
|
|
2
|
+
export * from '../helper/wallet';
|
|
3
|
+
|
|
4
|
+
// address config and types
|
|
5
|
+
export * from './address.config';
|
|
6
|
+
export * from './address.types';
|
|
7
|
+
|
|
8
|
+
// curve abis
|
|
9
|
+
export * from './abis/curve/CurveAdapterV1';
|
|
10
|
+
export * from './abis/curve/CurveAdapterV1_1';
|
|
11
|
+
export * from './abis/curve/CurveAdapterV1_2';
|
|
12
|
+
export * from './abis/curve/helper/ICurveStableSwapNG';
|
|
13
|
+
|
|
14
|
+
// morpho abis
|
|
15
|
+
export * from './abis/morpho/MorphoAdapterV1';
|
|
16
|
+
export * from './abis/morpho/MorphoAdapterV1_1';
|
|
17
|
+
export * from './abis/morpho/MorphoAdapterV1_2';
|
|
18
|
+
export * from './abis/morpho/helper/AggregatorV3Interface';
|
|
19
|
+
export * from './abis/morpho/helper/IMetaMorphoV1_1';
|
|
20
|
+
export * from './abis/morpho/helper/IMetaMorphoV1_1Base';
|
|
21
|
+
export * from './abis/morpho/helper/IMetaMorphoV1_1StaticTyping';
|
|
22
|
+
export * from './abis/morpho/helper/IMorpho';
|
|
23
|
+
export * from './abis/morpho/helper/IMorphoBase';
|
|
24
|
+
export * from './abis/morpho/helper/IMorphoChainlinkOracleV2';
|
|
25
|
+
export * from './abis/morpho/helper/IMorphoChainlinkOracleV2Factory';
|
|
26
|
+
export * from './abis/morpho/helper/IMorphoFlashLoanCallback';
|
|
27
|
+
export * from './abis/morpho/helper/IMorphoLiquidateCallback';
|
|
28
|
+
export * from './abis/morpho/helper/IMorphoRepayCallback';
|
|
29
|
+
export * from './abis/morpho/helper/IMorphoStaticTyping';
|
|
30
|
+
export * from './abis/morpho/helper/IMorphoSupplyCallback';
|
|
31
|
+
export * from './abis/morpho/helper/IMorphoSupplyCollateralCallback';
|
|
32
|
+
export * from './abis/morpho/helper/IMulticall';
|
|
33
|
+
export * from './abis/morpho/helper/IOracle';
|
|
34
|
+
export * from './abis/morpho/helper/IOwnable';
|
|
35
|
+
export * from './abis/morpho/helper/MorphoChainlinkOracleV2';
|
|
36
|
+
|
|
37
|
+
// openzeppelin abis
|
|
38
|
+
export * from './abis/openzeppelin/ERC20';
|
|
39
|
+
export * from './abis/openzeppelin/ERC20Permit';
|
|
40
|
+
export * from './abis/openzeppelin/IERC20';
|
|
41
|
+
export * from './abis/openzeppelin/IERC20Metadata';
|
|
42
|
+
export * from './abis/openzeppelin/IERC20Permit';
|
|
43
|
+
export * from './abis/openzeppelin/IERC4626';
|
|
44
|
+
|
|
45
|
+
// reward abis
|
|
46
|
+
export * from './abis/reward/RewardDistributionV1';
|
|
47
|
+
|
|
48
|
+
// stablecoin abis
|
|
49
|
+
export * from './abis/stablecoin/ErrorsLib';
|
|
50
|
+
export * from './abis/stablecoin/EventsLib';
|
|
51
|
+
export * from './abis/stablecoin/IStablecoin';
|
|
52
|
+
export * from './abis/stablecoin/IStablecoinMetadata';
|
|
53
|
+
export * from './abis/stablecoin/IStablecoinModifier';
|
|
54
|
+
export * from './abis/stablecoin/Stablecoin';
|
|
55
|
+
|
|
56
|
+
// termmax abis
|
|
57
|
+
export * from './abis/termmax/ITermMaxVault';
|
|
58
|
+
|
|
59
|
+
// vault abis
|
|
60
|
+
export * from './abis/vault/VaultAdapterRecoverV1';
|
|
61
|
+
export * from './abis/vault/VaultAdapterV1';
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import '@nomicfoundation/hardhat-ethers';
|
|
2
|
+
import '@nomicfoundation/hardhat-verify';
|
|
3
|
+
import '@nomicfoundation/hardhat-toolbox';
|
|
4
|
+
import '@nomicfoundation/hardhat-network-helpers';
|
|
5
|
+
import '@nomicfoundation/hardhat-ignition-ethers';
|
|
6
|
+
import 'hardhat-deploy';
|
|
7
|
+
import 'hardhat-abi-exporter';
|
|
8
|
+
import 'hardhat-contract-sizer';
|
|
9
|
+
import { HardhatUserConfig } from 'hardhat/config';
|
|
10
|
+
import { getChildFromSeed } from './helper/wallet';
|
|
11
|
+
|
|
12
|
+
import dotenv from 'dotenv';
|
|
13
|
+
dotenv.config();
|
|
14
|
+
|
|
15
|
+
import * as tdly from '@tenderly/hardhat-tenderly';
|
|
16
|
+
import { tenderly } from 'hardhat';
|
|
17
|
+
|
|
18
|
+
// ---------------------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
const indexParsed = process.env.DEPLOYER_SEED_INDEX;
|
|
21
|
+
const index = indexParsed && indexParsed?.length > 0 ? parseInt(indexParsed) : 0;
|
|
22
|
+
|
|
23
|
+
const seed = process.env.DEPLOYER_SEED;
|
|
24
|
+
if (!seed) throw new Error('Failed to import the seed string from .env');
|
|
25
|
+
const wallet = getChildFromSeed(seed, index); // deployer
|
|
26
|
+
|
|
27
|
+
// log infos
|
|
28
|
+
console.log('### Deployer Wallet ###');
|
|
29
|
+
console.log(wallet.address, `index: `, wallet.index);
|
|
30
|
+
|
|
31
|
+
const alchemy = process.env.ALCHEMY_RPC_KEY;
|
|
32
|
+
if (alchemy?.length == 0 || !alchemy) console.log('WARN: No Alchemy Key found in .env');
|
|
33
|
+
|
|
34
|
+
const etherscan = process.env.ETHERSCAN_API;
|
|
35
|
+
if (etherscan?.length == 0 || !etherscan) console.log('WARN: No Etherscan Key found in .env');
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
const config: HardhatUserConfig = {
|
|
40
|
+
solidity: {
|
|
41
|
+
version: '0.8.20',
|
|
42
|
+
settings: {
|
|
43
|
+
optimizer: {
|
|
44
|
+
enabled: true,
|
|
45
|
+
runs: 200,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
tenderly: {
|
|
50
|
+
project: process.env.TENDERLY_PROJECT ?? '',
|
|
51
|
+
username: process.env.TENDERLY_USERNAME ?? '',
|
|
52
|
+
privateVerification: true,
|
|
53
|
+
},
|
|
54
|
+
networks: {
|
|
55
|
+
mainnet: {
|
|
56
|
+
url: `https://eth-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
57
|
+
chainId: 1,
|
|
58
|
+
gas: 'auto',
|
|
59
|
+
gasPrice: 'auto',
|
|
60
|
+
gasMultiplier: 0.5,
|
|
61
|
+
accounts: [wallet.privateKey],
|
|
62
|
+
timeout: 50_000,
|
|
63
|
+
},
|
|
64
|
+
hardhat: {
|
|
65
|
+
forking: {
|
|
66
|
+
url: `https://eth-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
67
|
+
blockNumber: 23599470,
|
|
68
|
+
},
|
|
69
|
+
gas: 'auto',
|
|
70
|
+
gasPrice: 'auto',
|
|
71
|
+
initialBaseFeePerGas: 100000000,
|
|
72
|
+
gasMultiplier: 2,
|
|
73
|
+
},
|
|
74
|
+
tenderly: {
|
|
75
|
+
url: process.env.TENDERLY_RPC_URL,
|
|
76
|
+
chainId: 42069,
|
|
77
|
+
gas: 'auto',
|
|
78
|
+
gasPrice: 'auto',
|
|
79
|
+
accounts: [wallet.privateKey],
|
|
80
|
+
timeout: 50_000,
|
|
81
|
+
},
|
|
82
|
+
sepolia: {
|
|
83
|
+
url: `https://eth-sepolia.g.alchemy.com/v2/${alchemy}`,
|
|
84
|
+
chainId: 11155111,
|
|
85
|
+
gas: 'auto',
|
|
86
|
+
gasPrice: 'auto',
|
|
87
|
+
accounts: [wallet.privateKey],
|
|
88
|
+
timeout: 50_000,
|
|
89
|
+
},
|
|
90
|
+
polygon: {
|
|
91
|
+
url: `https://polygon-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
92
|
+
chainId: 137,
|
|
93
|
+
gas: 'auto',
|
|
94
|
+
gasPrice: 'auto',
|
|
95
|
+
accounts: [wallet.privateKey],
|
|
96
|
+
timeout: 50_000,
|
|
97
|
+
},
|
|
98
|
+
optimism: {
|
|
99
|
+
url: `https://opt-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
100
|
+
chainId: 10,
|
|
101
|
+
gas: 'auto',
|
|
102
|
+
gasPrice: 'auto',
|
|
103
|
+
accounts: [wallet.privateKey],
|
|
104
|
+
timeout: 50_000,
|
|
105
|
+
},
|
|
106
|
+
arbitrum: {
|
|
107
|
+
url: `https://arb-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
108
|
+
chainId: 42161,
|
|
109
|
+
gas: 'auto',
|
|
110
|
+
gasPrice: 'auto',
|
|
111
|
+
accounts: [wallet.privateKey],
|
|
112
|
+
timeout: 50_000,
|
|
113
|
+
},
|
|
114
|
+
base: {
|
|
115
|
+
url: `https://base-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
116
|
+
chainId: 8453,
|
|
117
|
+
gas: 'auto',
|
|
118
|
+
gasPrice: 'auto',
|
|
119
|
+
accounts: [wallet.privateKey],
|
|
120
|
+
timeout: 50_000,
|
|
121
|
+
},
|
|
122
|
+
avalanche: {
|
|
123
|
+
url: `https://avax-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
124
|
+
chainId: 43114,
|
|
125
|
+
gas: 'auto',
|
|
126
|
+
gasPrice: 'auto',
|
|
127
|
+
accounts: [wallet.privateKey],
|
|
128
|
+
timeout: 50_000,
|
|
129
|
+
},
|
|
130
|
+
gnosis: {
|
|
131
|
+
url: `https://gnosis-mainnet.g.alchemy.com/v2/${alchemy}`,
|
|
132
|
+
chainId: 100,
|
|
133
|
+
gas: 'auto',
|
|
134
|
+
gasPrice: 'auto',
|
|
135
|
+
accounts: [wallet.privateKey],
|
|
136
|
+
timeout: 50_000,
|
|
137
|
+
},
|
|
138
|
+
citrea: {
|
|
139
|
+
url: `https://rpc.testnet.citrea.xyz`,
|
|
140
|
+
chainId: 5115,
|
|
141
|
+
gas: 'auto',
|
|
142
|
+
gasPrice: 'auto',
|
|
143
|
+
accounts: [wallet.privateKey],
|
|
144
|
+
timeout: 50_000,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
etherscan: {
|
|
148
|
+
apiKey: {
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
mainnet: etherscan,
|
|
151
|
+
tenderly: '',
|
|
152
|
+
citrea: 'your API key',
|
|
153
|
+
},
|
|
154
|
+
customChains: [
|
|
155
|
+
{
|
|
156
|
+
network: 'mainnet',
|
|
157
|
+
chainId: 1,
|
|
158
|
+
urls: {
|
|
159
|
+
apiURL: 'https://api.etherscan.io/v2/api?chainid=1',
|
|
160
|
+
browserURL: 'https://etherscan.io',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
network: 'tenderly',
|
|
165
|
+
chainId: 42069,
|
|
166
|
+
urls: {
|
|
167
|
+
apiURL: `${process.env.TENDERLY_RPC_URL ?? ''}/verify/etherscan`,
|
|
168
|
+
browserURL: process.env.TENDERLY_RPC_URL ?? '',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
network: 'citrea',
|
|
173
|
+
chainId: 5115,
|
|
174
|
+
urls: {
|
|
175
|
+
apiURL: 'https://explorer.testnet.citrea.xyz/api',
|
|
176
|
+
browserURL: 'https://explorer.testnet.citrea.xyz',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
sourcify: {
|
|
182
|
+
enabled: true,
|
|
183
|
+
},
|
|
184
|
+
namedAccounts: {
|
|
185
|
+
deployer: {
|
|
186
|
+
default: 0,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
paths: {
|
|
190
|
+
sources: './contracts',
|
|
191
|
+
tests: './test',
|
|
192
|
+
cache: './cache',
|
|
193
|
+
artifacts: './artifacts',
|
|
194
|
+
},
|
|
195
|
+
contractSizer: {
|
|
196
|
+
alphaSort: false,
|
|
197
|
+
runOnCompile: false,
|
|
198
|
+
disambiguatePaths: false,
|
|
199
|
+
},
|
|
200
|
+
gasReporter: {
|
|
201
|
+
enabled: true,
|
|
202
|
+
currency: 'USD',
|
|
203
|
+
},
|
|
204
|
+
abiExporter: [
|
|
205
|
+
{
|
|
206
|
+
path: './abi',
|
|
207
|
+
clear: false,
|
|
208
|
+
runOnCompile: true,
|
|
209
|
+
flat: false,
|
|
210
|
+
spacing: 4,
|
|
211
|
+
pretty: false,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
path: './abi/signature',
|
|
215
|
+
clear: false,
|
|
216
|
+
runOnCompile: true,
|
|
217
|
+
flat: false,
|
|
218
|
+
spacing: 4,
|
|
219
|
+
pretty: true,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
mocha: {
|
|
223
|
+
timeout: 120000,
|
|
224
|
+
},
|
|
225
|
+
typechain: {
|
|
226
|
+
outDir: 'typechain',
|
|
227
|
+
target: 'ethers-v6',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export default config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { writeFileSync } from 'fs';
|
|
2
|
+
|
|
3
|
+
export function storeConstructorArgs(deployment: string, args: any[], timestamp: boolean = false) {
|
|
4
|
+
const d: string[] = new Date().toLocaleString().split(', ');
|
|
5
|
+
const id: string = `${d[0].replace(/\//g, '-')}_${d[1].replace(/:/g, '-').replace(/ /g, '_')}`;
|
|
6
|
+
const dir: string = __dirname.split('/').slice(0, -1).join('/') + '/ignition/constructor-args/';
|
|
7
|
+
const file: string = timestamp ? `${deployment}-${id}.js` : `${deployment}.js`;
|
|
8
|
+
writeFileSync(
|
|
9
|
+
dir + file,
|
|
10
|
+
`module.exports = ${JSON.stringify(
|
|
11
|
+
args.map((a) => {
|
|
12
|
+
if (typeof a === 'bigint') return a.toString();
|
|
13
|
+
else return a;
|
|
14
|
+
})
|
|
15
|
+
)};`
|
|
16
|
+
);
|
|
17
|
+
}
|
package/helper/wallet.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
|
|
3
|
+
export function getChildFromSeed(seed: string, index: number) {
|
|
4
|
+
return ethers.HDNodeWallet.fromPhrase(seed, undefined, `m/44'/60'/0'/0/${index}`);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getAddressFromChildIndex(seed: string, index: number): string {
|
|
8
|
+
return getChildFromSeed(seed, index).address;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function getPublicKeyFromChildIndex(seed: string, index: number): string {
|
|
12
|
+
return getChildFromSeed(seed, index).publicKey;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function getPrivateKeyFromChildIndex(seed: string, index: number): string {
|
|
16
|
+
return getChildFromSeed(seed, index).privateKey;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getWalletInto(
|
|
20
|
+
seed = process.env.DEPLOYER_SEED,
|
|
21
|
+
index = process.env.DEPLOYER_SEED_INDEX,
|
|
22
|
+
amount: number = 3
|
|
23
|
+
) {
|
|
24
|
+
if (!seed) throw new Error('Failed to import the seed string from .env');
|
|
25
|
+
if (!index) throw new Error('Failed to import the index string from .env');
|
|
26
|
+
console.log('seed:', seed);
|
|
27
|
+
|
|
28
|
+
const start = index && index?.length > 0 ? parseInt(index) : 0;
|
|
29
|
+
|
|
30
|
+
for (let i = start; i < start + amount; i++) {
|
|
31
|
+
const w = getChildFromSeed(seed, i);
|
|
32
|
+
console.log('Wallet', i);
|
|
33
|
+
console.log({
|
|
34
|
+
address: w.address,
|
|
35
|
+
pubKey: w.publicKey,
|
|
36
|
+
privKey: w.privateKey,
|
|
37
|
+
path: w.path,
|
|
38
|
+
index: w.index,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
package/install-macos.sh
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
CUR_VERSION=""
|
|
4
|
+
NEW_VERSION="$(curl -s https://api.github.com/repos/Tenderly/tenderly-cli/releases/latest | grep tag_name | cut -d'v' -f2 | cut -d'"' -f1)"
|
|
5
|
+
EXISTS="$(command -v tenderly)"
|
|
6
|
+
|
|
7
|
+
if [ "$EXISTS" != "" ]; then
|
|
8
|
+
CUR_VERSION="$(tenderly version | sed -n 1p | cut -d'v' -f3)"
|
|
9
|
+
printf "\nCurrent Version: %s => New Version: %s\n" $CUR_VERSION $NEW_VERSION
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if [ "$NEW_VERSION" != "$CUR_VERSION" ]; then
|
|
13
|
+
|
|
14
|
+
printf "Installing version %s\n" $NEW_VERSION
|
|
15
|
+
|
|
16
|
+
cd /tmp/ > /dev/null
|
|
17
|
+
|
|
18
|
+
tarball="tenderly-binary.tar.gz"
|
|
19
|
+
|
|
20
|
+
curl -s https://api.github.com/repos/Tenderly/tenderly-cli/releases/latest \
|
|
21
|
+
| grep "browser_download_url.*Darwin_amd64\.tar\.gz" \
|
|
22
|
+
| cut -d ":" -f 2,3 \
|
|
23
|
+
| tr -d \" \
|
|
24
|
+
| xargs curl -sLo $tarball
|
|
25
|
+
|
|
26
|
+
tar -xzf $tarball
|
|
27
|
+
|
|
28
|
+
chmod +x tenderly
|
|
29
|
+
|
|
30
|
+
unlink $tarball
|
|
31
|
+
|
|
32
|
+
printf "Moving CLI to /usr/local/bin/\n"
|
|
33
|
+
|
|
34
|
+
mv tenderly /usr/local/bin/
|
|
35
|
+
|
|
36
|
+
cd - > /dev/null
|
|
37
|
+
|
|
38
|
+
location="$(which tenderly)"
|
|
39
|
+
printf "Tenderly CLI installed to: %s\n" $location
|
|
40
|
+
|
|
41
|
+
version="$(tenderly version | sed -n 1p | cut -d'v' -f3)"
|
|
42
|
+
printf "New Tenderly version installed: %s\n" $version
|
|
43
|
+
|
|
44
|
+
else
|
|
45
|
+
printf "Latest version already installed\n"
|
|
46
|
+
fi
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usdu-core/usdu-core",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "GPL-3.0",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"author": "samclassix <samclassix@proton.me>",
|
|
10
|
+
"description": "Core implementation",
|
|
11
|
+
"directories": {
|
|
12
|
+
"docs": "docs",
|
|
13
|
+
"test": "tests"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"wallet": "npx ts-node helper/wallet.info.ts",
|
|
17
|
+
"wallet:info": "npx ts-node helper/wallet.info.ts",
|
|
18
|
+
"compile": "npx hardhat compile",
|
|
19
|
+
"test": "npx hardhat test",
|
|
20
|
+
"coverage": "npx hardhat coverage",
|
|
21
|
+
"deploy": "npx hardhat ignition deploy",
|
|
22
|
+
"verify": "npx hardhat verify",
|
|
23
|
+
"npm:build": "tsup",
|
|
24
|
+
"npm:publish": "npm publish --access public"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/USDU-Core/usdu-core"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [],
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/USDU-Core/usdu-core/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/USDU-Core/usdu-core#readme",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@nomicfoundation/hardhat-chai-matchers": "^2.0.9",
|
|
37
|
+
"@nomicfoundation/hardhat-ethers": "^3.0.9",
|
|
38
|
+
"@nomicfoundation/hardhat-ignition": "^0.15.11",
|
|
39
|
+
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.12",
|
|
40
|
+
"@nomicfoundation/hardhat-network-helpers": "^1.0.12",
|
|
41
|
+
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
|
42
|
+
"@nomicfoundation/hardhat-verify": "^2.1.1",
|
|
43
|
+
"@nomicfoundation/ignition-core": "^0.15.11",
|
|
44
|
+
"@openzeppelin/contracts": "^5.1.0",
|
|
45
|
+
"@openzeppelin/contracts-upgradeable": "^5.4.0",
|
|
46
|
+
"@tenderly/hardhat-tenderly": "^2.5.2",
|
|
47
|
+
"@types/chai": "^4.3.6",
|
|
48
|
+
"@types/mocha": "^10.0.1",
|
|
49
|
+
"@uniswap/v3-core": "^1.0.1",
|
|
50
|
+
"@uniswap/v3-periphery": "^1.4.4",
|
|
51
|
+
"chai": "4",
|
|
52
|
+
"dotenv": "^16.3.1",
|
|
53
|
+
"ethers": "^6.14.4",
|
|
54
|
+
"hardhat": "^2.24.3",
|
|
55
|
+
"hardhat-abi-exporter": "^2.11.0",
|
|
56
|
+
"hardhat-contract-sizer": "^2.10.0",
|
|
57
|
+
"hardhat-deploy": "^1.0.3",
|
|
58
|
+
"hardhat-gas-reporter": "^2.3.0",
|
|
59
|
+
"mocha": "^10.7.0",
|
|
60
|
+
"solidity-coverage": "^0.8.16",
|
|
61
|
+
"ts-node": "^10.9.1",
|
|
62
|
+
"tsc-watch": "^6.2.0",
|
|
63
|
+
"tsup": "^8.3.0",
|
|
64
|
+
"viem": "^2.31.2"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@typechain/ethers-v6": "^0.5.1",
|
|
68
|
+
"@typechain/hardhat": "^9.1.0",
|
|
69
|
+
"@types/node": "^24.0.1",
|
|
70
|
+
"typechain": "^8.3.2",
|
|
71
|
+
"typescript": "^5.8.3"
|
|
72
|
+
}
|
|
73
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"noEmitOnError": true,
|
|
11
|
+
"skipDefaultLibCheck": true,
|
|
12
|
+
"skipLibCheck": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["hardhat.config.ts", "./scripts", "./deploy", "./test/**/*.ts", "./typechain", "deploy", "utils"]
|
|
15
|
+
}
|