diff --git a/.gitignore b/.gitignore index 4c9d7c35..108fa087 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,73 @@ +# SDK and build artifacts *.log .DS_Store node_modules dist + +# Dependencies +jspm_packages + +# Build outputs +build +out +*.tsbuildinfo + +# Environment and config +.env +.env.local +.env.* +.npmrc + +# Logs and debugging +logs +npm-debug.log* +lerna-debug.log* +.pnpm-debug.log* + +# Cache and temp directories +.npm +.eslintcache +.stylelintcache +.node_repl_history +.cache +.temp +.tmp +*.pid +*.seed +*.pid.lock + +# IDE and editor files +.idea +.vscode +*.swp +*.swo +.env.development.local +.env.test.local +.env.production.local + +# Coverage and test outputs +coverage +.nyc_output +lib-cov + +# Yarn specific +projects/amped/.yarn/* +!projects/amped/.yarn/patches +!projects/amped/.yarn/plugins +!projects/amped/.yarn/releases +!projects/amped/.yarn/sdks +!projects/amped/.yarn/versions +projects/amped/.pnp.* +.yarnrc.yml +yarn-debug.log* +yarn-error.log* +.yarn-integrity + +# TypeScript +*.tsbuildinfo +.tscache +tsconfig.tsbuildinfo + +# HeyAnon SDK specific +.heyanon-cache +.heyanon-debug.log* diff --git a/projects/amped/.gitignore b/projects/amped/.gitignore new file mode 100644 index 00000000..a781baeb --- /dev/null +++ b/projects/amped/.gitignore @@ -0,0 +1,21 @@ +# Node +node_modules/ + +# Environment variables +.env* + +# Build output +dist/ + +# Logs +*.log + +# OS specific +.DS_Store + +# Editor specific +.vscode/ +.cursor/ + +# Test coverage +coverage/ diff --git a/projects/amped/.prettierrc b/projects/amped/.prettierrc new file mode 100644 index 00000000..db347c2e --- /dev/null +++ b/projects/amped/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "tabWidth": 4, + "printWidth": 180 +} diff --git a/projects/amped/README.md b/projects/amped/README.md new file mode 100644 index 00000000..b561fd84 --- /dev/null +++ b/projects/amped/README.md @@ -0,0 +1,183 @@ +# amped + +Integration with Amped Finance + +## Supported Networks + +- SONIC + +## Common Tasks + +1. Liquidity Operations + - "Add 100 USDC as liquidity in Amped on Sonic network" + - "Remove $50 of liquidity from Amped and get S tokens back" + - "Check my available liquidity in Amped" + +2. Trading Operations + - "Open a long position worth 100 USD on ANON with 20 USDC as collateral in Amped" + - "Close my long ANON position in Amped" + - "Check my open positions in Amped" + +3. Information Queries + - "Show my current positions in Amped" + - "Check my liquidity pool balance in Amped" + - "Calculate expected returns for my position in Amped" + +## Available Functions + +### Liquidity Management +- `addLiquidity`: Add tokens as liquidity to Amped Finance, receiving ALP tokens in return. + - "Add 100 USDC as liquidity to Amped on Sonic network" + - "Use 50% of my ANON balance to provide liquidity in Amped" + +- `removeLiquidity`: Remove liquidity by redeeming ALP tokens for any supported token. + - "Remove 50 ALP tokens from Amped and receive USDC" + - "Withdraw 25% of my liquidity from Amped as ANON tokens" + +- `getUserLiquidity`: Get user's current liquidity position and ALP token balance. + - "Check my current ALP token balance in Amped" + - "Show me my liquidity position details in Amped" + +- `getPoolLiquidity`: Get current liquidity pool information and token balances. + - "Show me the total liquidity in Amped's pools" + - "What are the current token balances in Amped's liquidity pools?" + +- `getUserTokenBalances`: Get balances and USD values of all supported tokens for a specific user. + - "Show me all my token balances in Amped" + - "What's the USD value of my tokens in Amped?" + +### Trading Operations +- `openPosition`: Open a leveraged long or short position with specified collateral. + - "Open a 5x long position on ANON using 100 USDC as collateral" + - "Create a short position on WETH with 50 USDC collateral and 3x leverage" + +- `closePosition`: Close one or more leveraged positions, fully or partially. + - "Close my long ANON position in Amped" + - "Close 50% of my short WETH position" + +- `getAllOpenPositions`: Get all open positions for a specific account. + - "Show all my open positions in Amped" + - "List my active trading positions" + +- `getPosition`: Get detailed information about a specific position. + - "Show me details of my long ANON position" + - "What's the current PnL on my short WETH position?" + +- `marketSwap`: Execute a market swap between two tokens. + - "Swap 100 USDC for ANON with 0.5% slippage" + - "Exchange 50 S tokens for WETH" + +### Information & Analytics +- `getPoolLiquidity`: Get total pool liquidity information including ALP supply and Assets Under Management (AUM). + - "What's the total AUM in Amped's pools?" + - "Show me the ALP supply and pool liquidity details" + +- `getALPApr`: Calculate and retrieve the current APR for ALP tokens. + - "What's the current APR for providing liquidity in Amped?" + - "Show me the ALP token APR breakdown" + +- `getEarnings`: Get earnings information for a user's positions and liquidity. + - "Show my total earnings from Amped positions and liquidity" + - "Calculate my cumulative returns in Amped" + +- `getPerpsLiquidity`: Get available liquidity information for perpetual trading. + - "What's the available liquidity for trading ANON perpetuals?" + - "Show me the maximum position size possible for WETH longs" + +- `getSwapsLiquidity`: Get information about available liquidity for token swaps. + - "What's the available liquidity for swapping USDC to ANON?" + - "Show me the maximum swap amounts possible between tokens" + +### Rewards +- `claimRewards`: Claim any available rewards from liquidity provision or trading. + - "Claim my pending rewards from Amped" + - "Collect all my earned rewards from liquidity provision" + +## What You Need to Know + +1. Liquidity + - You can add any supported token as liquidity (e.g. S, EURC, USDC, ANON, WETH on Sonic) + - You receive ALP tokens in return + - ALP tokens can be redeemed later for any supported token + +2. Trading + - You can trade with up to 11x leverage + - Minimum leverage size is 1.1x + - Minimum collateral is $10 + - Available collateral and indextokens for longs: S, ANON, WETH + - Available collateral tokens for shorts: USDC, EURC + +3. Safety Limits + - Default slippage protection is 0.3% + - Position sizes are limited by available liquidity + - Leverage is limited based on token and position size + +## Installation + +```bash +yarn add @heyanon/amped +``` + +## Function Call Tool + +The project includes a utility script to directly call any function defined in the tools.ts file. This provides an easy way to test and interact with the Amped Finance protocol without having to create separate test scripts for each function. + +### Usage + +```bash +npm run function -- [parameters] +``` + +Parameters can be provided in two formats: + +1. As JSON: +```bash +npm run function -- functionName '{"param1": "value1", "param2": 123}' +``` + +2. As key-value pairs: +```bash +npm run function -- functionName param1=value1 param2=123 +``` + +### Examples + +List all available functions: +```bash +npm run function +``` + +Get detailed information about a specific function: +```bash +npm run function -- getPoolLiquidity +``` + +Get protocol information: +```bash +npm run function -- getPoolLiquidity chainName=sonic +``` + +Get user token balances: +```bash +npm run function -- getUserTokenBalances chainName=sonic account=0xYourAddress +``` + +Check ALP APR: +```bash +npm run function -- getALPAPR chainName=sonic account=0xYourAddress tokenAddress=0xfb0e5aabfac2f946d6f45fcd4303ff721a4e3237 +``` + +### Environment Variables + +The script requires the following environment variables to be set in a .env file: + +``` +PRIVATE_KEY=your_private_key_without_0x_prefix +DRY_RUN=false # Set to true to simulate transactions without execution +``` + +### Security Notice + +- Never share your private key or commit it to version control +- Use with caution when executing functions that perform actual transactions +- Always test with small amounts first when adding or removing liquidity \ No newline at end of file diff --git a/projects/amped/REFACTORING_SUMMARY.md b/projects/amped/REFACTORING_SUMMARY.md new file mode 100644 index 00000000..79cbd06b --- /dev/null +++ b/projects/amped/REFACTORING_SUMMARY.md @@ -0,0 +1,106 @@ +# Amped Finance Refactoring Summary + +This document summarizes the refactoring work completed to align the Amped Finance integration with Venus project patterns and best practices. + +## Major Changes Completed + +### 1. Constants and Configuration Updates +- **Removed deprecated exports**: Eliminated `NETWORKS` and `CHAIN_IDS` objects +- **Adopted SDK patterns**: Now using `Chain`, `EVM.constants.ChainIds` from SDK +- **Created `SupportedChain` enum**: Cleaner chain reference system +- **Updated chain references**: All files now use the new pattern + +### 2. Notification System Cleanup +- **Reduced notify calls**: From 10-20+ per function down to 1-3 maximum +- **Removed console statements**: All console.log/error statements removed +- **Added meaningful notifications**: Only essential user-facing messages remain + +### 3. Parameter Naming Improvements +- **Updated parameter names for AI comprehension**: + - `indexToken` → `tokenSymbol` (where appropriate) + - `collateralToken` → `collateralTokenSymbol` +- **Consistent naming**: All functions now use clear, descriptive parameter names + +### 4. SDK Utility Usage +- **Proper use of SDK utilities**: + - Using `checkToApprove` for token approvals + - Using `parseEventLogs` from viem for event parsing + - Using SDK's `options.evm.*` pattern for provider access + +### 5. Tools.ts Alignment with Venus +- **Removed `parameters` property**: Now using only `props` and `required` +- **Added enum support**: Token lists now use enums for better AI understanding +- **Cleaned descriptions**: Removed technical details about decimals from user-facing descriptions + +### 6. Code Quality Improvements +- **Fixed undefined variable bugs**: + - Fixed `indexToken`/`collateralToken` in getPosition.ts + - Fixed `networkName` in removeLiquidity.ts + - Fixed `amountOut` reference in removeLiquidity.ts +- **Removed duplicate functions**: Consolidated getPerpsLiquidity +- **Updated token list**: Removed ANON duplicate, kept only 'Anon' + +### 7. Testing Infrastructure +- **Created comprehensive test suite**: `test-all-functions.ts` +- **Added testing documentation**: `TESTING.md` +- **Direct function call script**: For individual function testing + +## Files Modified + +### Core Files +1. `/src/constants.ts` - Complete overhaul +2. `/src/tools.ts` - Aligned with Venus pattern +3. `/src/utils/tokenList.ts` - Cleaned duplicates +4. `/src/index.ts` - Created for exports + +### Function Files Updated +1. `/src/functions/liquidity/addLiquidity.ts` +2. `/src/functions/liquidity/removeLiquidity.ts` +3. `/src/functions/liquidity/getUserLiquidity.ts` +4. `/src/functions/liquidity/getEarnings.ts` +5. `/src/functions/liquidity/claimRewards.ts` +6. `/src/functions/trading/leverage/getPosition.ts` +7. `/src/functions/trading/leverage/openPosition.ts` +8. `/src/functions/trading/leverage/closePosition.ts` +9. `/src/functions/trading/leverage/getAllOpenPositions.ts` +10. `/src/functions/trading/leverage/getPerpsLiquidity.ts` +11. `/src/functions/trading/swaps/marketSwap.ts` +12. `/src/functions/trading/swaps/getSwapsLiquidity.ts` + +### Removed Files +- `/src/functions/trading/perps/getPerpsLiquidity.ts` (duplicate) + +## Key Patterns Adopted from Venus + +1. **Minimal notify usage**: Only notify users of essential status +2. **Clean parameter validation**: Using mutually exclusive parameters with `| null` +3. **Consistent error handling**: Using `toResult` with proper error messages +4. **SDK integration**: Proper use of FunctionOptions and SDK utilities +5. **Type safety**: Strong typing throughout with proper imports + +## Testing Approach + +Functions should be tested within the Heyanon SDK context using: +```bash +npm run function -- +``` + +Example: +```bash +npm run function -- getPoolLiquidity chainName=sonic +``` + +## Next Steps + +1. Complete remaining NETWORKS import fixes in files that still reference it +2. Run comprehensive tests to ensure all functions work correctly +3. Verify SDK integration in the Heyanon platform +4. Monitor for any runtime issues or edge cases + +## Best Practices Established + +1. **Always use SDK utilities** when available +2. **Keep notifications minimal** - only essential user feedback +3. **Use clear parameter names** that AI can understand +4. **Follow Venus patterns** for consistency across projects +5. **Test thoroughly** before deployment \ No newline at end of file diff --git a/projects/amped/TESTING.md b/projects/amped/TESTING.md new file mode 100644 index 00000000..1305c857 --- /dev/null +++ b/projects/amped/TESTING.md @@ -0,0 +1,156 @@ +# Testing Amped Finance Functions + +This guide explains how to test the Amped Finance integration functions. + +## Prerequisites + +1. Ensure you have a `.env` file with at least one of the following: + + **Option A: Private Key (recommended)** + ``` + PRIVATE_KEY=your_private_key_here + ``` + The test suite will automatically derive the account address from your private key. + + **Option B: Direct Account Address** + ``` + TEST_ACCOUNT=0x... + # or + ACCOUNT_ADDRESS=0x... + ``` + Use this if you want to test read-only functions without a private key. + +## Available Functions + +### Liquidity Functions +- `getPoolLiquidity` - Get overall pool liquidity information +- `getUserLiquidity` - Get user's ALP balance and liquidity info +- `getUserTokenBalances` - Get all token balances for a user +- `getEarnings` - Get user's earnings from providing liquidity +- `getALPAPR` - Get current APR for ALP tokens +- `addLiquidity` - Add liquidity to the pool +- `removeLiquidity` - Remove liquidity from the pool +- `claimRewards` - Claim accumulated rewards + +### Trading Functions +- `getSwapsLiquidity` - Get available liquidity for token swaps +- `marketSwap` - Perform a token swap +- `getPerpsLiquidity` - Get perpetual trading liquidity info +- `getAllOpenPositions` - Get all open perpetual positions +- `getPosition` - Get details of a specific position +- `openPosition` - Open a new perpetual position +- `closePosition` - Close an existing position + +## Testing with Direct Function Call Script + +The project includes a direct function call script that allows testing individual functions. + +### Basic Usage + +```bash +npm run function -- = = +``` + +### Examples + +#### 1. Get Pool Liquidity +```bash +npm run function -- getPoolLiquidity chainName=sonic +``` + +#### 2. Get User Token Balances +```bash +npm run function -- getUserTokenBalances chainName=sonic account=0xYourAddress +``` + +#### 3. Get User Liquidity +```bash +npm run function -- getUserLiquidity chainName=sonic account=0xYourAddress +``` + +#### 4. Get ALP APR +```bash +npm run function -- getALPAPR chainName=sonic account=0xYourAddress +``` + +#### 5. Get Swaps Liquidity +```bash +npm run function -- getSwapsLiquidity chainName=sonic account=0xYourAddress +``` + +#### 6. Get Perps Liquidity +```bash +# For long positions +npm run function -- getPerpsLiquidity chainName=sonic account=0xYourAddress indexToken=WETH isLong=true + +# For short positions +npm run function -- getPerpsLiquidity chainName=sonic account=0xYourAddress indexToken=USDC isLong=false +``` + +#### 7. Get All Open Positions +```bash +npm run function -- getAllOpenPositions chainName=sonic account=0xYourAddress +``` + +#### 8. Get Specific Position +```bash +npm run function -- getPosition chainName=sonic account=0xYourAddress tokenSymbol=WETH collateralTokenSymbol=USDC isLong=true +``` + +## State-Changing Functions (Use with Caution) + +These functions will execute actual transactions on the blockchain: + +#### Add Liquidity +```bash +# With specific amount +npm run function -- addLiquidity chainName=sonic account=0xYourAddress tokenSymbol=USDC amount=10 minUsdg=0 minGlp=0 + +# With percentage of balance +npm run function -- addLiquidity chainName=sonic account=0xYourAddress tokenSymbol=USDC percentOfBalance=10 minUsdg=0 minGlp=0 +``` + +#### Remove Liquidity +```bash +npm run function -- removeLiquidity chainName=sonic account=0xYourAddress tokenOutSymbol=USDC amount=5 slippageTolerance=0.5 +``` + +#### Market Swap +```bash +npm run function -- marketSwap chainName=sonic account=0xYourAddress tokenIn=USDC tokenOut=WETH amountIn=100 slippageBps=100 +``` + +#### Open Position +```bash +npm run function -- openPosition chainName=sonic account=0xYourAddress tokenSymbol=WETH collateralTokenSymbol=USDC isLong=true sizeUsd=100 collateralUsd=20 slippageBps=30 +``` + +#### Close Position +```bash +npm run function -- closePosition chainName=sonic account=0xYourAddress slippageBps=30 +``` + +## Automated Test Suite + +Run all read-only functions in sequence: +```bash +npm run test:all +``` + +This will test all functions that don't modify blockchain state. + +## Troubleshooting + +1. **"Wallet not connected"** - Ensure PRIVATE_KEY is set in .env +2. **"Invalid account address"** - Ensure account parameter is a valid address +3. **"Network not supported"** - Currently only 'sonic' and 'base' are supported +4. **Transaction failures** - Check you have sufficient balance and gas + +## Integration with Heyanon SDK + +These functions are designed to work within the Heyanon SDK ecosystem. When integrated: +- The SDK provides wallet connection and transaction management +- Functions receive proper `FunctionOptions` with notify, getProvider, and sendTransactions +- Error handling and user notifications are managed by the SDK + +For SDK integration testing, refer to the Heyanon SDK documentation. \ No newline at end of file diff --git a/projects/amped/package-lock.json b/projects/amped/package-lock.json new file mode 100644 index 00000000..ce387fd7 --- /dev/null +++ b/projects/amped/package-lock.json @@ -0,0 +1,5290 @@ +{ + "name": "amped", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "amped", + "version": "1.0.0", + "dependencies": { + "@heyanon/sdk": "^2.0.2", + "dotenv": "^16.3.1", + "ethers": "^6.13.5", + "viem": "^2.24.2" + }, + "devDependencies": { + "@types/node": "^20.10.5", + "tsup": "^8.5.0", + "tsx": "^4.7.0", + "typescript": "^5.3.3" + } + }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmmirror.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "node_modules/@babel/runtime": { + "version": "7.27.4", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.27.4.tgz", + "integrity": "sha512-t3yaEOuGu9NlIZ+hIeGbBjFtZT7j2cb2tg0fuaJKeGotchRjjLfrBA9Kwf8quhpP1EUuxModQg04q/mBwyg8uA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz", + "integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.5.tgz", + "integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz", + "integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.5.tgz", + "integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz", + "integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz", + "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz", + "integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz", + "integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz", + "integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz", + "integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz", + "integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz", + "integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz", + "integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz", + "integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz", + "integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz", + "integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz", + "integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz", + "integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz", + "integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz", + "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz", + "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz", + "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz", + "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz", + "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@heyanon/sdk": { + "version": "2.2.1", + "resolved": "https://registry.npmmirror.com/@heyanon/sdk/-/sdk-2.2.1.tgz", + "integrity": "sha512-qnZPkyH+DXWq0RFVG/shXmNcCAJ60KA+7XmxMQFSWYvcOnLqh/b4FRtvy7SRm2blJI1I22xPW1xFq37Mf9kRWw==", + "license": "MIT", + "dependencies": { + "@real-wagmi/sdk": "^1.4.5", + "@solana/web3.js": "1.98.0", + "@ton-api/client": "0.3.1", + "@ton-api/ton-adapter": "0.3.0", + "@ton/core": "0.60.0", + "@ton/ton": "15.2.0", + "ccxt": "4.4.78", + "viem": "2.22.9", + "vitest": "^2.1.8" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@heyanon/sdk/node_modules/@noble/curves": { + "version": "1.7.0", + "resolved": "https://registry.npmmirror.com/@noble/curves/-/curves-1.7.0.tgz", + "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.6.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@heyanon/sdk/node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.6.0.tgz", + "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@heyanon/sdk/node_modules/@noble/hashes": { + "version": "1.6.1", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.6.1.tgz", + "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@heyanon/sdk/node_modules/@scure/bip32": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/@scure/bip32/-/bip32-1.6.0.tgz", + "integrity": "sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==", + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.7.0", + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@heyanon/sdk/node_modules/@scure/bip39": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/@scure/bip39/-/bip39-1.5.0.tgz", + "integrity": "sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@heyanon/sdk/node_modules/@vitest/expect": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", + "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", + "chai": "^5.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@heyanon/sdk/node_modules/@vitest/mocker": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", + "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.8", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.12" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@heyanon/sdk/node_modules/@vitest/runner": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", + "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", + "license": "MIT", + "dependencies": { + "@vitest/utils": "2.1.8", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@heyanon/sdk/node_modules/@vitest/snapshot": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", + "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.8", + "magic-string": "^0.30.12", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@heyanon/sdk/node_modules/@vitest/utils": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", + "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.8", + "loupe": "^3.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@heyanon/sdk/node_modules/abitype": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/abitype/-/abitype-1.0.7.tgz", + "integrity": "sha512-ZfYYSktDQUwc2eduYu8C4wOs+RDPmnRYMh7zNfzeMtGGgb0U+6tLGjixUic6mXf5xKKCcgT5Qp6cv39tOARVFw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3 >=3.22.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/@heyanon/sdk/node_modules/ox": { + "version": "0.6.5", + "resolved": "https://registry.npmmirror.com/ox/-/ox-0.6.5.tgz", + "integrity": "sha512-vmnH8KvMDwFZDbNY1mq2CBRBWIgSliZB/dFV0xKp+DfF/dJkTENt6nmA+DzHSSAgL/GO2ydjkXWvlndJgSY4KQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.10.1", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", + "@scure/bip32": "^1.5.0", + "@scure/bip39": "^1.4.0", + "abitype": "^1.0.6", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@heyanon/sdk/node_modules/viem": { + "version": "2.22.9", + "resolved": "https://registry.npmmirror.com/viem/-/viem-2.22.9.tgz", + "integrity": "sha512-2yy46qYhcdo8GZggQ3Zoq9QCahI0goddzpVI/vSnTpcClQBSDxYRCuAqRzzLqjvJ7hS0UYgplC7eRkM2sYgflw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "1.7.0", + "@noble/hashes": "1.6.1", + "@scure/bip32": "1.6.0", + "@scure/bip39": "1.5.0", + "abitype": "1.0.7", + "isows": "1.0.6", + "ox": "0.6.5", + "ws": "8.18.0" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@heyanon/sdk/node_modules/vite-node": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", + "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.7", + "es-module-lexer": "^1.5.4", + "pathe": "^1.1.2", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@heyanon/sdk/node_modules/vitest": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", + "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", + "license": "MIT", + "dependencies": { + "@vitest/expect": "2.1.8", + "@vitest/mocker": "2.1.8", + "@vitest/pretty-format": "^2.1.8", + "@vitest/runner": "2.1.8", + "@vitest/snapshot": "2.1.8", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", + "chai": "^5.1.2", + "debug": "^4.3.7", + "expect-type": "^1.1.0", + "magic-string": "^0.30.12", + "pathe": "^1.1.2", + "std-env": "^3.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.1", + "tinypool": "^1.0.1", + "tinyrainbow": "^1.2.0", + "vite": "^5.0.0", + "vite-node": "2.1.8", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "2.1.8", + "@vitest/ui": "2.1.8", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/@heyanon/sdk/node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmmirror.com/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@noble/curves": { + "version": "1.8.1", + "resolved": "https://registry.npmmirror.com/@noble/curves/-/curves-1.8.1.tgz", + "integrity": "sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==", + "dependencies": { + "@noble/hashes": "1.7.1" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.7.1", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmmirror.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@real-wagmi/sdk": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@real-wagmi/sdk/-/sdk-1.4.5.tgz", + "integrity": "sha512-IfCA86jWWswli86yBPK194IzuMDLBGkuKSvHNjW9xTmlhAKP9lOGD26W6Z50zLMokv0WfxqoH69KS2Z/kOFecA==", + "license": "MIT", + "dependencies": { + "@uniswap/token-lists": "1.0.0-beta.33", + "big.js": "^6.2.1", + "decimal.js-light": "^2.5.1", + "tiny-invariant": "^1.3.1", + "toformat": "^2.0.0", + "viem": "^2.7.20", + "vitest": "^1.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/@vitest/expect": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", + "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "license": "MIT", + "dependencies": { + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "chai": "^4.3.10" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/@vitest/runner": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", + "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "license": "MIT", + "dependencies": { + "@vitest/utils": "1.6.0", + "p-limit": "^5.0.0", + "pathe": "^1.1.1" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/@vitest/snapshot": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", + "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/@vitest/spy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", + "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "license": "MIT", + "dependencies": { + "tinyspy": "^2.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "license": "MIT", + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/tinypool": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", + "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/tinyspy": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", + "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/vite-node": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", + "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.4", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "vite": "^5.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@real-wagmi/sdk/node_modules/vitest": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", + "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "license": "MIT", + "dependencies": { + "@vitest/expect": "1.6.0", + "@vitest/runner": "1.6.0", + "@vitest/snapshot": "1.6.0", + "@vitest/spy": "1.6.0", + "@vitest/utils": "1.6.0", + "acorn-walk": "^8.3.2", + "chai": "^4.3.10", + "debug": "^4.3.4", + "execa": "^8.0.1", + "local-pkg": "^0.5.0", + "magic-string": "^0.30.5", + "pathe": "^1.1.1", + "picocolors": "^1.0.0", + "std-env": "^3.5.0", + "strip-literal": "^2.0.0", + "tinybench": "^2.5.1", + "tinypool": "^0.8.3", + "vite": "^5.0.0", + "vite-node": "1.6.0", + "why-is-node-running": "^2.2.2" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "1.6.0", + "@vitest/ui": "1.6.0", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.1.tgz", + "integrity": "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.1.tgz", + "integrity": "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.1.tgz", + "integrity": "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.1.tgz", + "integrity": "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.1.tgz", + "integrity": "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.1.tgz", + "integrity": "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.1.tgz", + "integrity": "sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.1.tgz", + "integrity": "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.1.tgz", + "integrity": "sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.1.tgz", + "integrity": "sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.1.tgz", + "integrity": "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.1.tgz", + "integrity": "sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.1.tgz", + "integrity": "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.1.tgz", + "integrity": "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.1.tgz", + "integrity": "sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.1.tgz", + "integrity": "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.1.tgz", + "integrity": "sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.1.tgz", + "integrity": "sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.1.tgz", + "integrity": "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.1.tgz", + "integrity": "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@scure/base": { + "version": "1.2.4", + "resolved": "https://registry.npmmirror.com/@scure/base/-/base-1.2.4.tgz", + "integrity": "sha512-5Yy9czTO47mqz+/J8GM6GIId4umdCk1wc1q8rKERQulIoc8VP9pzDcghv10Tl2E7R96ZUx/PhND3ESYUQX8NuQ==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.6.2", + "resolved": "https://registry.npmmirror.com/@scure/bip32/-/bip32-1.6.2.tgz", + "integrity": "sha512-t96EPDMbtGgtb7onKKqxRLfE5g05k7uHnHRM2xdE6BP/ZmxaLtPek4J4KfVn/90IQNrU1IOAqMgiDtUdtbe3nw==", + "dependencies": { + "@noble/curves": "~1.8.1", + "@noble/hashes": "~1.7.1", + "@scure/base": "~1.2.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.5.4", + "resolved": "https://registry.npmmirror.com/@scure/bip39/-/bip39-1.5.4.tgz", + "integrity": "sha512-TFM4ni0vKvCfBpohoh+/lY05i9gRbSwXWngAsF4CABQxoaOHijxuaZ2R6cStDQ5CHtHO9aGJTr4ksVJASRRyMA==", + "dependencies": { + "@noble/hashes": "~1.7.1", + "@scure/base": "~1.2.4" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "license": "MIT" + }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "license": "MIT", + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/web3.js": { + "version": "1.98.0", + "resolved": "https://registry.npmmirror.com/@solana/web3.js/-/web3.js-1.98.0.tgz", + "integrity": "sha512-nz3Q5OeyGFpFCR+erX2f6JPt3sKhzhYcSycBCSPkWjzSVDh/Rr1FqTVMRe58FKO16/ivTUcuJjeS5MyBvpkbzA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.25.0", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@solana/buffer-layout": "^4.0.1", + "agentkeepalive": "^4.5.0", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^4.1.1", + "node-fetch": "^2.7.0", + "rpc-websockets": "^9.0.2", + "superstruct": "^2.0.2" + } + }, + "node_modules/@swc/helpers": { + "version": "0.5.17", + "resolved": "https://registry.npmmirror.com/@swc/helpers/-/helpers-0.5.17.tgz", + "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@swc/helpers/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/@ton-api/client": { + "version": "0.3.1", + "resolved": "https://registry.npmmirror.com/@ton-api/client/-/client-0.3.1.tgz", + "integrity": "sha512-QwKcYcX9vaudJK7E7Gfx87A/TU1LgAUrNGdW6OZVKvKxttoUQUtEtRqLk3xqyuhQK24IYAd6BQ6Ki33X7zSdaw==", + "license": "MIT", + "dependencies": { + "core-js-pure": "^3.38.0" + }, + "peerDependencies": { + "@ton/core": ">=0.59.0" + } + }, + "node_modules/@ton-api/ton-adapter": { + "version": "0.3.0", + "resolved": "https://registry.npmmirror.com/@ton-api/ton-adapter/-/ton-adapter-0.3.0.tgz", + "integrity": "sha512-axR7MiViOays+10GSjyvGQHexf3qermN7dFjQVtIXbF2Aj5gC1CnIHh4xbSUJVGn0JsrH8tOO027dO73wJnSXw==", + "license": "MIT", + "peerDependencies": { + "@ton-api/client": "^0.3.0", + "@ton/core": ">=0.59.0" + } + }, + "node_modules/@ton/core": { + "version": "0.60.0", + "resolved": "https://registry.npmmirror.com/@ton/core/-/core-0.60.0.tgz", + "integrity": "sha512-vK0itrieVashNQ7geqpvlWcOyXsXKKtIo6h02HcVcMeNo+QxovBaDAvou3BUKDnf7ej6+rRSuXMSOIjBct/zIg==", + "license": "MIT", + "dependencies": { + "symbol.inspect": "1.0.1" + }, + "peerDependencies": { + "@ton/crypto": ">=3.2.0" + } + }, + "node_modules/@ton/crypto": { + "version": "3.3.0", + "resolved": "https://registry.npmmirror.com/@ton/crypto/-/crypto-3.3.0.tgz", + "integrity": "sha512-/A6CYGgA/H36OZ9BbTaGerKtzWp50rg67ZCH2oIjV1NcrBaCK9Z343M+CxedvM7Haf3f/Ee9EhxyeTp0GKMUpA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@ton/crypto-primitives": "2.1.0", + "jssha": "3.2.0", + "tweetnacl": "1.0.3" + } + }, + "node_modules/@ton/crypto-primitives": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/@ton/crypto-primitives/-/crypto-primitives-2.1.0.tgz", + "integrity": "sha512-PQesoyPgqyI6vzYtCXw4/ZzevePc4VGcJtFwf08v10OevVJHVfW238KBdpj1kEDQkxWLeuNHEpTECNFKnP6tow==", + "license": "MIT", + "peer": true, + "dependencies": { + "jssha": "3.2.0" + } + }, + "node_modules/@ton/ton": { + "version": "15.2.0", + "resolved": "https://registry.npmmirror.com/@ton/ton/-/ton-15.2.0.tgz", + "integrity": "sha512-xddD1Oia7IAWl/VWgaHIdcsI8eIp1hmdEDWtYxAgeZOlwJCT+gfN0prwasM/IvPsI8y49A9/doIRZblXPWxd8g==", + "license": "MIT", + "dependencies": { + "axios": "^1.6.7", + "dataloader": "^2.0.0", + "symbol.inspect": "1.0.1", + "teslabot": "^1.3.0", + "zod": "^3.21.4" + }, + "peerDependencies": { + "@ton/core": ">=0.60.0", + "@ton/crypto": ">=3.2.0" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmmirror.com/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.17.28", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-20.17.28.tgz", + "integrity": "sha512-DHlH/fNL6Mho38jTy7/JT7sn2wnXI+wULR6PV4gy4VHLVvnrV/d3pHAMQHhc4gjdLmK2ZiPoMxzp6B3yRajLSQ==", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmmirror.com/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@uniswap/token-lists": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/@uniswap/token-lists/-/token-lists-1.0.0-beta.33.tgz", + "integrity": "sha512-JQkXcpRI3jFG8y3/CGC4TS8NkDgcxXaOQuYW8Qdvd6DcDiIyg2vVYCG9igFEzF0G6UvxgHkBKC7cWCgzZNYvQg==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", + "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", + "license": "MIT", + "dependencies": { + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", + "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", + "license": "MIT", + "dependencies": { + "tinyspy": "^3.0.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", + "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "license": "MIT", + "dependencies": { + "diff-sequences": "^29.6.3", + "estree-walker": "^3.0.3", + "loupe": "^2.3.7", + "pretty-format": "^29.7.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils/node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "license": "MIT", + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/abitype": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/abitype/-/abitype-1.0.8.tgz", + "integrity": "sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3 >=3.22.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmmirror.com/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, + "node_modules/agentkeepalive": { + "version": "4.6.0", + "resolved": "https://registry.npmmirror.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz", + "integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==", + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/axios": { + "version": "1.9.0", + "resolved": "https://registry.npmmirror.com/axios/-/axios-1.9.0.tgz", + "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/base-x": { + "version": "3.0.11", + "resolved": "https://registry.npmmirror.com/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/big.js": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-6.2.2.tgz", + "integrity": "sha512-y/ie+Faknx7sZA5MfGA2xKlu0GDv8RWrXGsmlteyJQ2lvoKv9GBK/fpRMc2qlSoBAgNxrixICFCBefIq8WCQpQ==", + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/bigjs" + } + }, + "node_modules/bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmmirror.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "bindings": "^1.3.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bn.js": { + "version": "5.2.2", + "resolved": "https://registry.npmmirror.com/bn.js/-/bn.js-5.2.2.tgz", + "integrity": "sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw==", + "license": "MIT" + }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmmirror.com/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "license": "Apache-2.0", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "license": "MIT", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmmirror.com/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/bufferutil": { + "version": "4.0.9", + "resolved": "https://registry.npmmirror.com/bufferutil/-/bufferutil-4.0.9.tgz", + "integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmmirror.com/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ccxt": { + "version": "4.4.78", + "resolved": "https://registry.npmmirror.com/ccxt/-/ccxt-4.4.78.tgz", + "integrity": "sha512-XjO31lpX4jGFQfsf3OSTYX93GA1TF2dUO54LARmbG6FUNxWiSoZgXF7CL1KqN2pZN7XfVJllEjUz/dF1TBg33g==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "ws": "^8.8.1" + }, + "bin": { + "ccxt": "examples/js/cli.js" + }, + "engines": { + "node": ">=15.0.0" + } + }, + "node_modules/chai": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", + "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmmirror.com/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/core-js-pure": { + "version": "3.42.0", + "resolved": "https://registry.npmmirror.com/core-js-pure/-/core-js-pure-3.42.0.tgz", + "integrity": "sha512-007bM04u91fF4kMgwom2I5cQxAFIy8jVulgr9eozILl/SZE53QOqnW/+vviC+wQWLv+AunBG+8Q0TLoeSsSxRQ==", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/dataloader": { + "version": "2.2.3", + "resolved": "https://registry.npmmirror.com/dataloader/-/dataloader-2.2.3.tgz", + "integrity": "sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmmirror.com/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", + "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmmirror.com/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "license": "MIT" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "license": "MIT", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/esbuild/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/ethers": { + "version": "6.13.5", + "resolved": "https://registry.npmmirror.com/ethers/-/ethers-6.13.5.tgz", + "integrity": "sha512-+knKNieu5EKRThQJWwqaJ10a6HE9sSehGeqWN65//wE7j47ZpFhKAnHB/JJFibwwg61I/koxaPsXbXpD/skNOQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmmirror.com/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/expect-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", + "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmmirror.com/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==", + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.4.5", + "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.4.5.tgz", + "integrity": "sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.2.tgz", + "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", + "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmmirror.com/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmmirror.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/isows": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/isows/-/isows-1.0.6.tgz", + "integrity": "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jayson": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/jayson/-/jayson-4.2.0.tgz", + "integrity": "sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg==", + "license": "MIT", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "stream-json": "^1.9.1", + "uuid": "^8.3.2", + "ws": "^7.5.10" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "license": "MIT" + }, + "node_modules/jayson/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmmirror.com/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/jayson/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmmirror.com/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "license": "MIT" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "license": "ISC" + }, + "node_modules/jssha": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/jssha/-/jssha-3.2.0.tgz", + "integrity": "sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q==", + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": "*" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmmirror.com/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/local-pkg": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz", + "integrity": "sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==", + "license": "MIT", + "dependencies": { + "mlly": "^1.7.3", + "pkg-types": "^1.2.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmmirror.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", + "dev": true, + "license": "MIT" + }, + "node_modules/loupe": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, + "node_modules/mlly/node_modules/pathe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmmirror.com/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmmirror.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ox": { + "version": "0.6.9", + "resolved": "https://registry.npmmirror.com/ox/-/ox-0.6.9.tgz", + "integrity": "sha512-wi5ShvzE4eOcTwQVsIPdFr+8ycyX+5le/96iAJutaZAvCes1J0+RvpEPg5QDPDiaR0XQQAvZVl7AwqQcINuUug==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "^1.10.1", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", + "@scure/bip32": "^1.5.0", + "@scure/bip39": "^1.4.0", + "abitype": "^1.0.6", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/ox/node_modules/@adraffy/ens-normalize": { + "version": "1.11.0", + "resolved": "https://registry.npmmirror.com/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==" + }, + "node_modules/p-limit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", + "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", + "license": "MIT", + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmmirror.com/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmmirror.com/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/pkg-types/node_modules/pathe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", + "license": "MIT" + }, + "node_modules/postcss": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.1.tgz", + "integrity": "sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/rollup": { + "version": "4.41.1", + "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.41.1.tgz", + "integrity": "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==", + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.41.1", + "@rollup/rollup-android-arm64": "4.41.1", + "@rollup/rollup-darwin-arm64": "4.41.1", + "@rollup/rollup-darwin-x64": "4.41.1", + "@rollup/rollup-freebsd-arm64": "4.41.1", + "@rollup/rollup-freebsd-x64": "4.41.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.41.1", + "@rollup/rollup-linux-arm-musleabihf": "4.41.1", + "@rollup/rollup-linux-arm64-gnu": "4.41.1", + "@rollup/rollup-linux-arm64-musl": "4.41.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.41.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-gnu": "4.41.1", + "@rollup/rollup-linux-riscv64-musl": "4.41.1", + "@rollup/rollup-linux-s390x-gnu": "4.41.1", + "@rollup/rollup-linux-x64-gnu": "4.41.1", + "@rollup/rollup-linux-x64-musl": "4.41.1", + "@rollup/rollup-win32-arm64-msvc": "4.41.1", + "@rollup/rollup-win32-ia32-msvc": "4.41.1", + "@rollup/rollup-win32-x64-msvc": "4.41.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/rpc-websockets": { + "version": "9.1.1", + "resolved": "https://registry.npmmirror.com/rpc-websockets/-/rpc-websockets-9.1.1.tgz", + "integrity": "sha512-1IXGM/TfPT6nfYMIXkJdzn+L4JEsmb0FL1O2OBjaH03V3yuUDdKFulGLMFG6ErV+8pZ5HVC0limve01RyO+saA==", + "license": "LGPL-3.0-only", + "dependencies": { + "@swc/helpers": "^0.5.11", + "@types/uuid": "^8.3.4", + "@types/ws": "^8.2.2", + "buffer": "^6.0.3", + "eventemitter3": "^5.0.1", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" + }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/@types/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmmirror.com/@types/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmmirror.com/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/source-map": { + "version": "0.8.0-beta.0", + "resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.8.0-beta.0.tgz", + "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "whatwg-url": "^7.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "license": "MIT" + }, + "node_modules/stream-chain": { + "version": "2.2.5", + "resolved": "https://registry.npmmirror.com/stream-chain/-/stream-chain-2.2.5.tgz", + "integrity": "sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==", + "license": "BSD-3-Clause" + }, + "node_modules/stream-json": { + "version": "1.9.1", + "resolved": "https://registry.npmmirror.com/stream-json/-/stream-json-1.9.1.tgz", + "integrity": "sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==", + "license": "BSD-3-Clause", + "dependencies": { + "stream-chain": "^2.2.5" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-literal": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.1.tgz", + "integrity": "sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/sucrase": { + "version": "3.35.0", + "resolved": "https://registry.npmmirror.com/sucrase/-/sucrase-3.35.0.tgz", + "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "glob": "^10.3.10", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/superstruct": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/superstruct/-/superstruct-2.0.2.tgz", + "integrity": "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/symbol.inspect": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/symbol.inspect/-/symbol.inspect-1.0.1.tgz", + "integrity": "sha512-YQSL4duoHmLhsTD1Pw8RW6TZ5MaTX5rXJnqacJottr2P2LZBF/Yvrc3ku4NUpMOm8aM0KOCqM+UAkMA5HWQCzQ==", + "license": "ISC" + }, + "node_modules/teslabot": { + "version": "1.5.0", + "resolved": "https://registry.npmmirror.com/teslabot/-/teslabot-1.5.0.tgz", + "integrity": "sha512-e2MmELhCgrgZEGo7PQu/6bmYG36IDH+YrBI1iGm6jovXkeDIGa3pZ2WSqRjzkuw2vt1EqfkZoV5GpXgqL8QJVg==", + "license": "MIT" + }, + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", + "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", + "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/toformat": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/toformat/-/toformat-2.0.0.tgz", + "integrity": "sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ==", + "license": "MIT" + }, + "node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmmirror.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, + "node_modules/tsup": { + "version": "8.5.0", + "resolved": "https://registry.npmmirror.com/tsup/-/tsup-8.5.0.tgz", + "integrity": "sha512-VmBp77lWNQq6PfuMqCHD3xWl22vEoWsKajkF8t+yMBawlUS8JzEI+vOVMeuNZIuMML8qXRizFKi9oD5glKQVcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.25.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "0.8.0-beta.0", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/@esbuild/darwin-arm64": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz", + "integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsup/node_modules/esbuild": { + "version": "0.25.5", + "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.5.tgz", + "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.5", + "@esbuild/android-arm": "0.25.5", + "@esbuild/android-arm64": "0.25.5", + "@esbuild/android-x64": "0.25.5", + "@esbuild/darwin-arm64": "0.25.5", + "@esbuild/darwin-x64": "0.25.5", + "@esbuild/freebsd-arm64": "0.25.5", + "@esbuild/freebsd-x64": "0.25.5", + "@esbuild/linux-arm": "0.25.5", + "@esbuild/linux-arm64": "0.25.5", + "@esbuild/linux-ia32": "0.25.5", + "@esbuild/linux-loong64": "0.25.5", + "@esbuild/linux-mips64el": "0.25.5", + "@esbuild/linux-ppc64": "0.25.5", + "@esbuild/linux-riscv64": "0.25.5", + "@esbuild/linux-s390x": "0.25.5", + "@esbuild/linux-x64": "0.25.5", + "@esbuild/netbsd-arm64": "0.25.5", + "@esbuild/netbsd-x64": "0.25.5", + "@esbuild/openbsd-arm64": "0.25.5", + "@esbuild/openbsd-x64": "0.25.5", + "@esbuild/sunos-x64": "0.25.5", + "@esbuild/win32-arm64": "0.25.5", + "@esbuild/win32-ia32": "0.25.5", + "@esbuild/win32-x64": "0.25.5" + } + }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "license": "Unlicense", + "peer": true + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "devOptional": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmmirror.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmmirror.com/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/viem": { + "version": "2.24.2", + "resolved": "https://registry.npmmirror.com/viem/-/viem-2.24.2.tgz", + "integrity": "sha512-lUGoTHhMYlR4ktQiOrbTPmYvrMn3jKUdn2PSmB9QLICxnsQJxMkSCeGRoJFq7hi7K6PCMQgAyLMR/9J1key5cg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@noble/curves": "1.8.1", + "@noble/hashes": "1.7.1", + "@scure/bip32": "1.6.2", + "@scure/bip39": "1.5.4", + "abitype": "1.0.8", + "isows": "1.0.6", + "ox": "0.6.9", + "ws": "8.18.1" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vite": { + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.25.50", + "resolved": "https://registry.npmmirror.com/zod/-/zod-3.25.50.tgz", + "integrity": "sha512-VstOnRxf4tlSq0raIwbn0n+LA34SxVoZ8r3pkwSUM0jqNiA/HCMQEVjTuS5FZmHsge+9MDGTiAuHyml5T0um6A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/projects/amped/package.json b/projects/amped/package.json new file mode 100644 index 00000000..029dab29 --- /dev/null +++ b/projects/amped/package.json @@ -0,0 +1,28 @@ +{ + "name": "amped", + "version": "1.0.0", + "description": "Amped Finance Integration", + "type": "module", + "scripts": { + "build": "tsup", + "function": "tsx scripts/direct-function-call.ts", + "example:get-protocol-info": "node scripts/examples/get-protocol-info.js", + "test:add-liquidity": "tsx scripts/tests/test-add-liquidity.ts", + "ethers-liquidity": "tsx scripts/test-ethers-liquidity.ts", + "test:all": "tsx scripts/test-all-functions.ts", + "test:detailed": "tsx scripts/test-all-functions-with-results.ts", + "test:with-txs": "RUN_STATE_CHANGING=true tsx scripts/test-all-functions-with-results.ts" + }, + "dependencies": { + "@heyanon/sdk": "^2.0.2", + "dotenv": "^16.3.1", + "ethers": "^6.13.5", + "viem": "^2.24.2" + }, + "devDependencies": { + "@types/node": "^20.10.5", + "tsup": "^8.5.0", + "tsx": "^4.7.0", + "typescript": "^5.3.3" + } +} diff --git a/projects/amped/scripts/direct-function-call.ts b/projects/amped/scripts/direct-function-call.ts new file mode 100755 index 00000000..7e574a5c --- /dev/null +++ b/projects/amped/scripts/direct-function-call.ts @@ -0,0 +1,500 @@ +#!/usr/bin/env tsx +/** + * direct-function-call.ts + * + * This script provides a way to directly call any function defined in the tools.ts file. + * It accepts command-line arguments to specify the function name and parameters. + */ + +import dotenv from 'dotenv'; +import { tools } from '../src/tools.js'; +import { functionMap } from '../src/functionMap.js'; +import { createWalletClient, createPublicClient, http, Hex, Address, TransactionReceipt } from 'viem'; +import { privateKeyToAccount } from 'viem/accounts'; +import { base } from 'viem/chains'; +import { EVM } from '@heyanon/sdk'; + +const { getChainFromName } = EVM.utils; + +// Define sonic chain config +const sonic = { + id: 146, + name: 'Sonic', + network: 'sonic', + nativeCurrency: { + decimals: 18, + name: 'Sonic', + symbol: 'S', + }, + rpcUrls: { + default: { http: ['https://rpc.soniclabs.com'] }, + public: { http: ['https://rpc.soniclabs.com'] }, + }, + blockExplorers: { + default: { name: 'SonicScan', url: 'https://sonicscan.org' }, + }, +} as const; + +// Load environment variables +dotenv.config(); + +// Get private key from environment variables +const privateKey = process.env.PRIVATE_KEY; +if (!privateKey) { + console.error('Error: PRIVATE_KEY not found in environment variables'); + process.exit(1); +} + +async function main() { + // Parse command line arguments + const args = process.argv.slice(2); + + if (args.length === 0) { + printUsage(); + process.exit(0); + } + + const functionName = args[0]; + let paramsStr = args.slice(1).join(' '); + + // Find the requested function in the tools array + const tool = tools.find(t => t.name === functionName); + + if (!tool) { + console.error(`Error: Function "${functionName}" not found`); + console.log('Available functions:'); + tools.forEach(t => console.log(`- ${t.name}`)); + process.exit(1); + } + + // If no parameters were provided but some are required, show the required parameters + if (!paramsStr && tool.required.length > 0) { + console.log(`Function "${functionName}" requires the following parameters:`); + tool.props.forEach(param => { + const isRequired = tool.required.includes(param.name); + console.log(`- ${param.name}${isRequired ? ' (required)' : ''}: ${param.description}`); + if (param.enum) { + console.log(` Allowed values: ${param.enum.join(', ')}`); + } + }); + process.exit(0); + } + + // Parse parameters + let params = parseParams(args); + + // If account parameter is needed but not provided, use the account from private key + if (tool.required.includes('account') && !params.account) { + const account = privateKeyToAccount(`0x${privateKey}`); + params.account = account.address; + console.log(`Using account address from private key: ${account.address}`); + } + + // Check required params + const missingParams = tool.required.filter(param => !(param in params)); + if (missingParams.length > 0) { + console.error(`Error: Missing required parameters: ${missingParams.join(', ')}`); + process.exit(1); + } + + console.log(`Calling function "${functionName}" with parameters:`, params); + + try { + // Setup chain config + const chainName = params.chainName; + if (!chainName) { + console.error('Error: chainName parameter is required'); + process.exit(1); + } + + // Get chain config based on name + let chainConfig; + if (chainName.toLowerCase() === 'sonic') { + chainConfig = sonic; + } else if (chainName.toLowerCase() === 'base') { + chainConfig = base; + } else { + console.error(`Error: Chain "${chainName}" not supported`); + process.exit(1); + } + + // Create public client + const publicClient = createPublicClient({ + chain: chainConfig, + transport: http(chainConfig.rpcUrls.default.http[0]) + }); + + // Create wallet client + const account = privateKeyToAccount(`0x${privateKey}`); + const walletClient = createWalletClient({ + account, + chain: chainConfig, + transport: http(chainConfig.rpcUrls.default.http[0]) + }); + + // Prepare the props object for the function (first argument) + const functionProps = { + ...params, + publicClient, + walletClient, + }; + + // Create a comprehensive options object with all required functions + const functionOptions = { + notify: async (message: string) => { + console.log(`[Notify] ${message}`); + }, + // Add getProvider function that returns the publicClient + getProvider: (chainId: number) => { + return publicClient; + }, + // Add proper evm structure matching SDK expectations + evm: { + getProvider: (chainId: number) => { + return publicClient; + }, + sendTransactions: async (txs: any) => { + if (!txs || !txs.transactions || txs.transactions.length === 0) { + console.error('[EVM-SendTx] No transactions provided.'); + return { success: false, data: [], error: 'No transactions provided' }; + } + + // Define type for transaction responses + type TxResponse = { hash: Hex; wait: () => Promise }; + const transactionResponses: TxResponse[] = []; + + for (const txDetail of txs.transactions) { + try { + console.log(`[EVM-SendTx] Sending transaction to target ${txDetail.target} with data ${txDetail.data ? txDetail.data.substring(0, 20) : 'N/A'}...`); + + const hash = await walletClient.sendTransaction({ + account: walletClient.account, + to: txDetail.target as Address, + data: txDetail.data as Hex, + value: txDetail.value ? BigInt(txDetail.value) : undefined, + chain: walletClient.chain, // Added chain + }); + console.log(`[EVM-SendTx] Transaction sent with hash: ${hash}`); + transactionResponses.push({ + hash: hash, + wait: async () => { + console.log(`[EVM-SendTx-Wait] Waiting for receipt for ${hash}...`); + let receipt: TransactionReceipt | null = null; + const maxRetries = 5; + const retryDelayMs = 3000; // 3 seconds + for (let i = 0; i < maxRetries; i++) { + try { + receipt = await publicClient.waitForTransactionReceipt({ hash }); + if (receipt) break; // Exit loop if receipt is found + } catch (e: any) { + if (i === maxRetries - 1) { + console.error(`[EVM-SendTx-Wait] Failed to get receipt for ${hash} after ${maxRetries} retries:`, e.message); + throw e; // Re-throw error after final attempt + } + console.log(`[EVM-SendTx-Wait] Receipt not found for ${hash} (attempt ${i + 1}/${maxRetries}), retrying in ${retryDelayMs / 1000}s...`); + await new Promise(resolve => setTimeout(resolve, retryDelayMs)); + } + } + if (!receipt) { + throw new Error(`Transaction receipt for ${hash} not found after ${maxRetries} retries.`); + } + console.log(`[EVM-SendTx-Wait] Receipt status for ${hash}: ${receipt.status}`); + return receipt; + } + }); + } catch (error: any) { + console.error(`[EVM-SendTx] Error sending transaction:`, error); + // Return a structure that indicates individual failure if needed, or let it be part of a partial success + return { success: false, data: transactionResponses, error: error.message || 'Unknown EVM transaction error' }; + } + } + return { success: true, data: transactionResponses }; + }, + signMessages: async (messages: any[]) => { + console.log(`[SignMsg] Would sign ${messages.length} messages in production`); + return messages.map(() => '0x0000000000000000000000000000000000000000000000000000000000000000'); + }, + signTypedDatas: async (args: any[]) => { + console.log(`[SignTypedData] Would sign ${args.length} typed data in production`); + return args.map(() => '0x0000000000000000000000000000000000000000000000000000000000000000'); + } + }, + // Add solana structure required by SDK + solana: { + getConnection: () => { + console.log(`[Solana] Would get connection in production`); + return {} as any; + }, + getPublicKey: async () => { + console.log(`[Solana] Would get public key in production`); + return {} as any; + }, + sendTransactions: async () => { + console.log(`[Solana] Would send transactions in production`); + return { success: true, data: [] }; + }, + signTransactions: async () => { + console.log(`[Solana] Would sign transactions in production`); + return []; + } + }, + // Add ton structure required by SDK + ton: { + getAddress: async () => { + console.log(`[TON] Would get address in production`); + return {} as any; + }, + getClient: async () => { + console.log(`[TON] Would get client in production`); + return {} as any; + }, + sendTransactions: async () => { + console.log(`[TON] Would send transactions in production`); + return { success: true, data: [] }; + } + }, + // Add sendTransactions for backward compatibility (This is likely the one used by removeLiquidity) + sendTransactions: async (txs: any) => { + if (!txs || !txs.transactions || txs.transactions.length === 0) { + console.error('[Legacy-SendTx] No transactions provided.'); + return { success: false, data: [], error: 'No transactions provided' }; + } + + // Define type for transaction responses + type TxResponse = { hash: Hex; wait: () => Promise }; + const transactionResponses: TxResponse[] = []; + + for (const txDetail of txs.transactions) { + try { + console.log(`[Legacy-SendTx] Sending transaction to target ${txDetail.target} with data ${txDetail.data ? txDetail.data.substring(0, 20) : 'N/A'}...`); + + const hash = await walletClient.sendTransaction({ + account: walletClient.account, + to: txDetail.target as Address, + data: txDetail.data as Hex, + value: txDetail.value ? BigInt(txDetail.value) : undefined, + chain: walletClient.chain, // Added chain + }); + console.log(`[Legacy-SendTx] Transaction sent with hash: ${hash}`); + transactionResponses.push({ + hash: hash, + wait: async () => { + console.log(`[Legacy-SendTx-Wait] Waiting for receipt for ${hash}...`); + let receipt: TransactionReceipt | null = null; + const maxRetries = 5; + const retryDelayMs = 3000; // 3 seconds + for (let i = 0; i < maxRetries; i++) { + try { + receipt = await publicClient.waitForTransactionReceipt({ hash }); + if (receipt) break; // Exit loop if receipt is found + } catch (e: any) { + if (i === maxRetries - 1) { + console.error(`[Legacy-SendTx-Wait] Failed to get receipt for ${hash} after ${maxRetries} retries:`, e.message); + throw e; // Re-throw error after final attempt + } + console.log(`[Legacy-SendTx-Wait] Receipt not found for ${hash} (attempt ${i + 1}/${maxRetries}), retrying in ${retryDelayMs / 1000}s...`); + await new Promise(resolve => setTimeout(resolve, retryDelayMs)); + } + } + if (!receipt) { + throw new Error(`Transaction receipt for ${hash} not found after ${maxRetries} retries.`); + } + console.log(`[Legacy-SendTx-Wait] Receipt status for ${hash}: ${receipt.status}`); + return receipt; + } + }); + } catch (error: any) { + console.error(`[Legacy-SendTx] Error sending transaction:`, error); + return { success: false, data: transactionResponses, error: error.message || 'Unknown legacy transaction error' }; + } + } + return { success: true, data: transactionResponses }; + }, + // Add getRecipient function required by SDK + getRecipient: async (type: string) => { + console.log(`[GetRecipient] Would get recipient for ${type} in production`); + return account.address; + } + }; + + // Get the actual function implementation + const functionImpl = functionMap[functionName]; + if (!functionImpl) { + console.error(`Error: Function implementation for "${functionName}" not found`); + process.exit(1); + } + + // Call the function with separate props and options arguments + console.log("\n--- Function Execution Start ---"); + const result = await functionImpl(functionProps, functionOptions); + console.log("--- Function Execution End ---"); + + console.log('\nResult:'); + const replacer = (key: any, value: any) => typeof value === 'bigint' ? value.toString() : value; + // Attempt to parse and pretty-print if data is JSON string + try { + if (result.success && typeof result.data === 'string') { + const jsonData = JSON.parse(result.data); + console.log(JSON.stringify(jsonData, replacer, 2)); + } else { + console.log(JSON.stringify(result, replacer, 2)); + } + } catch (e) { + // If parsing fails, print the raw result (potentially with BigInts, so use replacer) + console.log(JSON.stringify(result, replacer, 2)); + } + + // --- BEGIN ADDED CODE FOR LIVE TRANSACTION SENDING --- + if (result.success && result.data && typeof result.data === 'object' && !Array.isArray(result.data) && (result.data as any).target && (result.data as any).data) { + console.log("\n--- Attempting to Send Transaction Live ---"); + try { + const txParams = result.data as any; // Cast to any to access target, data, value + // The sendTransactions function in functionOptions expects an object like { transactions: [txDetail] } + // It also needs chainId and account for the top-level call to sendTransactions. + // These are available from params.chainName and the derived wallet account. + + const txPayload = { + chainId: chainConfig.id, + account: walletClient.account.address, // The account address + transactions: [txParams] // Wrap the single tx in an array + }; + + if (!txPayload.chainId) { + console.error("Critical: Could not determine chainId for sending transaction."); + process.exit(1); + } + + // Use the evm.sendTransactions for consistency if available, + // otherwise fall back to the legacy sendTransactions if it matches the expected structure. + let txReceipt; + if (functionOptions.evm && typeof functionOptions.evm.sendTransactions === 'function') { + console.log("Using evm.sendTransactions..."); + txReceipt = await functionOptions.evm.sendTransactions(txPayload); + } else if (typeof functionOptions.sendTransactions === 'function') { + console.log("Using legacy sendTransactions..."); + txReceipt = await functionOptions.sendTransactions(txPayload); + } else { + console.error("No suitable sendTransactions function found in functionOptions."); + process.exit(1); + } + + console.log("\n--- Live Transaction Result ---"); + if (txReceipt.success && txReceipt.data && txReceipt.data[0] && txReceipt.data[0].hash) { + console.log("Transaction sent successfully!"); + console.log("Hash:", txReceipt.data[0].hash); + console.log("Waiting for receipt..."); + const finalReceipt = await txReceipt.data[0].wait(); // wait() is part of the structure + const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value; + console.log("Receipt:", JSON.stringify(finalReceipt, replacer, 2)); + } else { + console.error("Failed to send transaction or get hash."); + const replacer = (key, value) => typeof value === 'bigint' ? value.toString() : value; + console.log("Response:", JSON.stringify(txReceipt, replacer, 2)); + } + } catch (sendError: any) { + console.error("\nError sending transaction live:", sendError.message); + if (sendError.stack) { + console.error(sendError.stack); + } + } + } else if (result.success && Array.isArray(result.data)) { + console.log("\nTransaction parameters generated (array), but automatic sending for arrays is not implemented in this addition."); + } else if (result.success) { + console.log("\nTransaction parameters generated, but not in expected object format for automatic sending or no transaction to send."); + } + // --- END ADDED CODE FOR LIVE TRANSACTION SENDING --- + + } catch (error) { + console.error('\nError executing function:', error.message); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); + } +} + +// Renamed helper function for clarity +function parseParams(args: string[]) { + let paramsStr = args.slice(1).join(' '); + let params; + try { + if (paramsStr && !paramsStr.trim().startsWith('{')) { + params = parseKeyValuePairs(args.slice(1)); + } else { + params = paramsStr ? JSON.parse(paramsStr) : {}; + } + } catch (error) { + console.error('Error parsing parameters:', error.message); + console.log('Parameters should be in either JSON format or name=value pairs'); + process.exit(1); + } + return params; +} + +// Helper function to parse key-value pairs from command line arguments +function parseKeyValuePairs(args) { + const result = {}; + + for (const arg of args) { + // Skip if doesn't match name=value pattern + if (!arg.includes('=')) continue; + + const [name, ...valueParts] = arg.split('='); + let value = valueParts.join('='); // Rejoin in case value itself contains = + + // Special handling for Ethereum addresses - always keep as string + if (typeof value === 'string' && value.startsWith('0x') && value.length === 42) { + result[name] = value; + continue; + } + + // Try to parse value as JSON if it looks like a boolean, number, or JSON structure + if (value.toLowerCase() === 'true') { + value = true; + } else if (value.toLowerCase() === 'false') { + value = false; + } else if (!isNaN(Number(value)) && value.trim() !== '') { + // Skip number conversion for values that look like they might be addresses + // even if they don't exactly match the 0x + 40 hex chars format + // Also skip conversion for certain parameter names that should remain strings + const stringParamNames = ['amount', 'amountIn', 'amountOut', 'minUsdg', 'minGlp', 'sizeUsd', 'collateralUsd']; + if (!(typeof value === 'string' && value.startsWith('0x') && value.length > 10) && !stringParamNames.includes(name)) { + value = Number(value); + } + } else if ((value.startsWith('{') && value.endsWith('}')) || + (value.startsWith('[') && value.endsWith(']'))) { + try { + value = JSON.parse(value); + } catch { + // If parse fails, keep as string + } + } + + result[name] = value; + } + + return result; +} + +// Print usage information +function printUsage() { + console.log('Usage: npm run function -- [parameters]'); + console.log(''); + console.log('Parameters can be provided in two formats:'); + console.log('1. As JSON: npm run function -- functionName \'{"param1": "value1", "param2": 123}\''); + console.log('2. As key-value pairs: npm run function -- functionName param1=value1 param2=123'); + console.log(''); + console.log('Available functions:'); + tools.forEach(tool => { + console.log(`- ${tool.name}: ${tool.description}`); + }); + console.log(''); + console.log('For detailed parameter information, run the command with just the function name:'); + console.log('npm run function -- functionName'); +} + +// Execute the main function +main().catch(error => { + console.error('Unhandled error:', error); + process.exit(1); +}); \ No newline at end of file diff --git a/projects/amped/scripts/list-functions.js b/projects/amped/scripts/list-functions.js new file mode 100644 index 00000000..a6c34b6a --- /dev/null +++ b/projects/amped/scripts/list-functions.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node +/** + * list-functions.js + * + * Lists all available functions in the tools.ts file + */ + +import { tools } from '../src/tools.js'; + +console.log('Available Amped Finance Functions:'); +console.log('==================================\n'); + +tools.forEach((tool, index) => { + console.log(`${index + 1}. ${tool.name}`); + console.log(` ${tool.description}`); + console.log(` Required params: ${tool.required.join(', ')}`); + console.log(''); +}); + +console.log(`Total functions: ${tools.length}`); \ No newline at end of file diff --git a/projects/amped/scripts/test-all-functions-with-results.ts b/projects/amped/scripts/test-all-functions-with-results.ts new file mode 100755 index 00000000..8c1d2365 --- /dev/null +++ b/projects/amped/scripts/test-all-functions-with-results.ts @@ -0,0 +1,590 @@ +#!/usr/bin/env tsx +/** + * test-all-functions-with-results.ts + * + * Comprehensive test suite for all Amped Finance functions + * Shows actual results and optionally runs state-changing functions + */ + +import { execSync } from 'child_process'; +import dotenv from 'dotenv'; +import { privateKeyToAccount } from 'viem/accounts'; + +// Load environment variables +dotenv.config(); + +// Test configuration +const TEST_CHAIN = process.env.TEST_CHAIN || 'sonic'; +const RUN_STATE_CHANGING = process.env.RUN_STATE_CHANGING === 'true'; + +// Get account address from private key if not provided directly +let TEST_ACCOUNT = process.env.TEST_ACCOUNT || process.env.ACCOUNT_ADDRESS; + +if (!TEST_ACCOUNT && process.env.PRIVATE_KEY) { + try { + const privateKey = process.env.PRIVATE_KEY.startsWith('0x') + ? process.env.PRIVATE_KEY as `0x${string}` + : `0x${process.env.PRIVATE_KEY}` as `0x${string}`; + const account = privateKeyToAccount(privateKey); + TEST_ACCOUNT = account.address; + console.log(`Derived account address from private key: ${TEST_ACCOUNT}`); + } catch (error) { + console.error('Failed to derive account from private key:', error); + } +} + +// Color codes for output +const GREEN = '\x1b[32m'; +const RED = '\x1b[31m'; +const YELLOW = '\x1b[33m'; +const BLUE = '\x1b[34m'; +const RESET = '\x1b[0m'; + +interface TestCase { + name: string; + function: string; + params: Record; + description: string; + skipExecution?: boolean; // For functions that modify state + category: 'read' | 'write'; +} + +// Define test cases in logical order +const testCases: TestCase[] = [ + // ===== READ-ONLY FUNCTIONS (Safe to run) ===== + + // 1. Pool and token information + { + name: 'Get Pool Liquidity', + function: 'getPoolLiquidity', + params: { + chainName: TEST_CHAIN + }, + description: 'Fetches overall pool liquidity and token information', + category: 'read' + }, + + // 2. User token balances + { + name: 'Get User Token Balances', + function: 'getUserTokenBalances', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches all token balances for the user', + category: 'read' + }, + + // 3. ALP information + { + name: 'Get User Liquidity', + function: 'getUserLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches user\'s ALP balance and related info', + category: 'read' + }, + + { + name: 'Get ALP APR', + function: 'getALPAPR', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches current APR for ALP tokens', + category: 'read' + }, + + { + name: 'Get Earnings', + function: 'getEarnings', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches user\'s earnings from providing liquidity', + category: 'read' + }, + + // 4. Trading liquidity checks + { + name: 'Get Swaps Liquidity', + function: 'getSwapsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches available liquidity for token swaps', + category: 'read' + }, + + { + name: 'Get Perps Liquidity (Long WETH)', + function: 'getPerpsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + isLong: true + }, + description: 'Fetches perpetual trading liquidity for long WETH positions', + category: 'read' + }, + + { + name: 'Get Perps Liquidity (Short USDC)', + function: 'getPerpsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + isLong: false + }, + description: 'Fetches perpetual trading liquidity for short USDC positions', + category: 'read' + }, + + // 5. Position checks + { + name: 'Get All Open Positions', + function: 'getAllOpenPositions', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches all open perpetual positions for the user', + category: 'read' + }, + + { + name: 'Get Specific Position', + function: 'getPosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + collateralTokenSymbol: 'USDC', + isLong: true + }, + description: 'Fetches details of a specific position (if exists)', + category: 'read' + }, + + // ===== STATE-CHANGING FUNCTIONS (Marked as skip by default) ===== + + // 6. Liquidity operations + { + name: 'Add Liquidity (USDC)', + function: 'addLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + amount: '0.1', // 0.1 USDC + minUsdg: '0', + minGlp: '0' + }, + description: 'Adds liquidity to the pool with USDC', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + }, + + { + name: 'Add Liquidity (Percentage)', + function: 'addLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + percentOfBalance: 5, // 5% of balance + minUsdg: '0', + minGlp: '0' + }, + description: 'Adds liquidity using percentage of balance', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + }, + + // Commented out due to 90-second cooldown period after adding liquidity + // { + // name: 'Remove Liquidity', + // function: 'removeLiquidity', + // params: { + // chainName: TEST_CHAIN, + // account: TEST_ACCOUNT, + // tokenOutSymbol: 'USDC', + // amount: '1', // 1 GLP + // slippageTolerance: 0.5 + // }, + // description: 'Removes liquidity from the pool', + // skipExecution: !RUN_STATE_CHANGING, + // category: 'write' + // }, + + { + name: 'Claim Rewards', + function: 'claimRewards', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Claims accumulated rewards', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + }, + + // 7. Trading operations + { + name: 'Market Swap', + function: 'marketSwap', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenIn: 'USDC', + tokenOut: 'S', + amountIn: '0.1', // 0.1 USDC + slippageBps: 100 // 1% + }, + description: 'Swaps USDC for S', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + }, + + { + name: 'Open Position', + function: 'openPosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + collateralTokenSymbol: 'USDC', + isLong: true, + sizeUsd: '1', // $1 position + collateralUsd: '0.2', // $0.2 collateral (5x leverage) + slippageBps: 30 + }, + description: 'Opens a 5x long WETH position with USDC collateral', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + }, + + { + name: 'Close Position', + function: 'closePosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + indexToken: undefined, // Close all positions + collateralToken: undefined, + isLong: undefined, + slippageBps: 30 + }, + description: 'Closes all open positions', + skipExecution: !RUN_STATE_CHANGING, + category: 'write' + } +]; + +// Execute a single test +async function runTest(test: TestCase, index: number): Promise { + console.log(`\n${YELLOW}[${index + 1}/${testCases.length}] ${test.name}${RESET}`); + console.log(`Function: ${test.function}`); + console.log(`Description: ${test.description}`); + + if (test.skipExecution) { + console.log(`${YELLOW}⚠️ Skipped (state-changing function - set RUN_STATE_CHANGING=true to run)${RESET}`); + return true; + } + + // Build command + const paramsStr = Object.entries(test.params) + .filter(([_, value]) => value !== undefined) + .map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`) + .join(' '); + + const command = `npm run function -- ${test.function} ${paramsStr}`; + console.log(`Command: ${command}`); + + try { + const output = execSync(command, { encoding: 'utf-8' }); + + // Extract result from output + const resultMatch = output.match(/Result:([\s\S]*?)(\n---|\n\[|$)/); + if (resultMatch) { + const resultStr = resultMatch[1].trim(); + try { + const result = JSON.parse(resultStr); + if (result.success || (result.success === undefined && result.data)) { + console.log(`${GREEN}✓ Success${RESET}`); + + // Print the actual result data + if (result.data) { + try { + const data = JSON.parse(result.data); + console.log(`${BLUE}Result:${RESET}`); + printDetailedData(test.function, data); + } catch { + // If data is not JSON, print as-is + console.log(`${BLUE}Result:${RESET} ${result.data}`); + } + } + return true; + } else { + console.log(`${RED}✗ Failed: ${result.data || result.error || 'Unknown error'}${RESET}`); + return false; + } + } catch (e) { + // Extract any meaningful data from non-JSON response + const notificationMatch = output.match(/\[Notification\]: (.*?)(?=\n|\[|$)/g); + if (notificationMatch) { + console.log(`${GREEN}✓ Completed${RESET}`); + console.log(`${BLUE}Notifications:${RESET}`); + notificationMatch.forEach(notification => { + const msg = notification.replace('[Notification]: ', ''); + console.log(` - ${msg}`); + }); + } else { + console.log(`${GREEN}✓ Completed${RESET}`); + // Try to extract meaningful content from output + const lines = output.split('\n').filter(line => + !line.includes('[Notification]') && + !line.includes('Result:') && + line.trim().length > 0 + ); + if (lines.length > 0) { + console.log(`${BLUE}Output:${RESET}`); + lines.slice(-5).forEach(line => console.log(` ${line}`)); + } + } + return true; + } + } else { + console.log(`${YELLOW}⚠️ No clear result found in output${RESET}`); + return true; + } + } catch (error) { + console.log(`${RED}✗ Error: ${error.message}${RESET}`); + return false; + } +} + +// Print detailed data based on function +function printDetailedData(functionName: string, data: any) { + switch (functionName) { + case 'getPoolLiquidity': + console.log(` AUM: $${data.aum}`); + console.log(` Total Supply: ${data.totalSupply} GLP`); + console.log(` GLP Price: $${data.glpPrice}`); + console.log(` Tokens in pool: ${data.tokens.length}`); + if (data.tokens.length > 0) { + console.log(` Sample tokens:`); + data.tokens.slice(0, 3).forEach(token => { + console.log(` - ${token.symbol}: ${token.poolAmount} ($${token.usdValue})`); + }); + } + break; + + case 'getUserTokenBalances': + console.log(` Total Balance: $${data.totalBalanceUsd}`); + const tokensWithBalance = data.tokens.filter(t => parseFloat(t.balance) > 0); + console.log(` Tokens with balance: ${tokensWithBalance.length}/${data.tokens.length}`); + if (tokensWithBalance.length > 0) { + console.log(` Balances:`); + tokensWithBalance.forEach(token => { + console.log(` - ${token.symbol}: ${token.balance} ($${token.balanceUsd})`); + }); + } + break; + + case 'getUserLiquidity': + console.log(` ALP Balance: ${data.totalAmount}`); + console.log(` Value: $${data.totalAmountUsd}`); + console.log(` Staked ALP: ${data.stakedAmount}`); + console.log(` Claimable Rewards: ${data.claimableRewards} WETH`); + console.log(` Vested ALP: ${data.vestedAmount}`); + break; + + case 'getALPAPR': + console.log(` Total APR: ${data.totalApr}%`); + console.log(` AMP APR: ${data.ampApr}%`); + console.log(` LP APR: ${data.lpApr}%`); + break; + + case 'getEarnings': + console.log(` Total claimable: ${data.totalClaimable}`); + if (data.rewards && data.rewards.length > 0) { + console.log(` Rewards breakdown:`); + data.rewards.forEach(reward => { + console.log(` - ${reward.token}: ${reward.amount} ($${reward.amountUsd})`); + }); + } + break; + + case 'getSwapsLiquidity': + console.log(` Supported tokens: ${data.tokens?.length || 0}`); + if (data.tokens && data.tokens.length > 0) { + console.log(` Sample liquidity:`); + data.tokens.slice(0, 3).forEach(token => { + console.log(` - ${token.symbol}: ${token.availableLiquidity} available`); + }); + } + break; + + case 'getPerpsLiquidity': + if (data.success && data.info) { + console.log(` Token: ${data.info.tokenSymbol}`); + console.log(` Available Liquidity: $${data.info.availableLiquidityUsd}`); + console.log(` Max Leverage: ${data.info.maxLeverage}x`); + console.log(` Current Price: $${data.info.currentPrice}`); + } else { + console.log(` ${data.message || 'No liquidity data available'}`); + } + break; + + case 'getAllOpenPositions': + if (data.success && data.positions) { + console.log(` Open Positions: ${data.positions.length}`); + if (data.positions.length > 0) { + console.log(` Total Position Value: $${data.totalPositionValue}`); + console.log(` Total Unrealized PnL: $${data.totalUnrealizedPnl}`); + console.log(` Total Collateral Value: $${data.totalCollateralValue}`); + console.log(` Positions:`); + data.positions.forEach((pos, i) => { + console.log(` ${i + 1}. ${pos.tokenSymbol} ${pos.isLong ? 'LONG' : 'SHORT'}: $${pos.position.size} (PnL: $${pos.position.unrealizedPnlUsd})`); + }); + } else { + console.log(` No open positions found`); + } + } + break; + + case 'getPosition': + if (data.success && data.position) { + const pos = data.position; + console.log(` Position size: $${pos.size}`); + console.log(` Collateral: ${pos.collateralAmount} ($${pos.collateralUsd})`); + console.log(` Leverage: ${pos.leverage}x`); + console.log(` Entry price: $${pos.averagePrice}`); + console.log(` Current price: $${pos.currentPrice}`); + console.log(` Unrealized PnL: $${pos.unrealizedPnlUsd} (${pos.unrealizedPnlPercentage}%)`); + console.log(` Liquidation price: $${pos.liquidationPrice}`); + } else { + console.log(` No position found`); + } + break; + + case 'marketSwap': + if (data.txHash) { + console.log(` Transaction hash: ${data.txHash}`); + console.log(` Status: ${data.status}`); + } + break; + + case 'openPosition': + case 'closePosition': + if (data.txHash) { + console.log(` Transaction hash: ${data.txHash}`); + console.log(` Status: ${data.status}`); + } + break; + + case 'addLiquidity': + case 'removeLiquidity': + if (data.txHash) { + console.log(` Transaction hash: ${data.txHash}`); + console.log(` Status: ${data.status}`); + } + break; + + case 'claimRewards': + if (data.txHash) { + console.log(` Transaction hash: ${data.txHash}`); + console.log(` Status: ${data.status}`); + } + break; + + default: + // Generic output for unknown functions + console.log(JSON.stringify(data, null, 2)); + } +} + +// Main execution +async function main() { + console.log(`${GREEN}=== Amped Finance Function Test Suite ===${RESET}`); + console.log(`Chain: ${TEST_CHAIN}`); + console.log(`Account: ${TEST_ACCOUNT}`); + console.log(`Run State-Changing Functions: ${RUN_STATE_CHANGING ? 'YES' : 'NO'}`); + + if (!TEST_ACCOUNT) { + console.error(`${RED}Error: No test account available.${RESET}`); + console.error(`${RED}Please provide one of the following in your .env file:${RESET}`); + console.error(`${RED}- PRIVATE_KEY=your_private_key (will derive account address)${RESET}`); + console.error(`${RED}- TEST_ACCOUNT=0x... (direct account address)${RESET}`); + console.error(`${RED}- ACCOUNT_ADDRESS=0x... (direct account address)${RESET}`); + process.exit(1); + } + + let passed = 0; + let failed = 0; + let skipped = 0; + + // Separate tests by category + const readTests = testCases.filter(t => t.category === 'read'); + const writeTests = testCases.filter(t => t.category === 'write'); + + console.log(`\n${BLUE}=== Running Read-Only Functions ===${RESET}`); + + // Run each test + for (let i = 0; i < testCases.length; i++) { + const test = testCases[i]; + + // Add separator between read and write tests + if (i === readTests.length && writeTests.length > 0) { + console.log(`\n${BLUE}=== Running State-Changing Functions ===${RESET}`); + } + + if (test.skipExecution) { + skipped++; + } else { + const success = await runTest(test, i); + if (success) { + passed++; + } else { + failed++; + } + } + + // Small delay between tests + if (i < testCases.length - 1) { + await new Promise(resolve => setTimeout(resolve, 1000)); + } + } + + // Summary + console.log(`\n${GREEN}=== Test Summary ===${RESET}`); + console.log(`Total: ${testCases.length}`); + console.log(`${GREEN}Passed: ${passed}${RESET}`); + console.log(`${RED}Failed: ${failed}${RESET}`); + console.log(`${YELLOW}Skipped: ${skipped}${RESET}`); + + if (failed > 0) { + console.log(`\n${RED}Some tests failed. Check the output above for details.${RESET}`); + process.exit(1); + } else { + console.log(`\n${GREEN}All enabled tests passed!${RESET}`); + if (skipped > 0 && !RUN_STATE_CHANGING) { + console.log(`${YELLOW}To run state-changing functions, set RUN_STATE_CHANGING=true${RESET}`); + } + } +} + +// Run the test suite +main().catch(error => { + console.error(`${RED}Unhandled error:${RESET}`, error); + process.exit(1); +}); \ No newline at end of file diff --git a/projects/amped/scripts/test-all-functions.ts b/projects/amped/scripts/test-all-functions.ts new file mode 100644 index 00000000..5e452785 --- /dev/null +++ b/projects/amped/scripts/test-all-functions.ts @@ -0,0 +1,432 @@ +#!/usr/bin/env tsx +/** + * test-all-functions.ts + * + * Comprehensive test suite for all Amped Finance functions + * Tests are ordered logically to ensure dependencies are met + */ + +import { execSync } from 'child_process'; +import dotenv from 'dotenv'; +import { privateKeyToAccount } from 'viem/accounts'; + +// Load environment variables +dotenv.config(); + +// Test configuration +const TEST_CHAIN = 'sonic'; // or 'base' + +// Get account address from private key if not provided directly +let TEST_ACCOUNT = process.env.TEST_ACCOUNT || process.env.ACCOUNT_ADDRESS; + +if (!TEST_ACCOUNT && process.env.PRIVATE_KEY) { + try { + const privateKey = process.env.PRIVATE_KEY.startsWith('0x') + ? process.env.PRIVATE_KEY as `0x${string}` + : `0x${process.env.PRIVATE_KEY}` as `0x${string}`; + const account = privateKeyToAccount(privateKey); + TEST_ACCOUNT = account.address; + console.log(`Derived account address from private key: ${TEST_ACCOUNT}`); + } catch (error) { + console.error('Failed to derive account from private key:', error); + } +} + +// Color codes for output +const GREEN = '\x1b[32m'; +const RED = '\x1b[31m'; +const YELLOW = '\x1b[33m'; +const RESET = '\x1b[0m'; + +interface TestCase { + name: string; + function: string; + params: Record; + description: string; + skipExecution?: boolean; // For functions that modify state +} + +// Define test cases in logical order +const testCases: TestCase[] = [ + // ===== READ-ONLY FUNCTIONS (Safe to run) ===== + + // 1. Pool and token information + { + name: 'Get Pool Liquidity', + function: 'getPoolLiquidity', + params: { + chainName: TEST_CHAIN + }, + description: 'Fetches overall pool liquidity and token information' + }, + + // 2. User token balances + { + name: 'Get User Token Balances', + function: 'getUserTokenBalances', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches all token balances for the user' + }, + + // 3. ALP information + { + name: 'Get User Liquidity', + function: 'getUserLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches user\'s ALP balance and related info' + }, + + { + name: 'Get ALP APR', + function: 'getALPAPR', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches current APR for ALP tokens' + }, + + { + name: 'Get Earnings', + function: 'getEarnings', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches user\'s earnings from providing liquidity' + }, + + // 4. Trading liquidity checks + { + name: 'Get Swaps Liquidity', + function: 'getSwapsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches available liquidity for token swaps' + }, + + { + name: 'Get Perps Liquidity (Long WETH)', + function: 'getPerpsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + isLong: true + }, + description: 'Fetches perpetual trading liquidity for long WETH positions' + }, + + { + name: 'Get Perps Liquidity (Short USDC)', + function: 'getPerpsLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + isLong: false + }, + description: 'Fetches perpetual trading liquidity for short USDC positions' + }, + + // 5. Position checks + { + name: 'Get All Open Positions', + function: 'getAllOpenPositions', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Fetches all open perpetual positions for the user' + }, + + { + name: 'Get Specific Position', + function: 'getPosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + collateralTokenSymbol: 'USDC', + isLong: true + }, + description: 'Fetches details of a specific position (if exists)' + }, + + // ===== STATE-CHANGING FUNCTIONS (Marked as skip by default) ===== + + // 6. Liquidity operations + { + name: 'Add Liquidity (USDC)', + function: 'addLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + amount: '1', // 1 USDC + minUsdg: '0', + minGlp: '0' + }, + description: 'Adds liquidity to the pool with USDC', + skipExecution: true + }, + + { + name: 'Add Liquidity (Percentage)', + function: 'addLiquidity', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'USDC', + percentOfBalance: 5, // 5% of balance + minUsdg: '0', + minGlp: '0' + }, + description: 'Adds liquidity using percentage of balance', + skipExecution: true + }, + + // Commented out due to 90-second cooldown period after adding liquidity + // { + // name: 'Remove Liquidity', + // function: 'removeLiquidity', + // params: { + // chainName: TEST_CHAIN, + // account: TEST_ACCOUNT, + // tokenOutSymbol: 'USDC', + // amount: '1', // 1 GLP + // slippageTolerance: 0.5 + // }, + // description: 'Removes liquidity from the pool', + // skipExecution: true + // }, + + { + name: 'Claim Rewards', + function: 'claimRewards', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT + }, + description: 'Claims accumulated rewards', + skipExecution: true + }, + + // 7. Trading operations + { + name: 'Market Swap', + function: 'marketSwap', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenIn: 'USDC', + tokenOut: 'WETH', + amountIn: '2', // 2 USDC + slippageBps: 100 // 1% + }, + description: 'Swaps USDC for WETH', + skipExecution: true + }, + + { + name: 'Open Position', + function: 'openPosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + tokenSymbol: 'WETH', + collateralTokenSymbol: 'USDC', + isLong: true, + sizeUsd: '10', // $10 position + collateralUsd: '2', // $2 collateral (5x leverage) + slippageBps: 30 + }, + description: 'Opens a 5x long WETH position with USDC collateral', + skipExecution: true + }, + + { + name: 'Close Position', + function: 'closePosition', + params: { + chainName: TEST_CHAIN, + account: TEST_ACCOUNT, + indexToken: undefined, // Close all positions + collateralToken: undefined, + isLong: undefined, + slippageBps: 30 + }, + description: 'Closes all open positions', + skipExecution: true + } +]; + +// Execute a single test +async function runTest(test: TestCase, index: number): Promise { + console.log(`\n${YELLOW}[${index + 1}/${testCases.length}] ${test.name}${RESET}`); + console.log(`Function: ${test.function}`); + console.log(`Description: ${test.description}`); + + if (test.skipExecution) { + console.log(`${YELLOW}⚠️ Skipped (state-changing function)${RESET}`); + return true; + } + + // Build command + const paramsStr = Object.entries(test.params) + .filter(([_, value]) => value !== undefined) + .map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`) + .join(' '); + + const command = `npm run function -- ${test.function} ${paramsStr}`; + console.log(`Command: ${command}`); + + try { + const output = execSync(command, { encoding: 'utf-8' }); + + // Extract result from output + const resultMatch = output.match(/Result:([\s\S]*?)(\n---|\n\[|$)/); + if (resultMatch) { + const resultStr = resultMatch[1].trim(); + try { + const result = JSON.parse(resultStr); + if (result.success || (result.success === undefined && result.data)) { + console.log(`${GREEN}✓ Success${RESET}`); + + // Print key data points + if (typeof result.data === 'string') { + try { + const data = JSON.parse(result.data); + printKeyData(test.function, data); + } catch { + console.log(`Data: ${result.data.substring(0, 100)}...`); + } + } + return true; + } else { + console.log(`${RED}✗ Failed: ${result.data || result.error || 'Unknown error'}${RESET}`); + return false; + } + } catch (e) { + console.log(`${GREEN}✓ Completed (non-JSON response)${RESET}`); + return true; + } + } else { + console.log(`${YELLOW}⚠️ No clear result found in output${RESET}`); + return true; + } + } catch (error) { + console.log(`${RED}✗ Error: ${error.message}${RESET}`); + return false; + } +} + +// Print key data points based on function +function printKeyData(functionName: string, data: any) { + switch (functionName) { + case 'getPoolLiquidity': + console.log(` - AUM: $${data.aum}`); + console.log(` - Total Supply: ${data.totalSupply} GLP`); + console.log(` - GLP Price: $${data.glpPrice}`); + console.log(` - Tokens: ${data.tokens.length}`); + break; + + case 'getUserTokenBalances': + console.log(` - Total Balance: $${data.totalBalanceUsd}`); + console.log(` - Tokens with balance: ${data.tokens.filter(t => parseFloat(t.balance) > 0).length}`); + break; + + case 'getUserLiquidity': + console.log(` - ALP Balance: ${data.totalAmount}`); + console.log(` - Value: $${data.totalAmountUsd}`); + console.log(` - Claimable Rewards: ${data.claimableRewards} WETH`); + break; + + case 'getALPAPR': + console.log(` - Total APR: ${data.totalApr}%`); + console.log(` - AMP APR: ${data.ampApr}%`); + console.log(` - LP APR: ${data.lpApr}%`); + break; + + case 'getPerpsLiquidity': + if (data.info) { + console.log(` - Available Liquidity: $${data.info.availableLiquidityUsd}`); + console.log(` - Max Leverage: ${data.info.maxLeverage}x`); + } + break; + + case 'getAllOpenPositions': + console.log(` - Open Positions: ${data.positions?.length || 0}`); + if (data.totalSummary) { + console.log(` - Total Size: $${data.totalSummary.totalSizeUsd}`); + console.log(` - Total PnL: $${data.totalSummary.totalUnrealizedPnlUsd}`); + } + break; + } +} + +// Main execution +async function main() { + console.log(`${GREEN}=== Amped Finance Function Test Suite ===${RESET}`); + console.log(`Chain: ${TEST_CHAIN}`); + console.log(`Account: ${TEST_ACCOUNT}`); + + if (!TEST_ACCOUNT) { + console.error(`${RED}Error: No test account available.${RESET}`); + console.error(`${RED}Please provide one of the following in your .env file:${RESET}`); + console.error(`${RED}- PRIVATE_KEY=your_private_key (will derive account address)${RESET}`); + console.error(`${RED}- TEST_ACCOUNT=0x... (direct account address)${RESET}`); + console.error(`${RED}- ACCOUNT_ADDRESS=0x... (direct account address)${RESET}`); + process.exit(1); + } + + let passed = 0; + let failed = 0; + let skipped = 0; + + // Run each test + for (let i = 0; i < testCases.length; i++) { + const test = testCases[i]; + + if (test.skipExecution) { + skipped++; + } else { + const success = await runTest(test, i); + if (success) { + passed++; + } else { + failed++; + } + } + + // Small delay between tests + if (i < testCases.length - 1) { + await new Promise(resolve => setTimeout(resolve, 1000)); + } + } + + // Summary + console.log(`\n${GREEN}=== Test Summary ===${RESET}`); + console.log(`Total: ${testCases.length}`); + console.log(`${GREEN}Passed: ${passed}${RESET}`); + console.log(`${RED}Failed: ${failed}${RESET}`); + console.log(`${YELLOW}Skipped: ${skipped}${RESET}`); + + if (failed > 0) { + process.exit(1); + } +} + +// Run the test suite +main().catch(error => { + console.error(`${RED}Unhandled error:${RESET}`, error); + process.exit(1); +}); \ No newline at end of file diff --git a/projects/amped/scripts/test-function.sh b/projects/amped/scripts/test-function.sh new file mode 100755 index 00000000..7a2ca0b3 --- /dev/null +++ b/projects/amped/scripts/test-function.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Test a function using the direct function call script +# Usage: ./test-function.sh [params...] + +if [ $# -eq 0 ]; then + echo "Usage: $0 [params...]" + echo "Example: $0 getPoolLiquidity chainName=sonic" + exit 1 +fi + +cd "$(dirname "$0")/.." + +# Set up environment +export NODE_ENV=development + +# Check if .env exists +if [ ! -f .env ]; then + echo "Error: .env file not found" + echo "Please create a .env file with your PRIVATE_KEY" + exit 1 +fi + +# Run the function +echo "Testing function: $1" +echo "Parameters: ${@:2}" +echo "---" + +# Use npx to run tsx without relying on local installation +npx tsx scripts/direct-function-call.ts "$@" \ No newline at end of file diff --git a/projects/amped/scripts/test-market-swap.ts b/projects/amped/scripts/test-market-swap.ts new file mode 100644 index 00000000..84b7878d --- /dev/null +++ b/projects/amped/scripts/test-market-swap.ts @@ -0,0 +1,166 @@ +#!/usr/bin/env tsx +/** + * Test Market Swap Function + * + * This script is designed specifically to test the marketSwap function + * with proper parameter passing. + */ + +import dotenv from 'dotenv'; +import { marketSwap } from '../src/functions/trading/swaps/marketSwap.js'; +import { createWalletClient, createPublicClient, http } from 'viem'; +import { privateKeyToAccount } from 'viem/accounts'; +import { CHAIN_CONFIG } from '../src/constants.js'; + +// Load environment variables +dotenv.config(); + +// Get private key from environment variables +const privateKey = process.env.PRIVATE_KEY; +if (!privateKey) { + console.error('Error: PRIVATE_KEY not found in environment variables'); + process.exit(1); +} + +async function main() { + try { + const chainName = "sonic"; + const chainConfig = CHAIN_CONFIG[chainName]; + + // Create public client + const publicClient = createPublicClient({ + chain: chainConfig, + transport: http(chainConfig.rpcUrls.default.http[0]) + }); + + // Create wallet client + const account = privateKeyToAccount(`0x${privateKey}`); + const walletClient = createWalletClient({ + account, + chain: chainConfig, + transport: http(chainConfig.rpcUrls.default.http[0]) + }); + + console.log(`Using account: ${account.address}`); + + // Function parameters + const marketSwapProps = { + chainName, + account: account.address, + tokenIn: 'USDC', + tokenOut: 'ANON', + amountIn: '1', + slippageBps: 50, + publicClient, // Include publicClient in props + walletClient // Include walletClient in props + }; + + // Create options object with all required functions + const functionOptions = { + notify: async (message: string) => { + console.log(`[Notify] ${message}`); + }, + getProvider: (chainId: number) => { + return publicClient; + }, + evm: { + getProvider: (chainId: number) => { + return publicClient; + }, + sendTransactions: async (txs: any) => { + console.log(`[SendTx] Would send ${txs.transactions?.length || 1} transactions in production`); + return { + success: true, + data: [{ + hash: '0x0000000000000000000000000000000000000000000000000000000000000000', + wait: async () => ({ status: 'success' }) + }] + }; + }, + signMessages: async (messages: any[]) => { + console.log(`[SignMsg] Would sign ${messages.length} messages in production`); + return messages.map(() => '0x0000000000000000000000000000000000000000000000000000000000000000'); + }, + signTypedDatas: async (args: any[]) => { + console.log(`[SignTypedData] Would sign ${args.length} typed data in production`); + return args.map(() => '0x0000000000000000000000000000000000000000000000000000000000000000'); + } + }, + solana: { + getConnection: () => { + console.log(`[Solana] Would get connection in production`); + return {} as any; + }, + getPublicKey: async () => { + console.log(`[Solana] Would get public key in production`); + return {} as any; + }, + sendTransactions: async () => { + console.log(`[Solana] Would send transactions in production`); + return { success: true, data: [] }; + }, + signTransactions: async () => { + console.log(`[Solana] Would sign transactions in production`); + return []; + } + }, + ton: { + getAddress: async () => { + console.log(`[TON] Would get address in production`); + return {} as any; + }, + getClient: async () => { + console.log(`[TON] Would get client in production`); + return {} as any; + }, + sendTransactions: async () => { + console.log(`[TON] Would send transactions in production`); + return { success: true, data: [] }; + } + }, + sendTransactions: async (txs: any) => { + console.log(`[SendTx-Legacy] Would send ${txs.transactions?.length || 1} transactions in production`); + return { + success: true, + data: [{ + hash: '0x0000000000000000000000000000000000000000000000000000000000000000', + wait: async () => ({ status: 'success' }) + }] + }; + }, + getRecipient: async (type: string) => { + console.log(`[GetRecipient] Would get recipient for ${type} in production`); + return account.address; + } + }; + + console.log("--- Executing marketSwap ---"); + const result = await marketSwap(marketSwapProps, functionOptions); + console.log("--- Execution Complete ---"); + + console.log('\nResult:'); + if (result.success && typeof result.data === 'string') { + try { + const jsonData = JSON.parse(result.data); + console.log(JSON.stringify(jsonData, null, 2)); + } catch (e) { + console.log(result.data); + } + } else { + console.log(result); + } + + } catch (error) { + console.error('\nError executing marketSwap:', error.message); + if (error.stack) { + console.error(error.stack); + } + process.exit(1); + } +} + +// Execute the main function +main().catch(error => { + console.error('Unhandled error:', error); + process.exit(1); +}); \ No newline at end of file diff --git a/projects/amped/src/abis/ERC20.js b/projects/amped/src/abis/ERC20.js new file mode 100644 index 00000000..521aafba --- /dev/null +++ b/projects/amped/src/abis/ERC20.js @@ -0,0 +1,95 @@ +export var ERC20 = [ + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } +]; diff --git a/projects/amped/src/abis/ERC20.ts b/projects/amped/src/abis/ERC20.ts new file mode 100644 index 00000000..4b5828f6 --- /dev/null +++ b/projects/amped/src/abis/ERC20.ts @@ -0,0 +1,95 @@ +export const ERC20 = [ + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/abis/GlpManager.json b/projects/amped/src/abis/GlpManager.json new file mode 100644 index 00000000..0b865961 --- /dev/null +++ b/projects/amped/src/abis/GlpManager.json @@ -0,0 +1,748 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "GlpManager", + "sourceName": "contracts/core/GlpManager.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_vault", + "type": "address" + }, + { + "internalType": "address", + "name": "_usdg", + "type": "address" + }, + { + "internalType": "address", + "name": "_glp", + "type": "address" + }, + { + "internalType": "address", + "name": "_shortsTracker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_cooldownDuration", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "aumInUsdg", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "glpSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "usdgAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "AddLiquidity", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "glpAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "aumInUsdg", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "glpSupply", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "usdgAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "name": "RemoveLiquidity", + "type": "event" + }, + { + "inputs": [], + "name": "BASIS_POINTS_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "GLP_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MAX_COOLDOWN_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PRICE_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USDG_DECIMALS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minUsdg", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minGlp", + "type": "uint256" + } + ], + "name": "addLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_fundingAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minUsdg", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minGlp", + "type": "uint256" + } + ], + "name": "addLiquidityForAccount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "aumAddition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "aumDeduction", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "cooldownDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "maximise", + "type": "bool" + } + ], + "name": "getAum", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "maximise", + "type": "bool" + } + ], + "name": "getAumInUsdg", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAums", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getGlobalShortAveragePrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_size", + "type": "uint256" + } + ], + "name": "getGlobalShortDelta", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_maximise", + "type": "bool" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "glp", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gov", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inPrivateMode", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isHandler", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "lastAddedAt", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_glpAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "removeLiquidity", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_glpAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "removeLiquidityForAccount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_aumAddition", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_aumDeduction", + "type": "uint256" + } + ], + "name": "setAumAdjustment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_cooldownDuration", + "type": "uint256" + } + ], + "name": "setCooldownDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + } + ], + "name": "setGov", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_handler", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isActive", + "type": "bool" + } + ], + "name": "setHandler", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_inPrivateMode", + "type": "bool" + } + ], + "name": "setInPrivateMode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IShortsTracker", + "name": "_shortsTracker", + "type": "address" + } + ], + "name": "setShortsTracker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_shortsTrackerAveragePriceWeight", + "type": "uint256" + } + ], + "name": "setShortsTrackerAveragePriceWeight", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortsTracker", + "outputs": [ + { + "internalType": "contract IShortsTracker", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "shortsTrackerAveragePriceWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "usdg", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "contract IVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060405161265f38038061265f833981810160405260a081101561003357600080fd5b5080516020820151604083015160608401516080909401516001600081905580546001600160a01b031990811633908117821617909155600280546001600160a01b039687169083161790556004805494861694821694909417909355600580549285169284169290921790915560038054939094169290911691909117909155600655612599806100c66000396000f3fe608060405234801561001057600080fd5b50600436106101965760003560e01c8063033914761461019b578063070eacee146101cc578063126082cf146101e857806312d43a51146101f057806317eb2a1514610214578063196b68cb1461025c5780631e9049cf146102645780631ece366a1461026c57806335269315146102a4578063440d828a146102ac57806346ea87af146102d25780634f5f6b5e146102f857806364e6617f14610317578063657bc5d01461031f578063662f1c681461032757806368a0a3e01461032f5780636a86da191461034e57806371d597ad1461036d57806378a207ee146103b1578063870d917c146103b95780638b770e11146103c15780638fed0b2c146103e75780639116c4ae1461042157806395082d2514610444578063966be0751461044c5780639cb7de4b14610469578063a1acd3d514610497578063b172bb0c146104e2578063cfad57a2146104ea578063d34ee09314610510578063e245b5af14610536578063ed0d1c0414610555578063f5b91b7b146105ad578063fbfa77cf146105b5575b600080fd5b6101ba600480360360208110156101b157600080fd5b503515156105bd565b60408051918252519081900360200190f35b6101d4610c3b565b604080519115158252519081900360200190f35b6101ba610c44565b6101f8610c4a565b604080516001600160a01b039092168252519081900360200190f35b6101ba600480360360c081101561022a57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a00135610c59565b6101ba610ccc565b6101ba610cd2565b6101ba6004803603608081101561028257600080fd5b506001600160a01b038135169060208101359060408101359060600135610cd9565b6101ba610d88565b6101ba600480360360208110156102c257600080fd5b50356001600160a01b0316610d8e565b6101d4600480360360208110156102e857600080fd5b50356001600160a01b031661109f565b6103156004803603602081101561030e57600080fd5b50356110b4565b005b6101ba61115c565b6101f8611162565b6101ba611171565b6101ba6004803603602081101561034557600080fd5b5035151561117d565b6103156004803603602081101561036457600080fd5b503515156111b4565b6101ba600480360360a081101561038357600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160809091013516611214565b6101f8611285565b6101ba611294565b6101ba600480360360208110156103d757600080fd5b50356001600160a01b0316611299565b6101ba600480360360808110156103fd57600080fd5b506001600160a01b03813581169160208101359160408201359160600135166112ab565b6103156004803603604081101561043757600080fd5b508035906020013561134b565b6101ba6113a3565b6103156004803603602081101561046257600080fd5b50356113b3565b6103156004803603604081101561047f57600080fd5b506001600160a01b0381351690602001351515611447565b6104c9600480360360608110156104ad57600080fd5b506001600160a01b0381351690602081013590604001356114bf565b6040805192835290151560208301528051918290030190f35b6101ba611513565b6103156004803603602081101561050057600080fd5b50356001600160a01b0316611519565b6103156004803603602081101561052657600080fd5b50356001600160a01b0316611588565b6101ba6004803603602081101561054c57600080fd5b503515156115f7565b61055d6116a1565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610599578181015183820152602001610581565b505050509050019250505060405180910390f35b6101f861170f565b6101f861171e565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316630842b0766040518163ffffffff1660e01b815260040160206040518083038186803b15801561060e57600080fd5b505afa158015610622573d6000803e3d6000fd5b505050506040513d602081101561063857600080fd5b5051600854600254919250906000906001600160a01b0316815b84811015610bf45760025460408051630e468baf60e41b81526004810184905290516000926001600160a01b03169163e468baf0916024808301926020929190829003018186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d60208110156106d057600080fd5b505160025460408051630daf9c2160e41b81526001600160a01b0380851660048301529151939450600093919092169163daf9c210916024808301926020929190829003018186803b15801561072557600080fd5b505afa158015610739573d6000803e3d6000fd5b505050506040513d602081101561074f57600080fd5b505190508061075f575050610bec565b6000896107e457846001600160a01b03166381a612d6846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156107b357600080fd5b505afa1580156107c7573d6000803e3d6000fd5b505050506040513d60208110156107dd57600080fd5b505161085e565b846001600160a01b031663e124e6d2846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561083157600080fd5b505afa158015610845573d6000803e3d6000fd5b505050506040513d602081101561085b57600080fd5b50515b90506000856001600160a01b03166352f55eed856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108af57600080fd5b505afa1580156108c3573d6000803e3d6000fd5b505050506040513d60208110156108d957600080fd5b5051604080516323b95ceb60e21b81526001600160a01b038781166004830152915192935060009291891691638ee573ac91602480820192602092909190829003018186803b15801561092b57600080fd5b505afa15801561093f573d6000803e3d6000fd5b505050506040513d602081101561095557600080fd5b5051604080516342b60b0360e01b81526001600160a01b0388811660048301529151929350908916916342b60b0391602480820192602092909190829003018186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d60208110156109ce57600080fd5b5051156109fe576109f76109f0600a83900a6109ea858761172d565b9061178f565b8a906117ce565b9850610be6565b6000876001600160a01b0316638a78daa8876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6020811015610a7757600080fd5b505190508015610ab957600080610a8f8887856114bf565b9150915080610aa957610aa28c836117ce565b9b50610ab6565b610ab38b836117ce565b9a505b50505b610b3c886001600160a01b031663f07456ce886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b50518b906117ce565b99506000886001600160a01b031663c3c7b9e9886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610b8d57600080fd5b505afa158015610ba1573d6000803e3d6000fd5b505050506040513d6020811015610bb757600080fd5b50519050610be1610bda600a85900a6109ea88610bd48987611826565b9061172d565b8c906117ce565b9a5050505b50505050505b600101610652565b50828211610c0b57610c068383611826565b610c0e565b60005b92508260095411610c2c57600954610c27908490611826565b610c2f565b60005b9450505050505b919050565b600a5460ff1681565b61271081565b6001546001600160a01b031681565b600060026000541415610ca1576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055610cae611868565b610cbc8787878787876118c6565b6001600055979650505050505050565b60085481565b6202a30081565b600060026000541415610d21576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055600a5460ff1615610d6c576040805162461bcd60e51b815260206004820152601e6024820152600080516020612486833981519152604482015290519081900360640190fd5b610d7a3333878787876118c6565b600160005595945050505050565b60065481565b6003546000906001600160a01b0316801580610e0c5750806001600160a01b0316639a11178f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dde57600080fd5b505afa158015610df2573d6000803e3d6000fd5b505050506040513d6020811015610e0857600080fd5b5051155b15610e935760025460408051636274980360e01b81526001600160a01b038681166004830152915191909216916362749803916024808301926020929190829003018186803b158015610e5e57600080fd5b505afa158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b50519150610c369050565b600b5480610f1e5760025460408051636274980360e01b81526001600160a01b038781166004830152915191909216916362749803916024808301926020929190829003018186803b158015610ee857600080fd5b505afa158015610efc573d6000803e3d6000fd5b505050506040513d6020811015610f1257600080fd5b50519250610c36915050565b612710811415610f7557816001600160a01b03166362749803856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ee857600080fd5b60025460408051636274980360e01b81526001600160a01b03878116600483015291516000939290921691636274980391602480820192602092909190829003018186803b158015610fc657600080fd5b505afa158015610fda573d6000803e3d6000fd5b505050506040513d6020811015610ff057600080fd5b505160408051636274980360e01b81526001600160a01b038881166004830152915192935060009291861691636274980391602480820192602092909190829003018186803b15801561104257600080fd5b505afa158015611056573d6000803e3d6000fd5b505050506040513d602081101561106c57600080fd5b50519050610c2f6127106109ea611083848761172d565b61109961109261271089611826565b879061172d565b906117ce565b600c6020526000908152604090205460ff1681565b6001546001600160a01b03163314611101576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b612710600b541115611157576040805162461bcd60e51b815260206004820152601a60248201527911db1c13585b9859d95c8e881a5b9d985b1a59081dd95a59da1d60321b604482015290519081900360640190fd5b600b55565b600b5481565b6003546001600160a01b031681565b670de0b6b3a764000081565b600080611189836105bd565b90506111ad68327cb2734119d3b7a9601e1b6109ea83670de0b6b3a764000061172d565b9392505050565b6001546001600160a01b03163314611201576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600a805460ff1916911515919091179055565b60006002600054141561125c576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055611269611868565b6112768686868686611bdf565b60016000559695505050505050565b6005546001600160a01b031681565b601281565b60076020526000908152604090205481565b6000600260005414156112f3576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055600a5460ff161561133e576040805162461bcd60e51b815260206004820152601e6024820152600080516020612486833981519152604482015290519081900360640190fd5b610d7a3386868686611bdf565b6001546001600160a01b03163314611398576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600891909155600955565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b03163314611400576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b6202a3008111156114425760405162461bcd60e51b81526004018080602001828103825260258152602001806124216025913960400191505060405180910390fd5b600655565b6001546001600160a01b03163314611494576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b60008060006114cd86610d8e565b905060008582116114e7576114e28683611826565b6114f1565b6114f18287611826565b90506000611503836109ea888561172d565b9450505084109050935093915050565b60095481565b6001546001600160a01b03163314611566576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146115d5576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600080611603836105bd565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561165557600080fd5b505afa158015611669573d6000803e3d6000fd5b505050506040513d602081101561167f57600080fd5b50519050611699816109ea84670de0b6b3a764000061172d565b949350505050565b6040805160028082526060808301845292839291906020830190803683370190505090506116cf60016105bd565b816000815181106116dc57fe5b6020026020010181815250506116f260006105bd565b816001815181106116ff57fe5b6020908102919091010152905090565b6004546001600160a01b031681565b6002546001600160a01b031681565b60008261173c57506000611789565b8282028284828161174957fe5b04146117865760405162461bcd60e51b81526004018080602001828103825260218152602001806124d26021913960400191505060405180910390fd5b90505b92915050565b600061178683836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061207c565b600082820183811015611786576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b600061178683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061211e565b336000908152600c602052604090205460ff166118c4576040805162461bcd60e51b815260206004820152601560248201527423b63826b0b730b3b2b91d103337b93134b23232b760591b604482015290519081900360640190fd5b565b600080841161191a576040805162461bcd60e51b815260206004820152601b60248201527a11db1c13585b9859d95c8e881a5b9d985b1a590817d85b5bdd5b9d602a1b604482015290519081900360640190fd5b6000611926600161117d565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561197857600080fd5b505afa15801561198c573d6000803e3d6000fd5b505050506040513d60208110156119a257600080fd5b50516002549091506119c3906001600160a01b03898116918c911689612178565b6002546040805163817bb85760e01b81526001600160a01b038a811660048301523060248301529151600093929092169163817bb8579160448082019260209290919082900301818787803b158015611a1b57600080fd5b505af1158015611a2f573d6000803e3d6000fd5b505050506040513d6020811015611a4557600080fd5b5051905085811015611a885760405162461bcd60e51b81526004018080602001828103825260248152602001806125166024913960400191505060405180910390fd5b60008315611aa357611a9e846109ea848661172d565b611aa5565b815b905085811015611ae65760405162461bcd60e51b81526004018080602001828103825260238152602001806124f36023913960400191505060405180910390fd5b600554604080516340c10f1960e01b81526001600160a01b038d8116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b158015611b3b57600080fd5b505af1158015611b4f573d6000803e3d6000fd5b5050506001600160a01b03808c166000818152600760209081526040918290204290558151928352928d16928201929092528082018b9052606081018790526080810186905260a0810185905260c0810184905290517f38dc38b96482be64113daffd8d464ebda93e856b70ccfc605e69ccf892ab981e92509081900360e00190a19a9950505050505050505050565b6000808411611c35576040805162461bcd60e51b815260206004820152601e60248201527f476c704d616e616765723a20696e76616c6964205f676c70416d6f756e740000604482015290519081900360640190fd5b6006546001600160a01b0387166000908152600760205260409020544291611c5d91906117ce565b1115611c9a5760405162461bcd60e51b815260040180806020018281038252602c8152602001806124a6602c913960400191505060405180910390fd5b6000611ca6600061117d565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cf857600080fd5b505afa158015611d0c573d6000803e3d6000fd5b505050506040513d6020811015611d2257600080fd5b505190506000611d36826109ea898661172d565b60048054604080516370a0823160e01b81523093810193909352519293506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611d8857600080fd5b505afa158015611d9c573d6000803e3d6000fd5b505050506040513d6020811015611db257600080fd5b5051905080821115611e39576004546001600160a01b03166340c10f1930611dda8585611826565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611e2057600080fd5b505af1158015611e34573d6000803e3d6000fd5b505050505b60055460408051632770a7eb60e21b81526001600160a01b038d81166004830152602482018c905291519190921691639dc29fac91604480830192600092919082900301818387803b158015611e8e57600080fd5b505af1158015611ea2573d6000803e3d6000fd5b5050600480546002546040805163a9059cbb60e01b81526001600160a01b039283169481019490945260248401889052519116935063a9059cbb925060448083019260209291908290030181600087803b158015611eff57600080fd5b505af1158015611f13573d6000803e3d6000fd5b505050506040513d6020811015611f2957600080fd5b505060025460408051630711e61960e41b81526001600160a01b038c8116600483015289811660248301529151600093929092169163711e61909160448082019260209290919082900301818787803b158015611f8557600080fd5b505af1158015611f99573d6000803e3d6000fd5b505050506040513d6020811015611faf57600080fd5b5051905087811015612008576040805162461bcd60e51b815260206004820152601f60248201527f476c704d616e616765723a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b604080516001600160a01b03808e1682528c1660208201528082018b9052606081018790526080810186905260a0810185905260c0810183905290517f87b9679bb9a4944bafa98c267e7cd4a00ab29fed48afdefae25f0fca5da279409181900360e00190a19a9950505050505050505050565b600081836121085760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156120cd5781810151838201526020016120b5565b50505050905090810190601f1680156120fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161211457fe5b0495945050505050565b600081848411156121705760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156120cd5781810151838201526020016120b5565b505050900390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526121d29085906121d8565b50505050565b606061222d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661228e9092919063ffffffff16565b8051909150156122895780806020019051602081101561224c57600080fd5b50516122895760405162461bcd60e51b815260040180806020018281038252602a81526020018061253a602a913960400191505060405180910390fd5b505050565b60606116998484600085856122a2856123b4565b6122f3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106123325780518252601f199092019160209182019101612313565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612394576040519150601f19603f3d011682016040523d82523d6000602084013e612399565b606091505b50915091506123a98282866123ba565b979650505050505050565b3b151590565b606083156123c95750816111ad565b8251156123d95782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156120cd5781810151838201526020016120b556fe476c704d616e616765723a20696e76616c6964205f636f6f6c646f776e4475726174696f6e5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000476c704d616e616765723a20616374696f6e206e6f7420656e61626c65640000476c704d616e616765723a20636f6f6c646f776e206475726174696f6e206e6f742079657420706173736564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77476c704d616e616765723a20696e73756666696369656e7420474c50206f7574707574476c704d616e616765723a20696e73756666696369656e742055534447206f75747075745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122033eefe0f6c8ce7a315b2ab9192fe27c84ceb141e63d0ff743958ee46771183eb64736f6c634300060c0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101965760003560e01c8063033914761461019b578063070eacee146101cc578063126082cf146101e857806312d43a51146101f057806317eb2a1514610214578063196b68cb1461025c5780631e9049cf146102645780631ece366a1461026c57806335269315146102a4578063440d828a146102ac57806346ea87af146102d25780634f5f6b5e146102f857806364e6617f14610317578063657bc5d01461031f578063662f1c681461032757806368a0a3e01461032f5780636a86da191461034e57806371d597ad1461036d57806378a207ee146103b1578063870d917c146103b95780638b770e11146103c15780638fed0b2c146103e75780639116c4ae1461042157806395082d2514610444578063966be0751461044c5780639cb7de4b14610469578063a1acd3d514610497578063b172bb0c146104e2578063cfad57a2146104ea578063d34ee09314610510578063e245b5af14610536578063ed0d1c0414610555578063f5b91b7b146105ad578063fbfa77cf146105b5575b600080fd5b6101ba600480360360208110156101b157600080fd5b503515156105bd565b60408051918252519081900360200190f35b6101d4610c3b565b604080519115158252519081900360200190f35b6101ba610c44565b6101f8610c4a565b604080516001600160a01b039092168252519081900360200190f35b6101ba600480360360c081101561022a57600080fd5b506001600160a01b03813581169160208101358216916040820135169060608101359060808101359060a00135610c59565b6101ba610ccc565b6101ba610cd2565b6101ba6004803603608081101561028257600080fd5b506001600160a01b038135169060208101359060408101359060600135610cd9565b6101ba610d88565b6101ba600480360360208110156102c257600080fd5b50356001600160a01b0316610d8e565b6101d4600480360360208110156102e857600080fd5b50356001600160a01b031661109f565b6103156004803603602081101561030e57600080fd5b50356110b4565b005b6101ba61115c565b6101f8611162565b6101ba611171565b6101ba6004803603602081101561034557600080fd5b5035151561117d565b6103156004803603602081101561036457600080fd5b503515156111b4565b6101ba600480360360a081101561038357600080fd5b506001600160a01b038135811691602081013582169160408201359160608101359160809091013516611214565b6101f8611285565b6101ba611294565b6101ba600480360360208110156103d757600080fd5b50356001600160a01b0316611299565b6101ba600480360360808110156103fd57600080fd5b506001600160a01b03813581169160208101359160408201359160600135166112ab565b6103156004803603604081101561043757600080fd5b508035906020013561134b565b6101ba6113a3565b6103156004803603602081101561046257600080fd5b50356113b3565b6103156004803603604081101561047f57600080fd5b506001600160a01b0381351690602001351515611447565b6104c9600480360360608110156104ad57600080fd5b506001600160a01b0381351690602081013590604001356114bf565b6040805192835290151560208301528051918290030190f35b6101ba611513565b6103156004803603602081101561050057600080fd5b50356001600160a01b0316611519565b6103156004803603602081101561052657600080fd5b50356001600160a01b0316611588565b6101ba6004803603602081101561054c57600080fd5b503515156115f7565b61055d6116a1565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610599578181015183820152602001610581565b505050509050019250505060405180910390f35b6101f861170f565b6101f861171e565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316630842b0766040518163ffffffff1660e01b815260040160206040518083038186803b15801561060e57600080fd5b505afa158015610622573d6000803e3d6000fd5b505050506040513d602081101561063857600080fd5b5051600854600254919250906000906001600160a01b0316815b84811015610bf45760025460408051630e468baf60e41b81526004810184905290516000926001600160a01b03169163e468baf0916024808301926020929190829003018186803b1580156106a657600080fd5b505afa1580156106ba573d6000803e3d6000fd5b505050506040513d60208110156106d057600080fd5b505160025460408051630daf9c2160e41b81526001600160a01b0380851660048301529151939450600093919092169163daf9c210916024808301926020929190829003018186803b15801561072557600080fd5b505afa158015610739573d6000803e3d6000fd5b505050506040513d602081101561074f57600080fd5b505190508061075f575050610bec565b6000896107e457846001600160a01b03166381a612d6846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156107b357600080fd5b505afa1580156107c7573d6000803e3d6000fd5b505050506040513d60208110156107dd57600080fd5b505161085e565b846001600160a01b031663e124e6d2846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561083157600080fd5b505afa158015610845573d6000803e3d6000fd5b505050506040513d602081101561085b57600080fd5b50515b90506000856001600160a01b03166352f55eed856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156108af57600080fd5b505afa1580156108c3573d6000803e3d6000fd5b505050506040513d60208110156108d957600080fd5b5051604080516323b95ceb60e21b81526001600160a01b038781166004830152915192935060009291891691638ee573ac91602480820192602092909190829003018186803b15801561092b57600080fd5b505afa15801561093f573d6000803e3d6000fd5b505050506040513d602081101561095557600080fd5b5051604080516342b60b0360e01b81526001600160a01b0388811660048301529151929350908916916342b60b0391602480820192602092909190829003018186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d60208110156109ce57600080fd5b5051156109fe576109f76109f0600a83900a6109ea858761172d565b9061178f565b8a906117ce565b9850610be6565b6000876001600160a01b0316638a78daa8876040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610a4d57600080fd5b505afa158015610a61573d6000803e3d6000fd5b505050506040513d6020811015610a7757600080fd5b505190508015610ab957600080610a8f8887856114bf565b9150915080610aa957610aa28c836117ce565b9b50610ab6565b610ab38b836117ce565b9a505b50505b610b3c886001600160a01b031663f07456ce886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b50518b906117ce565b99506000886001600160a01b031663c3c7b9e9886040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610b8d57600080fd5b505afa158015610ba1573d6000803e3d6000fd5b505050506040513d6020811015610bb757600080fd5b50519050610be1610bda600a85900a6109ea88610bd48987611826565b9061172d565b8c906117ce565b9a5050505b50505050505b600101610652565b50828211610c0b57610c068383611826565b610c0e565b60005b92508260095411610c2c57600954610c27908490611826565b610c2f565b60005b9450505050505b919050565b600a5460ff1681565b61271081565b6001546001600160a01b031681565b600060026000541415610ca1576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055610cae611868565b610cbc8787878787876118c6565b6001600055979650505050505050565b60085481565b6202a30081565b600060026000541415610d21576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055600a5460ff1615610d6c576040805162461bcd60e51b815260206004820152601e6024820152600080516020612486833981519152604482015290519081900360640190fd5b610d7a3333878787876118c6565b600160005595945050505050565b60065481565b6003546000906001600160a01b0316801580610e0c5750806001600160a01b0316639a11178f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dde57600080fd5b505afa158015610df2573d6000803e3d6000fd5b505050506040513d6020811015610e0857600080fd5b5051155b15610e935760025460408051636274980360e01b81526001600160a01b038681166004830152915191909216916362749803916024808301926020929190829003018186803b158015610e5e57600080fd5b505afa158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b50519150610c369050565b600b5480610f1e5760025460408051636274980360e01b81526001600160a01b038781166004830152915191909216916362749803916024808301926020929190829003018186803b158015610ee857600080fd5b505afa158015610efc573d6000803e3d6000fd5b505050506040513d6020811015610f1257600080fd5b50519250610c36915050565b612710811415610f7557816001600160a01b03166362749803856040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ee857600080fd5b60025460408051636274980360e01b81526001600160a01b03878116600483015291516000939290921691636274980391602480820192602092909190829003018186803b158015610fc657600080fd5b505afa158015610fda573d6000803e3d6000fd5b505050506040513d6020811015610ff057600080fd5b505160408051636274980360e01b81526001600160a01b038881166004830152915192935060009291861691636274980391602480820192602092909190829003018186803b15801561104257600080fd5b505afa158015611056573d6000803e3d6000fd5b505050506040513d602081101561106c57600080fd5b50519050610c2f6127106109ea611083848761172d565b61109961109261271089611826565b879061172d565b906117ce565b600c6020526000908152604090205460ff1681565b6001546001600160a01b03163314611101576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b612710600b541115611157576040805162461bcd60e51b815260206004820152601a60248201527911db1c13585b9859d95c8e881a5b9d985b1a59081dd95a59da1d60321b604482015290519081900360640190fd5b600b55565b600b5481565b6003546001600160a01b031681565b670de0b6b3a764000081565b600080611189836105bd565b90506111ad68327cb2734119d3b7a9601e1b6109ea83670de0b6b3a764000061172d565b9392505050565b6001546001600160a01b03163314611201576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600a805460ff1916911515919091179055565b60006002600054141561125c576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055611269611868565b6112768686868686611bdf565b60016000559695505050505050565b6005546001600160a01b031681565b601281565b60076020526000908152604090205481565b6000600260005414156112f3576040805162461bcd60e51b815260206004820152601f6024820152600080516020612446833981519152604482015290519081900360640190fd5b6002600055600a5460ff161561133e576040805162461bcd60e51b815260206004820152601e6024820152600080516020612486833981519152604482015290519081900360640190fd5b610d7a3386868686611bdf565b6001546001600160a01b03163314611398576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600891909155600955565b68327cb2734119d3b7a9601e1b81565b6001546001600160a01b03163314611400576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b6202a3008111156114425760405162461bcd60e51b81526004018080602001828103825260258152602001806124216025913960400191505060405180910390fd5b600655565b6001546001600160a01b03163314611494576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b60008060006114cd86610d8e565b905060008582116114e7576114e28683611826565b6114f1565b6114f18287611826565b90506000611503836109ea888561172d565b9450505084109050935093915050565b60095481565b6001546001600160a01b03163314611566576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031633146115d5576040805162461bcd60e51b81526020600482015260156024820152600080516020612466833981519152604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600080611603836105bd565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561165557600080fd5b505afa158015611669573d6000803e3d6000fd5b505050506040513d602081101561167f57600080fd5b50519050611699816109ea84670de0b6b3a764000061172d565b949350505050565b6040805160028082526060808301845292839291906020830190803683370190505090506116cf60016105bd565b816000815181106116dc57fe5b6020026020010181815250506116f260006105bd565b816001815181106116ff57fe5b6020908102919091010152905090565b6004546001600160a01b031681565b6002546001600160a01b031681565b60008261173c57506000611789565b8282028284828161174957fe5b04146117865760405162461bcd60e51b81526004018080602001828103825260218152602001806124d26021913960400191505060405180910390fd5b90505b92915050565b600061178683836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061207c565b600082820183811015611786576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b600061178683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061211e565b336000908152600c602052604090205460ff166118c4576040805162461bcd60e51b815260206004820152601560248201527423b63826b0b730b3b2b91d103337b93134b23232b760591b604482015290519081900360640190fd5b565b600080841161191a576040805162461bcd60e51b815260206004820152601b60248201527a11db1c13585b9859d95c8e881a5b9d985b1a590817d85b5bdd5b9d602a1b604482015290519081900360640190fd5b6000611926600161117d565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561197857600080fd5b505afa15801561198c573d6000803e3d6000fd5b505050506040513d60208110156119a257600080fd5b50516002549091506119c3906001600160a01b03898116918c911689612178565b6002546040805163817bb85760e01b81526001600160a01b038a811660048301523060248301529151600093929092169163817bb8579160448082019260209290919082900301818787803b158015611a1b57600080fd5b505af1158015611a2f573d6000803e3d6000fd5b505050506040513d6020811015611a4557600080fd5b5051905085811015611a885760405162461bcd60e51b81526004018080602001828103825260248152602001806125166024913960400191505060405180910390fd5b60008315611aa357611a9e846109ea848661172d565b611aa5565b815b905085811015611ae65760405162461bcd60e51b81526004018080602001828103825260238152602001806124f36023913960400191505060405180910390fd5b600554604080516340c10f1960e01b81526001600160a01b038d8116600483015260248201859052915191909216916340c10f1991604480830192600092919082900301818387803b158015611b3b57600080fd5b505af1158015611b4f573d6000803e3d6000fd5b5050506001600160a01b03808c166000818152600760209081526040918290204290558151928352928d16928201929092528082018b9052606081018790526080810186905260a0810185905260c0810184905290517f38dc38b96482be64113daffd8d464ebda93e856b70ccfc605e69ccf892ab981e92509081900360e00190a19a9950505050505050505050565b6000808411611c35576040805162461bcd60e51b815260206004820152601e60248201527f476c704d616e616765723a20696e76616c6964205f676c70416d6f756e740000604482015290519081900360640190fd5b6006546001600160a01b0387166000908152600760205260409020544291611c5d91906117ce565b1115611c9a5760405162461bcd60e51b815260040180806020018281038252602c8152602001806124a6602c913960400191505060405180910390fd5b6000611ca6600061117d565b90506000600560009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cf857600080fd5b505afa158015611d0c573d6000803e3d6000fd5b505050506040513d6020811015611d2257600080fd5b505190506000611d36826109ea898661172d565b60048054604080516370a0823160e01b81523093810193909352519293506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015611d8857600080fd5b505afa158015611d9c573d6000803e3d6000fd5b505050506040513d6020811015611db257600080fd5b5051905080821115611e39576004546001600160a01b03166340c10f1930611dda8585611826565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015611e2057600080fd5b505af1158015611e34573d6000803e3d6000fd5b505050505b60055460408051632770a7eb60e21b81526001600160a01b038d81166004830152602482018c905291519190921691639dc29fac91604480830192600092919082900301818387803b158015611e8e57600080fd5b505af1158015611ea2573d6000803e3d6000fd5b5050600480546002546040805163a9059cbb60e01b81526001600160a01b039283169481019490945260248401889052519116935063a9059cbb925060448083019260209291908290030181600087803b158015611eff57600080fd5b505af1158015611f13573d6000803e3d6000fd5b505050506040513d6020811015611f2957600080fd5b505060025460408051630711e61960e41b81526001600160a01b038c8116600483015289811660248301529151600093929092169163711e61909160448082019260209290919082900301818787803b158015611f8557600080fd5b505af1158015611f99573d6000803e3d6000fd5b505050506040513d6020811015611faf57600080fd5b5051905087811015612008576040805162461bcd60e51b815260206004820152601f60248201527f476c704d616e616765723a20696e73756666696369656e74206f757470757400604482015290519081900360640190fd5b604080516001600160a01b03808e1682528c1660208201528082018b9052606081018790526080810186905260a0810185905260c0810183905290517f87b9679bb9a4944bafa98c267e7cd4a00ab29fed48afdefae25f0fca5da279409181900360e00190a19a9950505050505050505050565b600081836121085760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156120cd5781810151838201526020016120b5565b50505050905090810190601f1680156120fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161211457fe5b0495945050505050565b600081848411156121705760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156120cd5781810151838201526020016120b5565b505050900390565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526121d29085906121d8565b50505050565b606061222d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661228e9092919063ffffffff16565b8051909150156122895780806020019051602081101561224c57600080fd5b50516122895760405162461bcd60e51b815260040180806020018281038252602a81526020018061253a602a913960400191505060405180910390fd5b505050565b60606116998484600085856122a2856123b4565b6122f3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106123325780518252601f199092019160209182019101612313565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612394576040519150601f19603f3d011682016040523d82523d6000602084013e612399565b606091505b50915091506123a98282866123ba565b979650505050505050565b3b151590565b606083156123c95750816111ad565b8251156123d95782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156120cd5781810151838201526020016120b556fe476c704d616e616765723a20696e76616c6964205f636f6f6c646f776e4475726174696f6e5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000476c704d616e616765723a20616374696f6e206e6f7420656e61626c65640000476c704d616e616765723a20636f6f6c646f776e206475726174696f6e206e6f742079657420706173736564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77476c704d616e616765723a20696e73756666696369656e7420474c50206f7574707574476c704d616e616765723a20696e73756666696369656e742055534447206f75747075745361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122033eefe0f6c8ce7a315b2ab9192fe27c84ceb141e63d0ff743958ee46771183eb64736f6c634300060c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/projects/amped/src/abis/GlpManager.ts b/projects/amped/src/abis/GlpManager.ts new file mode 100644 index 00000000..44ca5a79 --- /dev/null +++ b/projects/amped/src/abis/GlpManager.ts @@ -0,0 +1,9 @@ +export const GlpManager = [ + { + inputs: [{ internalType: 'bool', name: 'maximize', type: 'bool' }], + name: 'getPrice', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function' + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/abis/OrderBook.json b/projects/amped/src/abis/OrderBook.json new file mode 100644 index 00000000..c0c0cb9e --- /dev/null +++ b/projects/amped/src/abis/OrderBook.json @@ -0,0 +1,1999 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "OrderBook", + "sourceName": "contracts/core/OrderBook.sol", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CancelDecreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "purchaseToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "purchaseTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CancelIncreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CancelSwapOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CreateDecreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "purchaseToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "purchaseTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CreateIncreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "CreateSwapOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionPrice", + "type": "uint256" + } + ], + "name": "ExecuteDecreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "purchaseToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "purchaseTokenAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionPrice", + "type": "uint256" + } + ], + "name": "ExecuteIncreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "ExecuteSwapOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "vault", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "weth", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "usdg", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minExecutionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minPurchaseTokenAmountUsd", + "type": "uint256" + } + ], + "name": "Initialize", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + } + ], + "name": "UpdateDecreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "gov", + "type": "address" + } + ], + "name": "UpdateGov", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "orderIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + } + ], + "name": "UpdateIncreaseOrder", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minExecutionFee", + "type": "uint256" + } + ], + "name": "UpdateMinExecutionFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minPurchaseTokenAmountUsd", + "type": "uint256" + } + ], + "name": "UpdateMinPurchaseTokenAmountUsd", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "ordexIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "name": "UpdateSwapOrder", + "type": "event" + }, + { + "inputs": [], + "name": "PRICE_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "USDG_PRECISION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "cancelDecreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "cancelIncreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256[]", + "name": "_swapOrderIndexes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_increaseOrderIndexes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_decreaseOrderIndexes", + "type": "uint256[]" + } + ], + "name": "cancelMultiple", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "cancelSwapOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + } + ], + "name": "createDecreaseOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_shouldWrap", + "type": "bool" + } + ], + "name": "createIncreaseOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerRatio", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_shouldWrap", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_shouldUnwrap", + "type": "bool" + } + ], + "name": "createSwapOrder", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "decreaseOrders", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "decreaseOrdersIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_feeReceiver", + "type": "address" + } + ], + "name": "executeDecreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_feeReceiver", + "type": "address" + } + ], + "name": "executeIncreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_feeReceiver", + "type": "address" + } + ], + "name": "executeSwapOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "getDecreaseOrder", + "outputs": [ + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "getIncreaseOrder", + "outputs": [ + { + "internalType": "address", + "name": "purchaseToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "purchaseTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + } + ], + "name": "getSwapOrder", + "outputs": [ + { + "internalType": "address", + "name": "path0", + "type": "address" + }, + { + "internalType": "address", + "name": "path1", + "type": "address" + }, + { + "internalType": "address", + "name": "path2", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_otherToken", + "type": "address" + } + ], + "name": "getUsdgMinPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gov", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "increaseOrders", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "purchaseToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "purchaseTokenAmount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "increaseOrdersIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_router", + "type": "address" + }, + { + "internalType": "address", + "name": "_vault", + "type": "address" + }, + { + "internalType": "address", + "name": "_weth", + "type": "address" + }, + { + "internalType": "address", + "name": "_usdg", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minExecutionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minPurchaseTokenAmountUsd", + "type": "uint256" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "isInitialized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minExecutionFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minPurchaseTokenAmountUsd", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "router", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + } + ], + "name": "setGov", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minExecutionFee", + "type": "uint256" + } + ], + "name": "setMinExecutionFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minPurchaseTokenAmountUsd", + "type": "uint256" + } + ], + "name": "setMinPurchaseTokenAmountUsd", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "swapOrders", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "triggerRatio", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "bool", + "name": "shouldUnwrap", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "swapOrdersIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + } + ], + "name": "updateDecreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + } + ], + "name": "updateIncreaseOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_orderIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerRatio", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + } + ], + "name": "updateSwapOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usdg", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_maximizePrice", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_raise", + "type": "bool" + } + ], + "name": "validatePositionOrderPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_triggerRatio", + "type": "uint256" + } + ], + "name": "validateSwapOrderPriceWithTriggerAboveThreshold", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x6080604052600e805460ff1916905534801561001a57600080fd5b506001600055600780546001600160a01b031916331790556153c4806100416000396000f3fe6080604052600436106101c35760003560e01c8062cf066b1461022a578063026032ee1461026f57806307c7edc3146102fa5780630d5cc9381461033d57806311d9444a1461036757806312d43a51146103aa578063269ae6c2146103db5780632b7d6290146104a6578063392e53cd146105465780633fc8cef31461056f57806347e0bbd0146105845780634a686d67146105ae5780634c54f0b0146105c357806363ae21031461062d57806379221fa214610642578063807c5600146106c15780638de10c2e1461087357806395082d25146108885780639983ee1b1461089d5780639e23de5c146108db5780639e71b0f01461090e578063a397ea5414610938578063aec224551461097c578063b142a4b0146109af578063c16cde8a14610a99578063c4a1821b14610ae9578063c86b0f7d14610b99578063cfad57a214610bd7578063d0d40cd614610c0a578063d38ab51914610c9d578063d3bab1d114610ce0578063d566d0ca14610d74578063d7c41c7914610da7578063f2d2e01b14610e00578063f5b91b7b14610e94578063f882ac0714610ea9578063f887ea4014610ed3578063fbfa77cf14610ee8578063fc2cee6214610efd57610225565b36610225576008546001600160a01b03163314610223576040805162461bcd60e51b815260206004820152601960248201527827b93232b92137b7b59d1034b73b30b634b21039b2b73232b960391b604482015290519081900360640190fd5b005b600080fd5b34801561023657600080fd5b5061025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610f27565b60408051918252519081900360200190f35b34801561027b57600080fd5b506102a86004803603604081101561029257600080fd5b506001600160a01b038135169060200135610f39565b604080516001600160a01b03998a168152602081019890985295909716868601526060860193909352901515608085015260a0840152151560c083015260e08201929092529051908190036101000190f35b34801561030657600080fd5b506102236004803603606081101561031d57600080fd5b506001600160a01b0381358116916020810135916040909101351661100c565b34801561034957600080fd5b506102236004803603602081101561036057600080fd5b5035611417565b34801561037357600080fd5b506102236004803603606081101561038a57600080fd5b506001600160a01b038135811691602081013591604090910135166114a8565b3480156103b657600080fd5b506103bf611857565b604080516001600160a01b039092168252519081900360200190f35b61022360048036036101008110156103f257600080fd5b810190602081018135600160201b81111561040c57600080fd5b82018360208201111561041e57600080fd5b803590602001918460208302840111600160201b8311171561043f57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604081013590606081013515159060808101359060a081013515159060c001351515611866565b3480156104b257600080fd5b506104df600480360360408110156104c957600080fd5b506001600160a01b038135169060200135611bef565b604080516001600160a01b039b8c168152998b1660208b015289810198909852958916606089015293909716608087015260a0860191909152151560c085015260e08401949094529215156101008301526101208201929092529051908190036101400190f35b34801561055257600080fd5b5061055b611c61565b604080519115158252519081900360200190f35b34801561057b57600080fd5b506103bf611c6a565b34801561059057600080fd5b50610223600480360360208110156105a757600080fd5b5035611c79565b3480156105ba57600080fd5b5061025d611f83565b3480156105cf57600080fd5b50610614600480360360a08110156105e657600080fd5b5080351515906020810135906001600160a01b03604082013516906060810135151590608001351515611f8f565b6040805192835290151560208301528051918290030190f35b34801561063957600080fd5b5061025d6120f8565b34801561064e57600080fd5b5061067b6004803603604081101561066557600080fd5b506001600160a01b0381351690602001356120fe565b604080516001600160a01b039098168852602088019690965286860194909452606086019290925215156080850152151560a084015260c0830152519081900360e00190f35b3480156106cd57600080fd5b50610223600480360360608110156106e457600080fd5b810190602081018135600160201b8111156106fe57600080fd5b82018360208201111561071057600080fd5b803590602001918460208302840111600160201b8311171561073157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561078057600080fd5b82018360208201111561079257600080fd5b803590602001918460208302840111600160201b831117156107b357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561080257600080fd5b82018360208201111561081457600080fd5b803590602001918460208302840111600160201b8311171561083557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612152945050505050565b34801561087f57600080fd5b5061025d6121ea565b34801561089457600080fd5b5061025d6121f0565b3480156108a957600080fd5b50610223600480360360808110156108c057600080fd5b50803590602081013590604081013590606001351515612200565b3480156108e757600080fd5b5061025d600480360360208110156108fe57600080fd5b50356001600160a01b0316612358565b34801561091a57600080fd5b506102236004803603602081101561093157600080fd5b5035612502565b34801561094457600080fd5b50610223600480360360a081101561095b57600080fd5b50803590602081013590604081013590606081013590608001351515612774565b34801561098857600080fd5b5061025d6004803603602081101561099f57600080fd5b50356001600160a01b03166128dc565b61022360048036036101608110156109c657600080fd5b810190602081018135600160201b8111156109e057600080fd5b8201836020820111156109f257600080fd5b803590602001918460208302840111600160201b83111715610a1357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505082359350506001600160a01b036020830135811692604081013592506060810135916080820135169060a081013515159060c08101359060e081013515159061010081013590610120013515156128ee565b610223600480360360e0811015610aaf57600080fd5b506001600160a01b03813581169160208101359160408201351690606081013590608081013515159060a08101359060c001351515612cf0565b348015610af557600080fd5b5061055b60048036036040811015610b0c57600080fd5b810190602081018135600160201b811115610b2657600080fd5b820183602082011115610b3857600080fd5b803590602001918460208302840111600160201b83111715610b5957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250612da1915050565b348015610ba557600080fd5b5061022360048036036080811015610bbc57600080fd5b50803590602081013590604081013590606001351515612fb8565b348015610be357600080fd5b5061022360048036036020811015610bfa57600080fd5b50356001600160a01b0316613181565b348015610c1657600080fd5b50610c4360048036036040811015610c2d57600080fd5b506001600160a01b03813516906020013561322b565b604080516001600160a01b039a8b168152988a1660208a015296909816878701526060870194909452608086019290925260a0850152151560c0840152151560e08301526101008201929092529051908190036101200190f35b348015610ca957600080fd5b5061022360048036036060811015610cc057600080fd5b506001600160a01b038135811691602081013591604090910135166133e8565b348015610cec57600080fd5b50610d1960048036036040811015610d0357600080fd5b506001600160a01b038135169060200135613851565b604080516001600160a01b039a8b1681526020810199909952968916888801529490971660608701526080860192909252151560a085015260c084015292151560e08301526101008201929092529051908190036101200190f35b348015610d8057600080fd5b5061025d60048036036020811015610d9757600080fd5b50356001600160a01b0316613937565b348015610db357600080fd5b50610223600480360360c0811015610dca57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a00135613949565b348015610e0c57600080fd5b50610e3960048036036040811015610e2357600080fd5b506001600160a01b038135169060200135613ab8565b604080516001600160a01b039a8b168152988a1660208a0152888101979097529490971660608701526080860192909252151560a085015260c084015292151560e08301526101008201929092529051908190036101200190f35b348015610ea057600080fd5b506103bf613b22565b348015610eb557600080fd5b5061022360048036036020811015610ecc57600080fd5b5035613b31565b348015610edf57600080fd5b506103bf613e6e565b348015610ef457600080fd5b506103bf613e7d565b348015610f0957600080fd5b5061022360048036036020811015610f2057600080fd5b5035613e8c565b60066020526000908152604090205481565b600080600080600080600080610f4d614fd0565b505050506001600160a01b03968716600090815260036020818152604080842099845298815291889020885161012081018a5281548b16815260018201548b1693810184905260028201549981018a9052918101549099166060820181905260048a01546080830181905260058b015460ff908116151560a0850181905260068d015460c0860181905260078e0154909216151560e086018190526008909d0154610100909501859052949c9a9b929a91995093975092955093509150565b60026000541415611052576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b600260005561105f61501c565b6001600160a01b038085166000908152600560209081526040808320878452825291829020825161010081018452815490941684526001810180548451818502810185019095528085529193858401939092908301828280156110eb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110cd575b5050509183525050600282015460208201526003820154604082015260048201546060820152600582015460ff8082161515608084015261010090910416151560a082015260069091015460c09091015280519091506001600160a01b0316611189576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b8060a00151156111e0576111a581602001518260800151612da1565b6111e05760405162461bcd60e51b81526004018080602001828103825260268152602001806152f16026913960400191505060405180910390fd5b6001600160a01b0384166000908152600560209081526040808320868452909152812080546001600160a01b03191681559061121f600183018261506e565b50600060028201819055600382018190556004820181905560058201805461ffff191690556006909101819055600b54604083015160208401518051611292946001600160a01b03909416939061127257fe5b60200260200101516001600160a01b0316613f1d9092919063ffffffff16565b600854602082015180516000926001600160a01b0316919060001981019081106112b857fe5b60200260200101516001600160a01b03161480156112d757508160c001515b15611304576112ef8260200151836060015130613f74565b90506112ff8183600001516140a3565b61131e565b61131b826020015183606001518460000151613f74565b90505b61132c8260e00151846140a3565b846001600160a01b03167f7e1fe496989eea92b738a562dbf9c0ae6aa6fcf3f1ef09e95ee4f7603721706b858460200151856040015186606001518688608001518960a001518a60c001518b60e00151604051808a8152602001806020018981526020018881526020018781526020018681526020018515158152602001841515815260200183815260200182810382528a818151815260200191508051906020019060200280838360005b838110156113f05781810151838201526020016113d8565b505050509050019a505050505050505050505060405180910390a250506001600055505050565b6007546001600160a01b0316331461146d576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600d8190556040805182815290517fe46d9daf6d25f7615efa1d0183b90ac6759d85014b598e409aadf0fd918d59a69181900360200190a150565b600260005414156114ee576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000556114fb614fd0565b506001600160a01b03808416600090815260036020818152604080842087855282529283902083516101208101855281548616808252600183015487169382019390935260028201549481019490945291820154909316606083015260048101546080830152600581015460ff908116151560a0840152600682015460c0840152600782015416151560e083015260080154610100820152906115d3576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b60006115f48260e001518360c0015184606001518560a00151156001611f8f565b506001600160a01b0380871660009081526003602081815260408084208a8552825280842080546001600160a01b0319908116825560018201805482169055600282018690559381018054909416909355600480840185905560058401805460ff199081169091556006850186905560078501805490911690556008909301849055600a5488518984015160608b01518b85015160808d015160a08e01518751632662166b60e01b8152958c1699860199909952928a16602485015290891660448401526064830152608482015293151560a48501523060c4850152905195965092949290931692632662166b9260e48084019382900301818787803b1580156116fd57600080fd5b505af1158015611711573d6000803e3d6000fd5b505050506040513d602081101561172757600080fd5b505160085460208501519192506001600160a01b039182169116141561175a576117558184600001516140a3565b611777565b82516020840151611777916001600160a01b039091169083613f1d565b611786836101000151856140a3565b82600001516001600160a01b03167f9a382661d6573da86db000471303be6f0b2b1bb66089b08e3c16a85d7b6e94f88685602001518660400151876060015188608001518960a001518a60c001518b60e001518c61010001518c604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001878152602001861515815260200185815260200184151581526020018381526020018281526020019a505050505050505050505060405180910390a25050600160005550505050565b6007546001600160a01b031681565b600260005414156118ac576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000819055885114806118c2575087516003145b611901576040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b8760018951038151811061191157fe5b60200260200101516001600160a01b03168860008151811061192f57fe5b60200260200101516001600160a01b0316141561198e576040805162461bcd60e51b815260206004820152601860248201527709ee4c8cae484deded67440d2dcecc2d8d2c840bee0c2e8d60431b604482015290519081900360640190fd5b600087116119e2576040805162461bcd60e51b815260206004820152601c60248201527b27b93232b92137b7b59d1034b73b30b634b2102fb0b6b7bab73a24b760211b604482015290519081900360640190fd5b600c54831015611a235760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b611a2b614120565b8115611ae65760085488516001600160a01b03909116908990600090611a4d57fe5b60200260200101516001600160a01b031614611a9a5760405162461bcd60e51b81526004018080602001828103825260258152602001806152606025913960400191505060405180910390fd5b611aa48388614192565b3414611ae15760405162461bcd60e51b81526004018080602001828103825260268152602001806152cb6026913960400191505060405180910390fd5b611bd0565b823414611b245760405162461bcd60e51b815260040180806020018281038252602e815260200180615361602e913960400191505060405180910390fd5b600a5488516001600160a01b0390911690631b827878908a90600090611b4657fe5b602002602001015133308b6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015611bb757600080fd5b505af1158015611bcb573d6000803e3d6000fd5b505050505b611be0338989898989878a6141ea565b50506001600055505050505050565b6001602081815260009384526040808520909152918352912080549181015460028201546003830154600484015460058501546006860154600787015460088801546009909801546001600160a01b03998a1699978816989697958616969490951694929360ff92831693919216908a565b600e5460ff1681565b6008546001600160a01b031681565b60026000541415611cbf576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055611ccc61508f565b5033600090815260016020818152604080842085855282529283902083516101408101855281546001600160a01b039081168083529483015481169382019390935260028201549481019490945260038101548216606085015260048101549091166080840152600581015460a0840152600681015460ff908116151560c0850152600782015460e0850152600882015416151561010084015260090154610120830152611daf576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b3360009081526001602081815260408084208685528252832080546001600160a01b0319908116825592810180548416905560028101849055600381018054841690556004810180549093169092556005820183905560068201805460ff19908116909155600783018490556008808401805490921690915560099092019290925554908201516001600160a01b0390811691161415611e7357611e6e611e68826040015183610120015161419290919063ffffffff16565b336140a3565b611ea8565b611e9933826040015183602001516001600160a01b0316613f1d9092919063ffffffff16565b611ea8816101200151336140a3565b80600001516001600160a01b03167fd500f34e0ec655b7614ae42e1d9c666d5e4dde909a1297829f8c5ecf00805d328383602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001876001600160a01b03168152602001868152602001851515815260200184815260200183151581526020018281526020019a505050505050505050505060405180910390a250506001600055565b670de0b6b3a764000081565b60008060008461201757600b54604080516340d3096b60e11b81526001600160a01b038981166004830152915191909216916381a612d6916024808301926020929190829003018186803b158015611fe657600080fd5b505afa158015611ffa573d6000803e3d6000fd5b505050506040513d602081101561201057600080fd5b5051612091565b600b5460408051637092736960e11b81526001600160a01b0389811660048301529151919092169163e124e6d2916024808301926020929190829003018186803b15801561206457600080fd5b505afa158015612078573d6000803e3d6000fd5b505050506040513d602081101561208e57600080fd5b50515b90506000886120a2578782106120a6565b8782115b905084156120ea57806120ea5760405162461bcd60e51b81526004018080602001828103825260268152602001806152f16026913960400191505060405180910390fd5b909890975095505050505050565b600c5481565b600560208181526000938452604080852090915291835291208054600282015460038301546004840154948401546006909401546001600160a01b03909316949193909260ff808316926101009004169087565b60005b83518110156121825761217a84828151811061216d57fe5b6020026020010151613b31565b600101612155565b5060005b82518110156121b3576121ab83828151811061219e57fe5b6020026020010151611c79565b600101612186565b5060005b81518110156121e4576121dc8282815181106121cf57fe5b6020026020010151612502565b6001016121b7565b50505050565b600d5481565b68327cb2734119d3b7a9601e1b81565b60026000541415612246576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600160209081526040808320878452909152902080546001600160a01b03166122ae576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b6007810183905560088101805483151560ff19909116811790915560058201859055600382015460048301546006840154604080518a81526001600160a01b039485166020820152929093168284015260ff16151560608201526080810187905260a0810186905260c08101929092525133917f0a0360dd5c354235bbf8d386ba3b24ef8134088e0785677de1504df219d9149a919081900360e00190a250506001600055505050565b600b5460408051632c668ec160e01b81526001600160a01b038481166004830152670de0b6b3a76400006024830152915160009384931691632c668ec1916044808301926020929190829003018186803b1580156123b557600080fd5b505afa1580156123c9573d6000803e3d6000fd5b505050506040513d60208110156123df57600080fd5b5051600b54604080516340d3096b60e11b81526001600160a01b038781166004830152915193945060009391909216916381a612d6916024808301926020929190829003018186803b15801561243457600080fd5b505afa158015612448573d6000803e3d6000fd5b505050506040513d602081101561245e57600080fd5b5051600b54604080516323b95ceb60e21b81526001600160a01b03888116600483015291519394506000939190921691638ee573ac916024808301926020929190829003018186803b1580156124b357600080fd5b505afa1580156124c7573d6000803e3d6000fd5b505050506040513d60208110156124dd57600080fd5b505190506124f9600a82900a6124f385856143f9565b90614452565b95945050505050565b60026000541415612548576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612555614fd0565b5033600090815260036020818152604080842085855282529283902083516101208101855281546001600160a01b03908116808352600184015482169483019490945260028301549582019590955292810154909316606083015260048301546080830152600583015460ff908116151560a0840152600684015460c0840152600784015416151560e08301526008909201546101008201529061262e576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b336000818152600360208181526040808420878552909152822080546001600160a01b03199081168255600182018054821690556002820184905591810180549092169091556004810182905560058101805460ff19908116909155600682018390556007820180549091169055600801556101008201516126af916140a3565b80600001516001600160a01b03167f1154174c82984656b028c8021671988f60a346497e56fe02554761184f82a0758383602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151604051808a8152602001896001600160a01b03168152602001888152602001876001600160a01b0316815260200186815260200185151581526020018481526020018315158152602001828152602001995050505050505050505060405180910390a250506001600055565b600260005414156127ba576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600360209081526040808320888452909152902080546001600160a01b0316612822576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b6006810183905560078101805483151560ff1990911681179091556004820185905560028201869055600182015460038301546005840154604080518b81526001600160a01b0394851660208201528082018b90529290931660608301526080820188905260ff16151560a082015260c0810186905260e08101929092525133917f75781255bc71c83f89f29e5a2599f2c174a562d2cd8f2e818a47f132e728049891908190036101000190a25050600160005550505050565b60026020526000908152604090205481565b60026000541415612934576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612941614120565b600c548210156129825760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b8015612a3d576008548b516001600160a01b03909116908c906000906129a457fe5b60200260200101516001600160a01b0316146129f15760405162461bcd60e51b81526004018080602001828103825260258152602001806152606025913960400191505060405180910390fd5b6129fb828b614192565b3414612a385760405162461bcd60e51b81526004018080602001828103825260268152602001806152cb6026913960400191505060405180910390fd5b612b27565b813414612a7b5760405162461bcd60e51b815260040180806020018281038252602e815260200180615361602e913960400191505060405180910390fd5b600a548b516001600160a01b0390911690631b827878908d90600090612a9d57fe5b602002602001015133308e6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015612b0e57600080fd5b505af1158015612b22573d6000803e3d6000fd5b505050505b60008b60018d510381518110612b3957fe5b60200260200101519050600060018d511115612bfe57816001600160a01b03168d600081518110612b6657fe5b60200260200101516001600160a01b03161415612bc5576040805162461bcd60e51b815260206004820152601860248201527709ee4c8cae484deded67440d2dcecc2d8d2c840bee0c2e8d60431b604482015290519081900360640190fd5b612bec600b60009054906101000a90046001600160a01b03168d8f60008151811061127257fe5b612bf78d8b30613f74565b9050612c01565b508a5b600b5460408051630a48d5a960e01b81526001600160a01b0385811660048301526024820185905291516000939290921691630a48d5a991604480820192602092909190829003018186803b158015612c5957600080fd5b505afa158015612c6d573d6000803e3d6000fd5b505050506040513d6020811015612c8357600080fd5b5051600d54909150811015612cc95760405162461bcd60e51b81526004018080602001828103825260228152602001806151bd6022913960400191505060405180910390fd5b50612cdc3383838b8f8e8d8d8d8d614491565b505060016000555050505050505050505050565b60026000541415612d36576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612d43614120565b600c543411612d835760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b612d933386868a8a888888614764565b505060016000555050505050565b6000825160021480612db4575082516003145b612df3576040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b600083600081518110612e0257fe5b60200260200101519050600084600186510381518110612e1e57fe5b602090810291909101015160095490915060009081906001600160a01b0385811691161415612e6b57612e6487600181518110612e5757fe5b6020026020010151612358565b9150612ee7565b600b54604080516340d3096b60e11b81526001600160a01b038781166004830152915191909216916381a612d6916024808301926020929190829003018186803b158015612eb857600080fd5b505afa158015612ecc573d6000803e3d6000fd5b505050506040513d6020811015612ee257600080fd5b505191505b6009546001600160a01b0384811691161415612f10575068327cb2734119d3b7a9601e1b612f8c565b600b5460408051637092736960e11b81526001600160a01b0386811660048301529151919092169163e124e6d2916024808301926020929190829003018186803b158015612f5d57600080fd5b505afa158015612f71573d6000803e3d6000fd5b505050506040513d6020811015612f8757600080fd5b505190505b6000612fa8836124f38468327cb2734119d3b7a9601e1b6143f9565b8710955050505050505b92915050565b60026000541415612ffe576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600560209081526040808320878452909152902080546001600160a01b0316613066576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b838160030181905550828160040181905550818160050160006101000a81548160ff021916908315150217905550336001600160a01b03167fa7f9f4a25eb76f5ec01b1a429d95d6a00833f0f137c88827c58799a1c1ff0dfe868360010184600201548888888860050160019054906101000a900460ff168960060154604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818154815260200191508054801561316057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613142575b5050995050505050505050505060405180910390a250506001600055505050565b6007546001600160a01b031633146131d7576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600780546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fe24c39186e9137521953beaa8446e71f55b8f12296984f9d4273ceb1af728d909181900360200190a150565b600080600080600080600080600061324161501c565b6001600160a01b03808d1660009081526005602090815260408083208f8452825291829020825161010081018452815490941684526001810180548451818502810185019095528085529193858401939092908301828280156132cd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116132af575b505050918352505060028201546020808301919091526003830154604083015260048301546060830152600583015460ff8082161515608085015261010090910416151560a083015260069092015460c0909101528101515190915061333457600061334e565b806020015160008151811061334557fe5b60200260200101515b60018260200151511161336257600061337c565b816020015160018151811061337357fe5b60200260200101515b6002836020015151116133905760006133aa565b82602001516002815181106133a157fe5b60200260200101515b8360400151846060015185608001518660a001518760c001518860e00151995099509950995099509950995099509950509295985092959850929598565b6002600054141561342e576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b600260005561343b61508f565b506001600160a01b038084166000908152600160208181526040808420878552825292839020835161014081018552815486168082529382015486169281019290925260028101549382019390935260038301548416606082015260048301549093166080840152600582015460a0840152600682015460ff908116151560c0850152600783015460e08501526008830154161515610100840152600990910154610120830152613521576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b60006135428261010001518360e0015184608001518560c001516001611f8f565b506001600160a01b0380871660009081526001602081815260408084208a8552825280842080546001600160a01b0319908116825593810180548516905560028101859055600381018054851690556004810180549094169093556005830184905560068301805460ff19908116909155600784018590556008840180549091169055600990920192909255600b5490860151918601519394506135ea938316921690613f1d565b81606001516001600160a01b031682602001516001600160a01b0316146136c257604080516002808252606080830184529260208301908036833701905050905082602001518160008151811061363d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082606001518160018151811061366f57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600061369d82600030613f74565b600b5460608601519192506136bf916001600160a01b03908116911683613f1d565b50505b600a5482516060840151608085015160a086015160c087015160408051630f8ee8bb60e11b81526001600160a01b03968716600482015294861660248601529285166044850152606484019190915215156084830152519190921691631f1dd1769160a480830192600092919082900301818387803b15801561374457600080fd5b505af1158015613758573d6000803e3d6000fd5b5050505061376b826101200151846140a3565b81600001516001600160a01b03167f7fb1c74d1ea6aa1c9c585e17ce8274c8ff98745e85e7459b73f87d784494f58e8584602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001518c604051808c81526020018b6001600160a01b031681526020018a8152602001896001600160a01b03168152602001886001600160a01b03168152602001878152602001861515815260200185815260200184151581526020018381526020018281526020019b50505050505050505050505060405180910390a250506001600055505050565b600080600080600080600080600061386761508f565b505050506001600160a01b0397881660009081526001602081815260408084209a845299815291899020895161014081018b5281548c168152918101548b1692820183905260028101549982018a905260038101548b16606083018190526004820154909b1660808301819052600582015460a08401819052600683015460ff908116151560c08601819052600785015460e08701819052600886015490921615156101008701819052600990950154610120909601869052959e9c9d9c929b5090995093975092955093509150565b60046020526000908152604090205481565b6007546001600160a01b0316331461399f576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600e5460ff16156139f7576040805162461bcd60e51b815260206004820152601e60248201527f4f72646572426f6f6b3a20616c726561647920696e697469616c697a65640000604482015290519081900360640190fd5b600e805460ff19166001179055600a80546001600160a01b038089166001600160a01b03199283168117909355600b8054898316908416811790915560088054898416908516811790915560098054938916939094168317909355600c869055600d8590556040805194855260208501919091528381019290925260608301526080820184905260a08201839052517fcfb7ef8749fafc8da2af1ba3d025479ffc4e58f7dc420113e112512a3bda59639181900360c00190a1505050505050565b600360208181526000938452604080852090915291835291208054600182015460028301549383015460048401546005850154600686015460078701546008909701546001600160a01b039687169895871697959690941694929360ff9283169391929091169089565b6009546001600160a01b031681565b60026000541415613b77576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055613b8461501c565b33600090815260056020908152604080832085845282529182902082516101008101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015613c0d57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613bef575b5050509183525050600282015460208201526003820154604082015260048201546060820152600582015460ff8082161515608084015261010090910416151560a082015260069091015460c09091015280519091506001600160a01b0316613cab576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b336000908152600560209081526040808320858452909152812080546001600160a01b031916815590613ce1600183018261506e565b50600060028201819055600382018190556004820181905560058201805461ffff191690556006909101819055600854602083015180516001600160a01b03909216929091613d2c57fe5b60200260200101516001600160a01b03161415613d6657613d61611e6882604001518360e0015161419290919063ffffffff16565b613d8e565b613d80338260400151836020015160008151811061127257fe5b613d8e8160e00151336140a3565b336001600160a01b03167fefd66d4f9c2f880c70aedeb5b26a44fb474cea07e5d6c533f2d27c303d5d94538383602001518460400151856060015186608001518760a001518860c001518960e00151604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818151815260200191508051906020019060200280838360005b83811015613e4b578181015183820152602001613e33565b50505050905001995050505050505050505060405180910390a250506001600055565b600a546001600160a01b031681565b600b546001600160a01b031681565b6007546001600160a01b03163314613ee2576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600c8190556040805182815290517fbde5eafdc37b81830d70124cddccaaa6d034e71dda3c8fc18a959ca76a7cbcfc9181900360200190a150565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613f6f9084906149da565b505050565b6000835160021415613fbb57613fb484600081518110613f9057fe5b602002602001015185600181518110613fa557fe5b60200260200101518585614a8b565b905061409c565b835160031415614061576000613ffc85600081518110613fd757fe5b602002602001015186600181518110613fec57fe5b6020026020010151600030614a8b565b9050614025600b60009054906101000a90046001600160a01b0316828760018151811061127257fe5b6140598560018151811061403557fe5b60200260200101518660028151811061404a57fe5b60200260200101518686614a8b565b91505061409c565b6040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b9392505050565b60085460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156140f057600080fd5b505af1158015614104573d6000803e3d6000fd5b5061411c925050506001600160a01b03821683614c6a565b5050565b341561419057600860009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561417657600080fd5b505af115801561418a573d6000803e3d6000fd5b50505050505b565b60008282018381101561409c576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6001600160a01b03881660009081526006602052604090205461420b61501c565b6040518061010001604052808b6001600160a01b031681526020018a81526020018981526020018881526020018781526020018615158152602001851515815260200184815250905061426860018361419290919063ffffffff16565b6001600160a01b038b8116600090815260066020908152604080832094909455600581528382208683528152929020835181546001600160a01b031916921691909117815582820151805184936142c69260018501929101906150e3565b5060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff02191690831515021790555060e08201518160060155905050896001600160a01b03167fdf06bb56ffc4029dc0b62b68bb5bbadea93a38b530cefc9b81afb742a6555d88838b8b8b8b8b8b8b604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818151815260200191508051906020019060200280838360005b838110156143d35781810151838201526020016143bb565b50505050905001995050505050505050505060405180910390a250505050505050505050565b60008261440857506000612fb2565b8282028284828161441557fe5b041461409c5760405162461bcd60e51b81526004018080602001828103825260218152602001806152aa6021913960400191505060405180910390fd5b600061409c83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614d4f565b336000908152600260205260409020546144a961508f565b6040518061014001604052808d6001600160a01b031681526020018c6001600160a01b031681526020018b81526020018a6001600160a01b03168152602001896001600160a01b031681526020018881526020018715158152602001868152602001851515815260200184815250905061452d60018361419290919063ffffffff16565b600260008e6001600160a01b03166001600160a01b031681526020019081526020016000208190555080600160008e6001600160a01b03166001600160a01b03168152602001908152602001600020600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e082015181600701556101008201518160080160006101000a81548160ff02191690831515021790555061012082015181600901559050508b6001600160a01b03167fb27b9afe3043b93788c40cfc3cc73f5d928a2e40f3ba01820b246426de8fa1b9838d8d8d8d8d8d8d8d8d604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001876001600160a01b03168152602001868152602001851515815260200184815260200183151581526020018281526020019a505050505050505050505060405180910390a2505050505050505050505050565b6001600160a01b038816600090815260046020526040902054614785614fd0565b5060408051610120810182526001600160a01b03808c1682528a8116602083015291810189905290871660608201526080810186905284151560a082015260c0810184905282151560e0820152346101008201526147e4826001614192565b600460008c6001600160a01b03166001600160a01b031681526020019081526020016000208190555080600360008c6001600160a01b03166001600160a01b03168152602001908152602001600020600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c0820151816006015560e08201518160070160006101000a81548160ff0219169083151502179055506101008201518160080155905050896001600160a01b03167f48ee333d2a65cc45fdb83bc012920d89181c3377390cd239d2b63f2bef67a02d838b8b8b8b8b8b8b34604051808a8152602001896001600160a01b03168152602001888152602001876001600160a01b0316815260200186815260200185151581526020018481526020018315158152602001828152602001995050505050505050505060405180910390a250505050505050505050565b6060614a2f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614df19092919063ffffffff16565b805190915015613f6f57808060200190516020811015614a4e57600080fd5b5051613f6f5760405162461bcd60e51b815260040180806020018281038252602a815260200180615337602a913960400191505060405180910390fd5b60095460009081906001600160a01b0386811691161415614b3057600b546040805163817bb85760e01b81526001600160a01b03898116600483015286811660248301529151919092169163817bb8579160448083019260209291908290030181600087803b158015614afd57600080fd5b505af1158015614b11573d6000803e3d6000fd5b505050506040513d6020811015614b2757600080fd5b50519050614c2b565b6009546001600160a01b0387811691161415614b9d57600b5460408051630711e61960e41b81526001600160a01b03888116600483015286811660248301529151919092169163711e61909160448083019260209291908290030181600087803b158015614afd57600080fd5b600b5460408051634998b10960e11b81526001600160a01b038981166004830152888116602483015286811660448301529151919092169163933162129160648083019260209291908290030181600087803b158015614bfc57600080fd5b505af1158015614c10573d6000803e3d6000fd5b505050506040513d6020811015614c2657600080fd5b505190505b838110156124f95760405162461bcd60e51b815260040180806020018281038252602181526020018061523f6021913960400191505060405180910390fd5b80471015614cbf576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114614d0a576040519150601f19603f3d011682016040523d82523d6000602084013e614d0f565b606091505b5050905080613f6f5760405162461bcd60e51b815260040180806020018281038252603a8152602001806151df603a913960400191505060405180910390fd5b60008183614ddb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614da0578181015183820152602001614d88565b50505050905090810190601f168015614dcd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581614de757fe5b0495945050505050565b6060614e008484600085614e08565b949350505050565b606082471015614e495760405162461bcd60e51b81526004018080602001828103825260268152602001806152196026913960400191505060405180910390fd5b614e5285614f64565b614ea3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614ee25780518252601f199092019160209182019101614ec3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614f44576040519150601f19603f3d011682016040523d82523d6000602084013e614f49565b606091505b5091509150614f59828286614f6a565b979650505050505050565b3b151590565b60608315614f7957508161409c565b825115614f895782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315614da0578181015183820152602001614d88565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b60405180610100016040528060006001600160a01b0316815260200160608152602001600081526020016000815260200160008152602001600015158152602001600015158152602001600081525090565b508054600082559060005260206000209081019061508c9190615148565b50565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915290565b828054828255906000526020600020908101928215615138579160200282015b8281111561513857825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615103565b5061514492915061515d565b5090565b5b808211156151445760008155600101615149565b5b808211156151445780546001600160a01b031916815560010161515e56fe4f72646572426f6f6b3a206e6f6e2d6578697374656e74206f726465720000005265656e7472616e637947756172643a207265656e7472616e742063616c6c004f72646572426f6f6b3a20696e73756666696369656e7420636f6c6c61746572616c416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f72646572426f6f6b3a20696e73756666696369656e7420616d6f756e744f75744f72646572426f6f6b3a206f6e6c79207765746820636f756c6420626520777261707065644f72646572426f6f6b3a20696e73756666696369656e7420657865637574696f6e20666565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f72646572426f6f6b3a20696e636f72726563742076616c7565207472616e736665727265644f72646572426f6f6b3a20696e76616c696420707269636520666f7220657865637574696f6e4f72646572426f6f6b3a20696e76616c6964205f706174682e6c656e677468005361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565644f72646572426f6f6b3a20696e636f727265637420657865637574696f6e20666565207472616e73666572726564a26469706673582212202610c86628fbd8285c70dfed183c037879a24456ba60d021c33192f4e48ea34e64736f6c634300060c0033", + "deployedBytecode": "0x6080604052600436106101c35760003560e01c8062cf066b1461022a578063026032ee1461026f57806307c7edc3146102fa5780630d5cc9381461033d57806311d9444a1461036757806312d43a51146103aa578063269ae6c2146103db5780632b7d6290146104a6578063392e53cd146105465780633fc8cef31461056f57806347e0bbd0146105845780634a686d67146105ae5780634c54f0b0146105c357806363ae21031461062d57806379221fa214610642578063807c5600146106c15780638de10c2e1461087357806395082d25146108885780639983ee1b1461089d5780639e23de5c146108db5780639e71b0f01461090e578063a397ea5414610938578063aec224551461097c578063b142a4b0146109af578063c16cde8a14610a99578063c4a1821b14610ae9578063c86b0f7d14610b99578063cfad57a214610bd7578063d0d40cd614610c0a578063d38ab51914610c9d578063d3bab1d114610ce0578063d566d0ca14610d74578063d7c41c7914610da7578063f2d2e01b14610e00578063f5b91b7b14610e94578063f882ac0714610ea9578063f887ea4014610ed3578063fbfa77cf14610ee8578063fc2cee6214610efd57610225565b36610225576008546001600160a01b03163314610223576040805162461bcd60e51b815260206004820152601960248201527827b93232b92137b7b59d1034b73b30b634b21039b2b73232b960391b604482015290519081900360640190fd5b005b600080fd5b34801561023657600080fd5b5061025d6004803603602081101561024d57600080fd5b50356001600160a01b0316610f27565b60408051918252519081900360200190f35b34801561027b57600080fd5b506102a86004803603604081101561029257600080fd5b506001600160a01b038135169060200135610f39565b604080516001600160a01b03998a168152602081019890985295909716868601526060860193909352901515608085015260a0840152151560c083015260e08201929092529051908190036101000190f35b34801561030657600080fd5b506102236004803603606081101561031d57600080fd5b506001600160a01b0381358116916020810135916040909101351661100c565b34801561034957600080fd5b506102236004803603602081101561036057600080fd5b5035611417565b34801561037357600080fd5b506102236004803603606081101561038a57600080fd5b506001600160a01b038135811691602081013591604090910135166114a8565b3480156103b657600080fd5b506103bf611857565b604080516001600160a01b039092168252519081900360200190f35b61022360048036036101008110156103f257600080fd5b810190602081018135600160201b81111561040c57600080fd5b82018360208201111561041e57600080fd5b803590602001918460208302840111600160201b8311171561043f57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604081013590606081013515159060808101359060a081013515159060c001351515611866565b3480156104b257600080fd5b506104df600480360360408110156104c957600080fd5b506001600160a01b038135169060200135611bef565b604080516001600160a01b039b8c168152998b1660208b015289810198909852958916606089015293909716608087015260a0860191909152151560c085015260e08401949094529215156101008301526101208201929092529051908190036101400190f35b34801561055257600080fd5b5061055b611c61565b604080519115158252519081900360200190f35b34801561057b57600080fd5b506103bf611c6a565b34801561059057600080fd5b50610223600480360360208110156105a757600080fd5b5035611c79565b3480156105ba57600080fd5b5061025d611f83565b3480156105cf57600080fd5b50610614600480360360a08110156105e657600080fd5b5080351515906020810135906001600160a01b03604082013516906060810135151590608001351515611f8f565b6040805192835290151560208301528051918290030190f35b34801561063957600080fd5b5061025d6120f8565b34801561064e57600080fd5b5061067b6004803603604081101561066557600080fd5b506001600160a01b0381351690602001356120fe565b604080516001600160a01b039098168852602088019690965286860194909452606086019290925215156080850152151560a084015260c0830152519081900360e00190f35b3480156106cd57600080fd5b50610223600480360360608110156106e457600080fd5b810190602081018135600160201b8111156106fe57600080fd5b82018360208201111561071057600080fd5b803590602001918460208302840111600160201b8311171561073157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561078057600080fd5b82018360208201111561079257600080fd5b803590602001918460208302840111600160201b831117156107b357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561080257600080fd5b82018360208201111561081457600080fd5b803590602001918460208302840111600160201b8311171561083557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550612152945050505050565b34801561087f57600080fd5b5061025d6121ea565b34801561089457600080fd5b5061025d6121f0565b3480156108a957600080fd5b50610223600480360360808110156108c057600080fd5b50803590602081013590604081013590606001351515612200565b3480156108e757600080fd5b5061025d600480360360208110156108fe57600080fd5b50356001600160a01b0316612358565b34801561091a57600080fd5b506102236004803603602081101561093157600080fd5b5035612502565b34801561094457600080fd5b50610223600480360360a081101561095b57600080fd5b50803590602081013590604081013590606081013590608001351515612774565b34801561098857600080fd5b5061025d6004803603602081101561099f57600080fd5b50356001600160a01b03166128dc565b61022360048036036101608110156109c657600080fd5b810190602081018135600160201b8111156109e057600080fd5b8201836020820111156109f257600080fd5b803590602001918460208302840111600160201b83111715610a1357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505082359350506001600160a01b036020830135811692604081013592506060810135916080820135169060a081013515159060c08101359060e081013515159061010081013590610120013515156128ee565b610223600480360360e0811015610aaf57600080fd5b506001600160a01b03813581169160208101359160408201351690606081013590608081013515159060a08101359060c001351515612cf0565b348015610af557600080fd5b5061055b60048036036040811015610b0c57600080fd5b810190602081018135600160201b811115610b2657600080fd5b820183602082011115610b3857600080fd5b803590602001918460208302840111600160201b83111715610b5957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250612da1915050565b348015610ba557600080fd5b5061022360048036036080811015610bbc57600080fd5b50803590602081013590604081013590606001351515612fb8565b348015610be357600080fd5b5061022360048036036020811015610bfa57600080fd5b50356001600160a01b0316613181565b348015610c1657600080fd5b50610c4360048036036040811015610c2d57600080fd5b506001600160a01b03813516906020013561322b565b604080516001600160a01b039a8b168152988a1660208a015296909816878701526060870194909452608086019290925260a0850152151560c0840152151560e08301526101008201929092529051908190036101200190f35b348015610ca957600080fd5b5061022360048036036060811015610cc057600080fd5b506001600160a01b038135811691602081013591604090910135166133e8565b348015610cec57600080fd5b50610d1960048036036040811015610d0357600080fd5b506001600160a01b038135169060200135613851565b604080516001600160a01b039a8b1681526020810199909952968916888801529490971660608701526080860192909252151560a085015260c084015292151560e08301526101008201929092529051908190036101200190f35b348015610d8057600080fd5b5061025d60048036036020811015610d9757600080fd5b50356001600160a01b0316613937565b348015610db357600080fd5b50610223600480360360c0811015610dca57600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060808101359060a00135613949565b348015610e0c57600080fd5b50610e3960048036036040811015610e2357600080fd5b506001600160a01b038135169060200135613ab8565b604080516001600160a01b039a8b168152988a1660208a0152888101979097529490971660608701526080860192909252151560a085015260c084015292151560e08301526101008201929092529051908190036101200190f35b348015610ea057600080fd5b506103bf613b22565b348015610eb557600080fd5b5061022360048036036020811015610ecc57600080fd5b5035613b31565b348015610edf57600080fd5b506103bf613e6e565b348015610ef457600080fd5b506103bf613e7d565b348015610f0957600080fd5b5061022360048036036020811015610f2057600080fd5b5035613e8c565b60066020526000908152604090205481565b600080600080600080600080610f4d614fd0565b505050506001600160a01b03968716600090815260036020818152604080842099845298815291889020885161012081018a5281548b16815260018201548b1693810184905260028201549981018a9052918101549099166060820181905260048a01546080830181905260058b015460ff908116151560a0850181905260068d015460c0860181905260078e0154909216151560e086018190526008909d0154610100909501859052949c9a9b929a91995093975092955093509150565b60026000541415611052576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b600260005561105f61501c565b6001600160a01b038085166000908152600560209081526040808320878452825291829020825161010081018452815490941684526001810180548451818502810185019095528085529193858401939092908301828280156110eb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110cd575b5050509183525050600282015460208201526003820154604082015260048201546060820152600582015460ff8082161515608084015261010090910416151560a082015260069091015460c09091015280519091506001600160a01b0316611189576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b8060a00151156111e0576111a581602001518260800151612da1565b6111e05760405162461bcd60e51b81526004018080602001828103825260268152602001806152f16026913960400191505060405180910390fd5b6001600160a01b0384166000908152600560209081526040808320868452909152812080546001600160a01b03191681559061121f600183018261506e565b50600060028201819055600382018190556004820181905560058201805461ffff191690556006909101819055600b54604083015160208401518051611292946001600160a01b03909416939061127257fe5b60200260200101516001600160a01b0316613f1d9092919063ffffffff16565b600854602082015180516000926001600160a01b0316919060001981019081106112b857fe5b60200260200101516001600160a01b03161480156112d757508160c001515b15611304576112ef8260200151836060015130613f74565b90506112ff8183600001516140a3565b61131e565b61131b826020015183606001518460000151613f74565b90505b61132c8260e00151846140a3565b846001600160a01b03167f7e1fe496989eea92b738a562dbf9c0ae6aa6fcf3f1ef09e95ee4f7603721706b858460200151856040015186606001518688608001518960a001518a60c001518b60e00151604051808a8152602001806020018981526020018881526020018781526020018681526020018515158152602001841515815260200183815260200182810382528a818151815260200191508051906020019060200280838360005b838110156113f05781810151838201526020016113d8565b505050509050019a505050505050505050505060405180910390a250506001600055505050565b6007546001600160a01b0316331461146d576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600d8190556040805182815290517fe46d9daf6d25f7615efa1d0183b90ac6759d85014b598e409aadf0fd918d59a69181900360200190a150565b600260005414156114ee576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000556114fb614fd0565b506001600160a01b03808416600090815260036020818152604080842087855282529283902083516101208101855281548616808252600183015487169382019390935260028201549481019490945291820154909316606083015260048101546080830152600581015460ff908116151560a0840152600682015460c0840152600782015416151560e083015260080154610100820152906115d3576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b60006115f48260e001518360c0015184606001518560a00151156001611f8f565b506001600160a01b0380871660009081526003602081815260408084208a8552825280842080546001600160a01b0319908116825560018201805482169055600282018690559381018054909416909355600480840185905560058401805460ff199081169091556006850186905560078501805490911690556008909301849055600a5488518984015160608b01518b85015160808d015160a08e01518751632662166b60e01b8152958c1699860199909952928a16602485015290891660448401526064830152608482015293151560a48501523060c4850152905195965092949290931692632662166b9260e48084019382900301818787803b1580156116fd57600080fd5b505af1158015611711573d6000803e3d6000fd5b505050506040513d602081101561172757600080fd5b505160085460208501519192506001600160a01b039182169116141561175a576117558184600001516140a3565b611777565b82516020840151611777916001600160a01b039091169083613f1d565b611786836101000151856140a3565b82600001516001600160a01b03167f9a382661d6573da86db000471303be6f0b2b1bb66089b08e3c16a85d7b6e94f88685602001518660400151876060015188608001518960a001518a60c001518b60e001518c61010001518c604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001878152602001861515815260200185815260200184151581526020018381526020018281526020019a505050505050505050505060405180910390a25050600160005550505050565b6007546001600160a01b031681565b600260005414156118ac576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000819055885114806118c2575087516003145b611901576040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b8760018951038151811061191157fe5b60200260200101516001600160a01b03168860008151811061192f57fe5b60200260200101516001600160a01b0316141561198e576040805162461bcd60e51b815260206004820152601860248201527709ee4c8cae484deded67440d2dcecc2d8d2c840bee0c2e8d60431b604482015290519081900360640190fd5b600087116119e2576040805162461bcd60e51b815260206004820152601c60248201527b27b93232b92137b7b59d1034b73b30b634b2102fb0b6b7bab73a24b760211b604482015290519081900360640190fd5b600c54831015611a235760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b611a2b614120565b8115611ae65760085488516001600160a01b03909116908990600090611a4d57fe5b60200260200101516001600160a01b031614611a9a5760405162461bcd60e51b81526004018080602001828103825260258152602001806152606025913960400191505060405180910390fd5b611aa48388614192565b3414611ae15760405162461bcd60e51b81526004018080602001828103825260268152602001806152cb6026913960400191505060405180910390fd5b611bd0565b823414611b245760405162461bcd60e51b815260040180806020018281038252602e815260200180615361602e913960400191505060405180910390fd5b600a5488516001600160a01b0390911690631b827878908a90600090611b4657fe5b602002602001015133308b6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015611bb757600080fd5b505af1158015611bcb573d6000803e3d6000fd5b505050505b611be0338989898989878a6141ea565b50506001600055505050505050565b6001602081815260009384526040808520909152918352912080549181015460028201546003830154600484015460058501546006860154600787015460088801546009909801546001600160a01b03998a1699978816989697958616969490951694929360ff92831693919216908a565b600e5460ff1681565b6008546001600160a01b031681565b60026000541415611cbf576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055611ccc61508f565b5033600090815260016020818152604080842085855282529283902083516101408101855281546001600160a01b039081168083529483015481169382019390935260028201549481019490945260038101548216606085015260048101549091166080840152600581015460a0840152600681015460ff908116151560c0850152600782015460e0850152600882015416151561010084015260090154610120830152611daf576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b3360009081526001602081815260408084208685528252832080546001600160a01b0319908116825592810180548416905560028101849055600381018054841690556004810180549093169092556005820183905560068201805460ff19908116909155600783018490556008808401805490921690915560099092019290925554908201516001600160a01b0390811691161415611e7357611e6e611e68826040015183610120015161419290919063ffffffff16565b336140a3565b611ea8565b611e9933826040015183602001516001600160a01b0316613f1d9092919063ffffffff16565b611ea8816101200151336140a3565b80600001516001600160a01b03167fd500f34e0ec655b7614ae42e1d9c666d5e4dde909a1297829f8c5ecf00805d328383602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001876001600160a01b03168152602001868152602001851515815260200184815260200183151581526020018281526020019a505050505050505050505060405180910390a250506001600055565b670de0b6b3a764000081565b60008060008461201757600b54604080516340d3096b60e11b81526001600160a01b038981166004830152915191909216916381a612d6916024808301926020929190829003018186803b158015611fe657600080fd5b505afa158015611ffa573d6000803e3d6000fd5b505050506040513d602081101561201057600080fd5b5051612091565b600b5460408051637092736960e11b81526001600160a01b0389811660048301529151919092169163e124e6d2916024808301926020929190829003018186803b15801561206457600080fd5b505afa158015612078573d6000803e3d6000fd5b505050506040513d602081101561208e57600080fd5b50515b90506000886120a2578782106120a6565b8782115b905084156120ea57806120ea5760405162461bcd60e51b81526004018080602001828103825260268152602001806152f16026913960400191505060405180910390fd5b909890975095505050505050565b600c5481565b600560208181526000938452604080852090915291835291208054600282015460038301546004840154948401546006909401546001600160a01b03909316949193909260ff808316926101009004169087565b60005b83518110156121825761217a84828151811061216d57fe5b6020026020010151613b31565b600101612155565b5060005b82518110156121b3576121ab83828151811061219e57fe5b6020026020010151611c79565b600101612186565b5060005b81518110156121e4576121dc8282815181106121cf57fe5b6020026020010151612502565b6001016121b7565b50505050565b600d5481565b68327cb2734119d3b7a9601e1b81565b60026000541415612246576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600160209081526040808320878452909152902080546001600160a01b03166122ae576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b6007810183905560088101805483151560ff19909116811790915560058201859055600382015460048301546006840154604080518a81526001600160a01b039485166020820152929093168284015260ff16151560608201526080810187905260a0810186905260c08101929092525133917f0a0360dd5c354235bbf8d386ba3b24ef8134088e0785677de1504df219d9149a919081900360e00190a250506001600055505050565b600b5460408051632c668ec160e01b81526001600160a01b038481166004830152670de0b6b3a76400006024830152915160009384931691632c668ec1916044808301926020929190829003018186803b1580156123b557600080fd5b505afa1580156123c9573d6000803e3d6000fd5b505050506040513d60208110156123df57600080fd5b5051600b54604080516340d3096b60e11b81526001600160a01b038781166004830152915193945060009391909216916381a612d6916024808301926020929190829003018186803b15801561243457600080fd5b505afa158015612448573d6000803e3d6000fd5b505050506040513d602081101561245e57600080fd5b5051600b54604080516323b95ceb60e21b81526001600160a01b03888116600483015291519394506000939190921691638ee573ac916024808301926020929190829003018186803b1580156124b357600080fd5b505afa1580156124c7573d6000803e3d6000fd5b505050506040513d60208110156124dd57600080fd5b505190506124f9600a82900a6124f385856143f9565b90614452565b95945050505050565b60026000541415612548576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612555614fd0565b5033600090815260036020818152604080842085855282529283902083516101208101855281546001600160a01b03908116808352600184015482169483019490945260028301549582019590955292810154909316606083015260048301546080830152600583015460ff908116151560a0840152600684015460c0840152600784015416151560e08301526008909201546101008201529061262e576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b336000818152600360208181526040808420878552909152822080546001600160a01b03199081168255600182018054821690556002820184905591810180549092169091556004810182905560058101805460ff19908116909155600682018390556007820180549091169055600801556101008201516126af916140a3565b80600001516001600160a01b03167f1154174c82984656b028c8021671988f60a346497e56fe02554761184f82a0758383602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151604051808a8152602001896001600160a01b03168152602001888152602001876001600160a01b0316815260200186815260200185151581526020018481526020018315158152602001828152602001995050505050505050505060405180910390a250506001600055565b600260005414156127ba576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600360209081526040808320888452909152902080546001600160a01b0316612822576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b6006810183905560078101805483151560ff1990911681179091556004820185905560028201869055600182015460038301546005840154604080518b81526001600160a01b0394851660208201528082018b90529290931660608301526080820188905260ff16151560a082015260c0810186905260e08101929092525133917f75781255bc71c83f89f29e5a2599f2c174a562d2cd8f2e818a47f132e728049891908190036101000190a25050600160005550505050565b60026020526000908152604090205481565b60026000541415612934576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612941614120565b600c548210156129825760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b8015612a3d576008548b516001600160a01b03909116908c906000906129a457fe5b60200260200101516001600160a01b0316146129f15760405162461bcd60e51b81526004018080602001828103825260258152602001806152606025913960400191505060405180910390fd5b6129fb828b614192565b3414612a385760405162461bcd60e51b81526004018080602001828103825260268152602001806152cb6026913960400191505060405180910390fd5b612b27565b813414612a7b5760405162461bcd60e51b815260040180806020018281038252602e815260200180615361602e913960400191505060405180910390fd5b600a548b516001600160a01b0390911690631b827878908d90600090612a9d57fe5b602002602001015133308e6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b158015612b0e57600080fd5b505af1158015612b22573d6000803e3d6000fd5b505050505b60008b60018d510381518110612b3957fe5b60200260200101519050600060018d511115612bfe57816001600160a01b03168d600081518110612b6657fe5b60200260200101516001600160a01b03161415612bc5576040805162461bcd60e51b815260206004820152601860248201527709ee4c8cae484deded67440d2dcecc2d8d2c840bee0c2e8d60431b604482015290519081900360640190fd5b612bec600b60009054906101000a90046001600160a01b03168d8f60008151811061127257fe5b612bf78d8b30613f74565b9050612c01565b508a5b600b5460408051630a48d5a960e01b81526001600160a01b0385811660048301526024820185905291516000939290921691630a48d5a991604480820192602092909190829003018186803b158015612c5957600080fd5b505afa158015612c6d573d6000803e3d6000fd5b505050506040513d6020811015612c8357600080fd5b5051600d54909150811015612cc95760405162461bcd60e51b81526004018080602001828103825260228152602001806151bd6022913960400191505060405180910390fd5b50612cdc3383838b8f8e8d8d8d8d614491565b505060016000555050505050505050505050565b60026000541415612d36576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055612d43614120565b600c543411612d835760405162461bcd60e51b81526004018080602001828103825260258152602001806152856025913960400191505060405180910390fd5b612d933386868a8a888888614764565b505060016000555050505050565b6000825160021480612db4575082516003145b612df3576040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b600083600081518110612e0257fe5b60200260200101519050600084600186510381518110612e1e57fe5b602090810291909101015160095490915060009081906001600160a01b0385811691161415612e6b57612e6487600181518110612e5757fe5b6020026020010151612358565b9150612ee7565b600b54604080516340d3096b60e11b81526001600160a01b038781166004830152915191909216916381a612d6916024808301926020929190829003018186803b158015612eb857600080fd5b505afa158015612ecc573d6000803e3d6000fd5b505050506040513d6020811015612ee257600080fd5b505191505b6009546001600160a01b0384811691161415612f10575068327cb2734119d3b7a9601e1b612f8c565b600b5460408051637092736960e11b81526001600160a01b0386811660048301529151919092169163e124e6d2916024808301926020929190829003018186803b158015612f5d57600080fd5b505afa158015612f71573d6000803e3d6000fd5b505050506040513d6020811015612f8757600080fd5b505190505b6000612fa8836124f38468327cb2734119d3b7a9601e1b6143f9565b8710955050505050505b92915050565b60026000541415612ffe576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b60026000908155338152600560209081526040808320878452909152902080546001600160a01b0316613066576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b838160030181905550828160040181905550818160050160006101000a81548160ff021916908315150217905550336001600160a01b03167fa7f9f4a25eb76f5ec01b1a429d95d6a00833f0f137c88827c58799a1c1ff0dfe868360010184600201548888888860050160019054906101000a900460ff168960060154604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818154815260200191508054801561316057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613142575b5050995050505050505050505060405180910390a250506001600055505050565b6007546001600160a01b031633146131d7576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600780546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fe24c39186e9137521953beaa8446e71f55b8f12296984f9d4273ceb1af728d909181900360200190a150565b600080600080600080600080600061324161501c565b6001600160a01b03808d1660009081526005602090815260408083208f8452825291829020825161010081018452815490941684526001810180548451818502810185019095528085529193858401939092908301828280156132cd57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116132af575b505050918352505060028201546020808301919091526003830154604083015260048301546060830152600583015460ff8082161515608085015261010090910416151560a083015260069092015460c0909101528101515190915061333457600061334e565b806020015160008151811061334557fe5b60200260200101515b60018260200151511161336257600061337c565b816020015160018151811061337357fe5b60200260200101515b6002836020015151116133905760006133aa565b82602001516002815181106133a157fe5b60200260200101515b8360400151846060015185608001518660a001518760c001518860e00151995099509950995099509950995099509950509295985092959850929598565b6002600054141561342e576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b600260005561343b61508f565b506001600160a01b038084166000908152600160208181526040808420878552825292839020835161014081018552815486168082529382015486169281019290925260028101549382019390935260038301548416606082015260048301549093166080840152600582015460a0840152600682015460ff908116151560c0850152600783015460e08501526008830154161515610100840152600990910154610120830152613521576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b60006135428261010001518360e0015184608001518560c001516001611f8f565b506001600160a01b0380871660009081526001602081815260408084208a8552825280842080546001600160a01b0319908116825593810180548516905560028101859055600381018054851690556004810180549094169093556005830184905560068301805460ff19908116909155600784018590556008840180549091169055600990920192909255600b5490860151918601519394506135ea938316921690613f1d565b81606001516001600160a01b031682602001516001600160a01b0316146136c257604080516002808252606080830184529260208301908036833701905050905082602001518160008151811061363d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082606001518160018151811061366f57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600061369d82600030613f74565b600b5460608601519192506136bf916001600160a01b03908116911683613f1d565b50505b600a5482516060840151608085015160a086015160c087015160408051630f8ee8bb60e11b81526001600160a01b03968716600482015294861660248601529285166044850152606484019190915215156084830152519190921691631f1dd1769160a480830192600092919082900301818387803b15801561374457600080fd5b505af1158015613758573d6000803e3d6000fd5b5050505061376b826101200151846140a3565b81600001516001600160a01b03167f7fb1c74d1ea6aa1c9c585e17ce8274c8ff98745e85e7459b73f87d784494f58e8584602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001518c604051808c81526020018b6001600160a01b031681526020018a8152602001896001600160a01b03168152602001886001600160a01b03168152602001878152602001861515815260200185815260200184151581526020018381526020018281526020019b50505050505050505050505060405180910390a250506001600055505050565b600080600080600080600080600061386761508f565b505050506001600160a01b0397881660009081526001602081815260408084209a845299815291899020895161014081018b5281548c168152918101548b1692820183905260028101549982018a905260038101548b16606083018190526004820154909b1660808301819052600582015460a08401819052600683015460ff908116151560c08601819052600785015460e08701819052600886015490921615156101008701819052600990950154610120909601869052959e9c9d9c929b5090995093975092955093509150565b60046020526000908152604090205481565b6007546001600160a01b0316331461399f576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600e5460ff16156139f7576040805162461bcd60e51b815260206004820152601e60248201527f4f72646572426f6f6b3a20616c726561647920696e697469616c697a65640000604482015290519081900360640190fd5b600e805460ff19166001179055600a80546001600160a01b038089166001600160a01b03199283168117909355600b8054898316908416811790915560088054898416908516811790915560098054938916939094168317909355600c869055600d8590556040805194855260208501919091528381019290925260608301526080820184905260a08201839052517fcfb7ef8749fafc8da2af1ba3d025479ffc4e58f7dc420113e112512a3bda59639181900360c00190a1505050505050565b600360208181526000938452604080852090915291835291208054600182015460028301549383015460048401546005850154600686015460078701546008909701546001600160a01b039687169895871697959690941694929360ff9283169391929091169089565b6009546001600160a01b031681565b60026000541415613b77576040805162461bcd60e51b815260206004820152601f602482015260008051602061519d833981519152604482015290519081900360640190fd5b6002600055613b8461501c565b33600090815260056020908152604080832085845282529182902082516101008101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015613c0d57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613bef575b5050509183525050600282015460208201526003820154604082015260048201546060820152600582015460ff8082161515608084015261010090910416151560a082015260069091015460c09091015280519091506001600160a01b0316613cab576040805162461bcd60e51b815260206004820152601d602482015260008051602061517d833981519152604482015290519081900360640190fd5b336000908152600560209081526040808320858452909152812080546001600160a01b031916815590613ce1600183018261506e565b50600060028201819055600382018190556004820181905560058201805461ffff191690556006909101819055600854602083015180516001600160a01b03909216929091613d2c57fe5b60200260200101516001600160a01b03161415613d6657613d61611e6882604001518360e0015161419290919063ffffffff16565b613d8e565b613d80338260400151836020015160008151811061127257fe5b613d8e8160e00151336140a3565b336001600160a01b03167fefd66d4f9c2f880c70aedeb5b26a44fb474cea07e5d6c533f2d27c303d5d94538383602001518460400151856060015186608001518760a001518860c001518960e00151604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818151815260200191508051906020019060200280838360005b83811015613e4b578181015183820152602001613e33565b50505050905001995050505050505050505060405180910390a250506001600055565b600a546001600160a01b031681565b600b546001600160a01b031681565b6007546001600160a01b03163314613ee2576040805162461bcd60e51b815260206004820152601460248201527327b93232b92137b7b59d103337b93134b23232b760611b604482015290519081900360640190fd5b600c8190556040805182815290517fbde5eafdc37b81830d70124cddccaaa6d034e71dda3c8fc18a959ca76a7cbcfc9181900360200190a150565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052613f6f9084906149da565b505050565b6000835160021415613fbb57613fb484600081518110613f9057fe5b602002602001015185600181518110613fa557fe5b60200260200101518585614a8b565b905061409c565b835160031415614061576000613ffc85600081518110613fd757fe5b602002602001015186600181518110613fec57fe5b6020026020010151600030614a8b565b9050614025600b60009054906101000a90046001600160a01b0316828760018151811061127257fe5b6140598560018151811061403557fe5b60200260200101518660028151811061404a57fe5b60200260200101518686614a8b565b91505061409c565b6040805162461bcd60e51b815260206004820152601f6024820152600080516020615317833981519152604482015290519081900360640190fd5b9392505050565b60085460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156140f057600080fd5b505af1158015614104573d6000803e3d6000fd5b5061411c925050506001600160a01b03821683614c6a565b5050565b341561419057600860009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561417657600080fd5b505af115801561418a573d6000803e3d6000fd5b50505050505b565b60008282018381101561409c576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b6001600160a01b03881660009081526006602052604090205461420b61501c565b6040518061010001604052808b6001600160a01b031681526020018a81526020018981526020018881526020018781526020018615158152602001851515815260200184815250905061426860018361419290919063ffffffff16565b6001600160a01b038b8116600090815260066020908152604080832094909455600581528382208683528152929020835181546001600160a01b031916921691909117815582820151805184936142c69260018501929101906150e3565b5060408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c08201518160050160016101000a81548160ff02191690831515021790555060e08201518160060155905050896001600160a01b03167fdf06bb56ffc4029dc0b62b68bb5bbadea93a38b530cefc9b81afb742a6555d88838b8b8b8b8b8b8b604051808981526020018060200188815260200187815260200186815260200185151581526020018415158152602001838152602001828103825289818151815260200191508051906020019060200280838360005b838110156143d35781810151838201526020016143bb565b50505050905001995050505050505050505060405180910390a250505050505050505050565b60008261440857506000612fb2565b8282028284828161441557fe5b041461409c5760405162461bcd60e51b81526004018080602001828103825260218152602001806152aa6021913960400191505060405180910390fd5b600061409c83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b815250614d4f565b336000908152600260205260409020546144a961508f565b6040518061014001604052808d6001600160a01b031681526020018c6001600160a01b031681526020018b81526020018a6001600160a01b03168152602001896001600160a01b031681526020018881526020018715158152602001868152602001851515815260200184815250905061452d60018361419290919063ffffffff16565b600260008e6001600160a01b03166001600160a01b031681526020019081526020016000208190555080600160008e6001600160a01b03166001600160a01b03168152602001908152602001600020600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060808201518160040160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555060e082015181600701556101008201518160080160006101000a81548160ff02191690831515021790555061012082015181600901559050508b6001600160a01b03167fb27b9afe3043b93788c40cfc3cc73f5d928a2e40f3ba01820b246426de8fa1b9838d8d8d8d8d8d8d8d8d604051808b81526020018a6001600160a01b03168152602001898152602001886001600160a01b03168152602001876001600160a01b03168152602001868152602001851515815260200184815260200183151581526020018281526020019a505050505050505050505060405180910390a2505050505050505050505050565b6001600160a01b038816600090815260046020526040902054614785614fd0565b5060408051610120810182526001600160a01b03808c1682528a8116602083015291810189905290871660608201526080810186905284151560a082015260c0810184905282151560e0820152346101008201526147e4826001614192565b600460008c6001600160a01b03166001600160a01b031681526020019081526020016000208190555080600360008c6001600160a01b03166001600160a01b03168152602001908152602001600020600084815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506080820151816004015560a08201518160050160006101000a81548160ff02191690831515021790555060c0820151816006015560e08201518160070160006101000a81548160ff0219169083151502179055506101008201518160080155905050896001600160a01b03167f48ee333d2a65cc45fdb83bc012920d89181c3377390cd239d2b63f2bef67a02d838b8b8b8b8b8b8b34604051808a8152602001896001600160a01b03168152602001888152602001876001600160a01b0316815260200186815260200185151581526020018481526020018315158152602001828152602001995050505050505050505060405180910390a250505050505050505050565b6060614a2f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614df19092919063ffffffff16565b805190915015613f6f57808060200190516020811015614a4e57600080fd5b5051613f6f5760405162461bcd60e51b815260040180806020018281038252602a815260200180615337602a913960400191505060405180910390fd5b60095460009081906001600160a01b0386811691161415614b3057600b546040805163817bb85760e01b81526001600160a01b03898116600483015286811660248301529151919092169163817bb8579160448083019260209291908290030181600087803b158015614afd57600080fd5b505af1158015614b11573d6000803e3d6000fd5b505050506040513d6020811015614b2757600080fd5b50519050614c2b565b6009546001600160a01b0387811691161415614b9d57600b5460408051630711e61960e41b81526001600160a01b03888116600483015286811660248301529151919092169163711e61909160448083019260209291908290030181600087803b158015614afd57600080fd5b600b5460408051634998b10960e11b81526001600160a01b038981166004830152888116602483015286811660448301529151919092169163933162129160648083019260209291908290030181600087803b158015614bfc57600080fd5b505af1158015614c10573d6000803e3d6000fd5b505050506040513d6020811015614c2657600080fd5b505190505b838110156124f95760405162461bcd60e51b815260040180806020018281038252602181526020018061523f6021913960400191505060405180910390fd5b80471015614cbf576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114614d0a576040519150601f19603f3d011682016040523d82523d6000602084013e614d0f565b606091505b5050905080613f6f5760405162461bcd60e51b815260040180806020018281038252603a8152602001806151df603a913960400191505060405180910390fd5b60008183614ddb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614da0578181015183820152602001614d88565b50505050905090810190601f168015614dcd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581614de757fe5b0495945050505050565b6060614e008484600085614e08565b949350505050565b606082471015614e495760405162461bcd60e51b81526004018080602001828103825260268152602001806152196026913960400191505060405180910390fd5b614e5285614f64565b614ea3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614ee25780518252601f199092019160209182019101614ec3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614f44576040519150601f19603f3d011682016040523d82523d6000602084013e614f49565b606091505b5091509150614f59828286614f6a565b979650505050505050565b3b151590565b60608315614f7957508161409c565b825115614f895782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315614da0578181015183820152602001614d88565b6040805161012081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810182905261010081019190915290565b60405180610100016040528060006001600160a01b0316815260200160608152602001600081526020016000815260200160008152602001600015158152602001600015158152602001600081525090565b508054600082559060005260206000209081019061508c9190615148565b50565b6040805161014081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081019190915290565b828054828255906000526020600020908101928215615138579160200282015b8281111561513857825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615103565b5061514492915061515d565b5090565b5b808211156151445760008155600101615149565b5b808211156151445780546001600160a01b031916815560010161515e56fe4f72646572426f6f6b3a206e6f6e2d6578697374656e74206f726465720000005265656e7472616e637947756172643a207265656e7472616e742063616c6c004f72646572426f6f6b3a20696e73756666696369656e7420636f6c6c61746572616c416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f72646572426f6f6b3a20696e73756666696369656e7420616d6f756e744f75744f72646572426f6f6b3a206f6e6c79207765746820636f756c6420626520777261707065644f72646572426f6f6b3a20696e73756666696369656e7420657865637574696f6e20666565536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f72646572426f6f6b3a20696e636f72726563742076616c7565207472616e736665727265644f72646572426f6f6b3a20696e76616c696420707269636520666f7220657865637574696f6e4f72646572426f6f6b3a20696e76616c6964205f706174682e6c656e677468005361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565644f72646572426f6f6b3a20696e636f727265637420657865637574696f6e20666565207472616e73666572726564a26469706673582212202610c86628fbd8285c70dfed183c037879a24456ba60d021c33192f4e48ea34e64736f6c634300060c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/projects/amped/src/abis/PositionRouter.js b/projects/amped/src/abis/PositionRouter.js new file mode 100644 index 00000000..b515c21c --- /dev/null +++ b/projects/amped/src/abis/PositionRouter.js @@ -0,0 +1,220 @@ +export var PositionRouter = [ + { + "inputs": [], + "name": "minExecutionFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePosition", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePositionETH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withdrawETH", + "type": "bool" + } + ], + "name": "createDecreasePosition", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + } + ], + "name": "getRequestQueueLengths", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +]; diff --git a/projects/amped/src/abis/PositionRouter.json b/projects/amped/src/abis/PositionRouter.json new file mode 100644 index 00000000..8d79021e --- /dev/null +++ b/projects/amped/src/abis/PositionRouter.json @@ -0,0 +1,2159 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "PositionRouter", + "sourceName": "contracts/core/PositionRouter.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_vault", + "type": "address" + }, + { + "internalType": "address", + "name": "_router", + "type": "address" + }, + { + "internalType": "address", + "name": "_weth", + "type": "address" + }, + { + "internalType": "address", + "name": "_shortsTracker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_depositFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minExecutionFee", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "callbackTarget", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "success", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "name": "Callback", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockGap", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeGap", + "type": "uint256" + } + ], + "name": "CancelDecreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockGap", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeGap", + "type": "uint256" + } + ], + "name": "CancelIncreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "queueIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + } + ], + "name": "CreateDecreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "queueIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "gasPrice", + "type": "uint256" + } + ], + "name": "CreateIncreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "marginFeeBasisPoints", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "referralCode", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "DecreasePositionReferral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockGap", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeGap", + "type": "uint256" + } + ], + "name": "ExecuteDecreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "path", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "blockGap", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timeGap", + "type": "uint256" + } + ], + "name": "ExecuteIncreasePosition", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "marginFeeBasisPoints", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "referralCode", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "IncreasePositionReferral", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "admin", + "type": "address" + } + ], + "name": "SetAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "name": "SetCallbackGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "callbackTarget", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "callbackGasLimit", + "type": "uint256" + } + ], + "name": "SetCustomCallbackGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minBlockDelayKeeper", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "minTimeDelayPublic", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxTimeDelay", + "type": "uint256" + } + ], + "name": "SetDelayValues", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "depositFee", + "type": "uint256" + } + ], + "name": "SetDepositFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "ethTransferGasLimit", + "type": "uint256" + } + ], + "name": "SetEthTransferGasLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "increasePositionBufferBps", + "type": "uint256" + } + ], + "name": "SetIncreasePositionBufferBps", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "isLeverageEnabled", + "type": "bool" + } + ], + "name": "SetIsLeverageEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "longSizes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "shortSizes", + "type": "uint256[]" + } + ], + "name": "SetMaxGlobalSizes", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minExecutionFee", + "type": "uint256" + } + ], + "name": "SetMinExecutionFee", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "isActive", + "type": "bool" + } + ], + "name": "SetPositionKeeper", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "referralStorage", + "type": "address" + } + ], + "name": "SetReferralStorage", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "increasePositionRequestKeysStart", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "decreasePositionRequestKeysStart", + "type": "uint256" + } + ], + "name": "SetRequestKeysStartValues", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "WithdrawFees", + "type": "event" + }, + { + "inputs": [], + "name": "BASIS_POINTS_DIVISOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "callbackGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "cancelDecreasePosition", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "cancelIncreasePosition", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withdrawETH", + "type": "bool" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createDecreasePosition", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePosition", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePositionETH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "customCallbackGasLimits", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "decreasePositionRequestKeys", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decreasePositionRequestKeysStart", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "decreasePositionRequests", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "withdrawETH", + "type": "bool" + }, + { + "internalType": "address", + "name": "callbackTarget", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "decreasePositionsIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "depositFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ethTransferGasLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "executeDecreasePosition", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_endIndex", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "executeDecreasePositions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "executeIncreasePosition", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_endIndex", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_executionFeeReceiver", + "type": "address" + } + ], + "name": "executeIncreasePositions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "feeReserves", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + } + ], + "name": "getDecreasePositionRequestPath", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_key", + "type": "bytes32" + } + ], + "name": "getIncreasePositionRequestPath", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_index", + "type": "uint256" + } + ], + "name": "getRequestKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getRequestQueueLengths", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gov", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "increasePositionBufferBps", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "increasePositionRequestKeys", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "increasePositionRequestKeysStart", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "increasePositionRequests", + "outputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "executionFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "hasCollateralInETH", + "type": "bool" + }, + { + "internalType": "address", + "name": "callbackTarget", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "increasePositionsIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isLeverageEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "isPositionKeeper", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxGlobalLongSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "maxGlobalShortSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxTimeDelay", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minBlockDelayKeeper", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minExecutionFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minTimeDelayPublic", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "referralStorage", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "router", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "sendValue", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_admin", + "type": "address" + } + ], + "name": "setAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_callbackGasLimit", + "type": "uint256" + } + ], + "name": "setCallbackGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_callbackGasLimit", + "type": "uint256" + } + ], + "name": "setCustomCallbackGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minBlockDelayKeeper", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minTimeDelayPublic", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxTimeDelay", + "type": "uint256" + } + ], + "name": "setDelayValues", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_depositFee", + "type": "uint256" + } + ], + "name": "setDepositFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_ethTransferGasLimit", + "type": "uint256" + } + ], + "name": "setEthTransferGasLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + } + ], + "name": "setGov", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_increasePositionBufferBps", + "type": "uint256" + } + ], + "name": "setIncreasePositionBufferBps", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_isLeverageEnabled", + "type": "bool" + } + ], + "name": "setIsLeverageEnabled", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_longSizes", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "_shortSizes", + "type": "uint256[]" + } + ], + "name": "setMaxGlobalSizes", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_minExecutionFee", + "type": "uint256" + } + ], + "name": "setMinExecutionFee", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isActive", + "type": "bool" + } + ], + "name": "setPositionKeeper", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_referralStorage", + "type": "address" + } + ], + "name": "setReferralStorage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_increasePositionRequestKeysStart", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_decreasePositionRequestKeysStart", + "type": "uint256" + } + ], + "name": "setRequestKeysStartValues", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "shortsTracker", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x60806040526207a12060075560646009556012805460ff191660011790553480156200002a57600080fd5b5060405162005faa38038062005faa833981810160405260c08110156200005057600080fd5b508051602082015160408301516060840151608085015160a090950151600160008181558154336001600160a01b031991821681179093556003805482166001600160a01b03998a16179055600580548216978916979097179096556006805487169588169590951790945560089690965560048054851695909216949094179055600280549092169093179055600e55615eb8908190620000f290396000f3fe6080604052600436106102aa5760003560e01c80626cc35e1461030657806304225954146103375780630d4d003d146103735780631045c74e146103c0578063126082cf146103f357806312d43a51146104085780631bca8cf01461041d5780631ce9cb8f146104325780631f28510614610465578063225fc9fd14610507578063233bfe3b1461054057806324a084df1461056a57806324f74697146105a357806327b42c0f146105b85780632d79cf42146105f1578063308aa81f146106065780633422ead11461063657806336eba48a146106715780633a2a80c7146106a45780633a9b52ad146106b95780633e72a262146106e35780633fc8cef3146106f85780634067b1321461070d5780634278555f14610743578063490ae2101461076d5780635841fcaa146107975780635b88e8c6146107ac5780635d5c22e81461088557806360a362e2146108ff57806362f8a3fe14610938578063633451de1461097157806363ae2103146109a4578063657bc5d0146109b957806367a52793146109ce578063704b6c02146109e35780637be7d14114610a165780637c2eb9f714610b01578063804fc70214610b2d5780638a54942f14610b6657806395e9bbd714610b905780639698d25a14610bba57806398d1e03a14610bed5780639a20810014610c025780639b57862014610c3b578063ae4d7f9a14610c50578063c4f38e3314610c83578063cb0269c914610cb6578063cfad57a214610ccb578063e1f21c6714610cfe578063ef12c67e14610d41578063f255527814610ef3578063f2ae372f14610f2e578063f2cea6a51461100d578063f3883d8b14611048578063f851a44014611081578063f887ea4014611096578063fa444577146110ab578063faf990f3146110de578063fbfa77cf14611177578063fc2cee621461118c57610301565b36610301576006546001600160a01b031633146102ff576040805162461bcd60e51b815260206004820152600e60248201526d34b73b30b634b21039b2b73232b960911b604482015290519081900360640190fd5b005b600080fd5b34801561031257600080fd5b5061031b6111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561034357600080fd5b506103616004803603602081101561035a57600080fd5b50356111c5565b60408051918252519081900360200190f35b34801561037f57600080fd5b506103ac6004803603604081101561039657600080fd5b50803590602001356001600160a01b03166111e3565b604080519115158252519081900360200190f35b3480156103cc57600080fd5b50610361600480360360208110156103e357600080fd5b50356001600160a01b0316611681565b3480156103ff57600080fd5b50610361611693565b34801561041457600080fd5b5061031b611699565b34801561042957600080fd5b506103616116a8565b34801561043e57600080fd5b506103616004803603602081101561045557600080fd5b50356001600160a01b03166116ae565b34801561047157600080fd5b5061048f6004803603602081101561048857600080fd5b50356116c0565b604080516001600160a01b039e8f1681529c8e1660208e01528c81019b909b5260608c019990995296151560808b0152948a1660a08a015260c089019390935260e088019190915261010087015261012086015261014085015215156101608401529092166101808201529051908190036101a00190f35b34801561051357600080fd5b506103ac6004803603604081101561052a57600080fd5b50803590602001356001600160a01b0316611733565b34801561054c57600080fd5b506102ff6004803603602081101561056357600080fd5b5035611afd565b34801561057657600080fd5b506102ff6004803603604081101561058d57600080fd5b506001600160a01b038135169060200135611b83565b3480156105af57600080fd5b50610361611be7565b3480156105c457600080fd5b506103ac600480360360408110156105db57600080fd5b50803590602001356001600160a01b0316611bed565b3480156105fd57600080fd5b50610361612053565b34801561061257600080fd5b506102ff6004803603604081101561062957600080fd5b5080359060200135612059565b34801561064257600080fd5b506102ff6004803603604081101561065957600080fd5b506001600160a01b03813516906020013515156120ed565b34801561067d57600080fd5b506103ac6004803603602081101561069457600080fd5b50356001600160a01b0316612198565b3480156106b057600080fd5b506103616121ad565b3480156106c557600080fd5b506102ff600480360360208110156106dc57600080fd5b50356121b3565b3480156106ef57600080fd5b506103ac612239565b34801561070457600080fd5b5061031b612242565b34801561071957600080fd5b506102ff6004803603606081101561073057600080fd5b5080359060208101359060400135612251565b34801561074f57600080fd5b506103616004803603602081101561076657600080fd5b50356122f0565b34801561077957600080fd5b506102ff6004803603602081101561079057600080fd5b50356122fd565b3480156107a357600080fd5b50610361612383565b61036160048036036101208110156107c357600080fd5b810190602081018135600160201b8111156107dd57600080fd5b8201836020820111156107ef57600080fd5b803590602001918460208302840111600160201b8311171561081057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b03908116935060208301359260408101359250606081013515159160808201359160a08101359160c08201359160e0013516612389565b34801561089157600080fd5b506108af600480360360208110156108a857600080fd5b5035612545565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156108eb5781810151838201526020016108d3565b505050509050019250505060405180910390f35b34801561090b57600080fd5b506103ac6004803603604081101561092257600080fd5b50803590602001356001600160a01b031661267b565b34801561094457600080fd5b506103616004803603604081101561095b57600080fd5b506001600160a01b038135169060200135612a19565b34801561097d57600080fd5b506103616004803603602081101561099457600080fd5b50356001600160a01b0316612a5f565b3480156109b057600080fd5b50610361612a71565b3480156109c557600080fd5b5061031b612a77565b3480156109da57600080fd5b50610361612a86565b3480156109ef57600080fd5b506102ff60048036036020811015610a0657600080fd5b50356001600160a01b0316612a8c565b6103616004803603610160811015610a2d57600080fd5b810190602081018135600160201b811115610a4757600080fd5b820183602082011115610a5957600080fd5b803590602001918460208302840111600160201b83111715610a7a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b039081169350602083013592604081013592506060810135151591608082013581169160a08101359160c08201359160e081013591610100820135151591610120013516612b2d565b348015610b0d57600080fd5b506102ff60048036036020811015610b2457600080fd5b50351515612cdd565b348015610b3957600080fd5b506102ff60048036036040811015610b5057600080fd5b506001600160a01b038135169060200135612d6f565b348015610b7257600080fd5b506102ff60048036036020811015610b8957600080fd5b5035612e13565b348015610b9c57600080fd5b506108af60048036036020811015610bb357600080fd5b5035612e99565b348015610bc657600080fd5b5061036160048036036020811015610bdd57600080fd5b50356001600160a01b0316612fc7565b348015610bf957600080fd5b50610361612fd9565b348015610c0e57600080fd5b506102ff60048036036040811015610c2557600080fd5b50803590602001356001600160a01b0316612fdf565b348015610c4757600080fd5b506103616131b7565b348015610c5c57600080fd5b506102ff60048036036020811015610c7357600080fd5b50356001600160a01b03166131bd565b348015610c8f57600080fd5b5061036160048036036020811015610ca657600080fd5b50356001600160a01b031661325c565b348015610cc257600080fd5b5061036161326e565b348015610cd757600080fd5b506102ff60048036036020811015610cee57600080fd5b50356001600160a01b0316613274565b348015610d0a57600080fd5b506102ff60048036036060811015610d2157600080fd5b506001600160a01b038135811691602081013590911690604001356132e3565b348015610d4d57600080fd5b506102ff60048036036060811015610d6457600080fd5b810190602081018135600160201b811115610d7e57600080fd5b820183602082011115610d9057600080fd5b803590602001918460208302840111600160201b83111715610db157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e0057600080fd5b820183602082011115610e1257600080fd5b803590602001918460208302840111600160201b83111715610e3357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e8257600080fd5b820183602082011115610e9457600080fd5b803590602001918460208302840111600160201b83111715610eb557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506133b8945050505050565b348015610eff57600080fd5b506102ff60048036036040811015610f1657600080fd5b506001600160a01b03813581169160200135166135a5565b6103616004803603610140811015610f4557600080fd5b810190602081018135600160201b811115610f5f57600080fd5b820183602082011115610f7157600080fd5b803590602001918460208302840111600160201b83111715610f9257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b038335811694506020840135936040810135935060608101359250608081013515159160a08201359160c08101359160e082013591610100013516613687565b34801561101957600080fd5b5061102261386a565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561105457600080fd5b506102ff6004803603604081101561106b57600080fd5b50803590602001356001600160a01b031661387c565b34801561108d57600080fd5b5061031b613a54565b3480156110a257600080fd5b5061031b613a63565b3480156110b757600080fd5b50610361600480360360208110156110ce57600080fd5b50356001600160a01b0316613a72565b3480156110ea57600080fd5b506111086004803603602081101561110157600080fd5b5035613a84565b604080516001600160a01b039d8e1681529b8d1660208d01528b81019a909a5260608b019890985260808a019690965293151560a089015260c088019290925260e087015261010086015261012085015215156101408401529092166101608201529051908190036101800190f35b34801561118357600080fd5b5061031b613af8565b34801561119857600080fd5b506102ff600480360360208110156111af57600080fd5b5035613b07565b600a546001600160a01b031681565b601381815481106111d257fe5b600091825260209091200154905081565b60006002600054141561122b576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611238615bc2565b6000848152601d602090815260409182902082516101c08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156112b857602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161129a575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154828501526009850154610120850152600a850154610140850152600b90940154938416151561016084015290920482166101809091015281519192501661136c576001915050611676565b60006113878261014001518361016001518460000151613b8d565b90508061139957600092505050611676565b6000858152601d6020526040812080546001600160a01b0319168155906113c36001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031990811690915560068301829055600783018290556008830182905560098301829055600a8301829055600b9092018054909216909155825160208401518051611469929190849061144257fe5b60200260200101518560400151866060015187608001518860a00151308a60e00151613bf6565b9050801561151857600183602001515111156114d957600354602084015180516114c2926001600160a01b03169184916000906114a257fe5b60200260200101516001600160a01b03166140a39092919063ffffffff16565b6114d68360200151846101000151306140fa565b90505b826101800151156114f7576114f2818460c00151614185565b611518565b6115188360c00151828560200151600187602001515103815181106114a257fe5b61152783610120015186614185565b82600001516001600160a01b03167f21435c5b618d77ff3657140cd3318e2cffaebc5e0e1b7318f56a9ba4044c3ed284602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c610120015161159d8e61014001514361432d90919063ffffffff16565b6101608f01516115ae90429061432d565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b8381101561163e578181015183820152602001611626565b505050509050019c5050505050505050505050505060405180910390a261166e836101a00151876001600061436f565b600193505050505b600160005592915050565b600c6020526000908152604090205481565b61271081565b6001546001600160a01b031681565b60165481565b600b6020526000908152604090205481565b601d602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a16999798969760ff80881698610100988990048316989093918216929104168d565b60006002600054141561177b576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611788615c77565b6000848152601b602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561180857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116117ea575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e0840152600984015461010080850191909152600a850154610120850152600b909401549081161515610140840152929092048216610160909101528151919250166118b4576001915050611676565b60006118cf82610120015183610140015184600001516144a1565b9050806118e157600092505050611676565b6000858152601b6020526040812080546001600160a01b03191681559061190b6001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19169055600782018190556008820181905560098201819055600a820155600b0180546001600160a81b03191690556101608201511561198e5761198982606001518360000151614185565b6119ac565b6119ac8260000151836060015184602001516000815181106114a257fe5b6119bb82610100015185614185565b81600001516001600160a01b03167f35b638e650e2328786fb405bd69d2083dbedc018d086662e74b775b4f1dae4bf83602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a2b8c61012001514361432d90919063ffffffff16565b6101408d0151611a3c90429061432d565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b83811015611abd578181015183820152602001611aa5565b505050509050019b50505050505050505050505060405180910390a2611aec826101800151866000600161436f565b600192505050600160005592915050565b6002546001600160a01b03163314611b48576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60098190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bd0576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b611be36001600160a01b038316826144ae565b5050565b60175481565b600060026000541415611c35576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611c42615c77565b6000848152601b602090815260409182902082516101a08101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015611cc257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ca4575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e0840152600984015461010080850191909152600a850154610120850152600b90940154908116151561014084015292909204821661016090910152815191925016611d6e576001915050611676565b6000611d898261012001518361014001518460000151613b8d565b905080611d9b57600092505050611676565b6000858152601b6020526040812080546001600160a01b031916815590611dc56001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19169055600782018190556008820181905560098201819055600a820155600b0180546001600160a81b0319169055606082015115611ed657606082015160208301515160011015611e8157600354606084015160208501518051611e6b936001600160a01b03169291906000906114a257fe5b611e7e83602001518460800151306140fa565b90505b6000611ea5846000015185602001518487604001518860c001518960a00151614593565b60035460208601518051929350611ed3926001600160a01b039092169184919060001981019081106114a257fe5b50505b815160208301518051611f149291906000198101908110611ef357fe5b602002602001015184604001518560a001518660c001518760e00151614789565b611f2382610100015185614185565b81600001516001600160a01b03167f1be316b94d38c07bd41cdb4913772d0a0a82802786a2f8b657b6e85dbcdfc64183602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611f938c61012001514361432d90919063ffffffff16565b6101408d0151611fa490429061432d565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b8381101561202557818101518382015260200161200d565b505050509050019b50505050505050505050505060405180910390a2611aec8261018001518660018061436f565b60075481565b6002546001600160a01b031633146120a4576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60158290556016819055604080518381526020810183905281517febb0f666150f4be5b60c45df8f3e49992510b0128027fe58eea6110f296493bc929181900390910190a15050565b6002546001600160a01b03163314612138576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260196020908152604091829020805460ff1916851515908117909155825190815291517ffbabc02389290a451c6e600d05bf9887b99bfad39d8e1237e4e3df042e4941fe9281900390910190a25050565b60196020526000908152604090205460ff1681565b60105481565b6002546001600160a01b031633146121fe576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60078190556040805182815290517f4d371d598d3a13f99ce992a17975bbaf1e1c256e072ec7d2f93ce88e40d9ba1c9181900360200190a150565b60125460ff1681565b6006546001600160a01b031681565b6002546001600160a01b0316331461229c576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600f83905560108290556011819055604080518481526020810184905280820183905290517fb98e759701eaca2e60c25e91109003c1c7442ef731b5d569037063005da8254d9181900360600190a1505050565b601481815481106111d257fe5b6002546001600160a01b03163314612348576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60088190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b600f5481565b6000600260005414156123d1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015612413576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b8334101561244e576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b89516001148061245f575089516002145b612496576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b6006548a516001600160a01b03909116908b906000906124b257fe5b60200260200101516001600160a01b0316146124fe576040805162461bcd60e51b815260206004808301919091526024820152630e0c2e8d60e31b604482015290519081900360640190fd5b61250661485b565b61250f836148c7565b600061251b348661432d565b9050612531338c8c848d8d8d8d8d60018d61493b565b60016000559b9a5050505050505050505050565b606061254f615bc2565b6000838152601d602090815260409182902082516101c08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156125cf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116125b1575b505050918352505060028201546001600160a01b039081166020808401919091526003840154604084015260048401546060840152600584015460ff8082161515608086015261010091829004841660a0860152600686015460c0860152600786015460e08601526008860154828601526009860154610120860152600a860154610140860152600b909501549485161515610160850152909304166101809091015201519392505050565b6000600260005414156126c3576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b60026000556126d0615bc2565b6000848152601d602090815260409182902082516101c08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561275057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612732575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154828501526009850154610120850152600a850154610140850152600b909401549384161515610160840152909204821661018090910152815191925016612804576001915050611676565b600061281f82610140015183610160015184600001516144a1565b90508061283157600092505050611676565b6000858152601d6020526040812080546001600160a01b03191681559061285b6001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031990811690915560068301829055600783018290556008830182905560098301829055600a830191909155600b909101805490911690556101208201516128d39085614185565b81600001516001600160a01b03167f87abfd78e844f28318363bdf3da99eab2f4a2da9ff7ae365484507f7b6c3f80583602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001516129498d61014001514361432d90919063ffffffff16565b6101608e015161295a90429061432d565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b838110156129ea5781810151838201526020016129d2565b505050509050019c5050505050505050505050505060405180910390a2611aec826101a001518660008061436f565b6000828260405160200180836001600160a01b031660601b8152601401828152602001925050506040516020818303038152906040528051906020012090505b92915050565b601a6020526000908152604090205481565b600e5481565b6004546001600160a01b031681565b60085481565b6001546001600160a01b03163314612ad9576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b600060026000541415612b75576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015612bb7576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b833414612bf1576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b8b5160011480612c0257508b516002145b612c39576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b8215612cac576006548c516001600160a01b03909116908d906000198101908110612c6057fe5b60200260200101516001600160a01b031614612cac576040805162461bcd60e51b815260206004808301919091526024820152630e0c2e8d60e31b604482015290519081900360640190fd5b612cb461485b565b612cc8338d8d8d8d8d8d8d8d8d8d8d614ad2565b60016000559c9b505050505050505050505050565b6002546001600160a01b03163314612d28576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6012805482151560ff19909116811790915560408051918252517f4eb87a5935d402aa24c01b45bfb30adefcd2328b480f2d967864de4b64ea929f9181900360200190a150565b6002546001600160a01b03163314612dba576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000818152601860209081526040918290208490558151928352820183905280517f0a585bcfd5f265014b902e5350c05f3a465468d433f13009dcf83f17dc1316be9281900390910190a15050565b6002546001600160a01b03163314612e5e576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60178190556040805182815290517f22bd2c9f980325d046be74aaef5fc76df4a2bc3fbc7c5a1200fcc79fe80dab6c9181900360200190a150565b6060612ea3615c77565b6000838152601b602090815260409182902082516101a08101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015612f2357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612f05575b505050918352505060028201546001600160a01b03908116602080840191909152600384015460408401526004840154606084015260058401546080840152600684015460ff908116151560a0850152600785015460c0850152600885015460e0850152600985015461010080860191909152600a860154610120860152600b90950154908116151561014085015293909304166101609091015201519392505050565b600d6020526000908152604090205481565b60095481565b3360009081526019602052604090205460ff16613029576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b60155460135480821061303d575050611be3565b80841115613049578093505b838210156131af5760006013838154811061306057fe5b90600052602060002001549050306001600160a01b03166327b42c0f82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b1580156130c457600080fd5b505af19250505080156130e957506040513d60208110156130e457600080fd5b505160015b61317d576040805163225fc9fd60e01b8152600481018390526001600160a01b03861660248201529051309163225fc9fd9160448083019260209291908290030181600087803b15801561313c57600080fd5b505af192505050801561316157506040513d602081101561315c57600080fd5b505160015b61316a57613178565b806131765750506131af565b505b61318b565b806131895750506131af565b505b6013838154811061319857fe5b600091825260208220015550600190910190613049565b506015555050565b60155481565b6002546001600160a01b03163314613208576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600a80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b60186020526000908152604090205481565b60115481565b6001546001600160a01b031633146132c1576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314613330576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561338757600080fd5b505af115801561339b573d6000803e3d6000fd5b505050506040513d60208110156133b157600080fd5b5050505050565b6002546001600160a01b03163314613403576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60005b835181101561349e57600084828151811061341d57fe5b6020026020010151905083828151811061343357fe5b6020026020010151600c6000836001600160a01b03166001600160a01b031681526020019081526020016000208190555082828151811061347057fe5b6020908102919091018101516001600160a01b039092166000908152600d9091526040902055600101613406565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561350b5781810151838201526020016134f3565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561354a578181015183820152602001613532565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015613589578181015183820152602001613571565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b031633146135f0576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054806136145750611be3565b6001600160a01b0383166000818152600b60205260408120556136389083836140a3565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b6000600260005414156136cf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015613711576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b83341461374b576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b8a516001148061375c57508a516002145b613793576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b61379b61485b565b6137a4836148c7565b8815613856576005548b516001600160a01b0390911690631b827878908d906000906137cc57fe5b602002602001015133308d6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561383d57600080fd5b505af1158015613851573d6000803e3d6000fd5b505050505b612531338c8c8c8c8c8c8c8c60008c61493b565b60155460135460165460145490919293565b3360009081526019602052604090205460ff166138c6576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b6016546014548082106138da575050611be3565b808411156138e6578093505b83821015613a4c576000601483815481106138fd57fe5b90600052602060002001549050306001600160a01b0316630d4d003d82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b15801561396157600080fd5b505af192505050801561398657506040513d602081101561398157600080fd5b505160015b613a1a5760408051633051b17160e11b8152600481018390526001600160a01b0386166024820152905130916360a362e29160448083019260209291908290030181600087803b1580156139d957600080fd5b505af19250505080156139fe57506040513d60208110156139f957600080fd5b505160015b613a0757613a15565b80613a13575050613a4c565b505b613a28565b80613a26575050613a4c565b505b60148381548110613a3557fe5b6000918252602082200155506001909101906138e6565b506016555050565b6002546001600160a01b031681565b6005546001600160a01b031681565b601c6020526000908152604090205481565b601b602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a169997989697959660ff958616969495939492939092908216916101009004168c565b6003546001600160a01b031681565b6002546001600160a01b03163314613b52576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8190556040805182815290517f52a8358457e20bbb36e4086b83fb0749599f1893fe4c35a876c46dc4886d12db9181900360200190a150565b600042613ba560115485614cac90919063ffffffff16565b11613be1576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b613bec848484614d04565b90505b9392505050565b6003546000906001600160a01b03168185613c8957816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613c5857600080fd5b505afa158015613c6c573d6000803e3d6000fd5b505050506040513d6020811015613c8257600080fd5b5051613d03565b816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613cd657600080fd5b505afa158015613cea573d6000803e3d6000fd5b505050506040513d6020811015613d0057600080fd5b50515b90508515613d595783811015613d54576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203c20707269636560781b604482015290519081900360640190fd5b613da2565b83811115613da2576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203e20707269636560781b604482015290519081900360640190fd5b6000826001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015613ddd57600080fd5b505afa158015613df1573d6000803e3d6000fd5b505050506040513d6020811015613e0757600080fd5b81019080805190602001909291905050509050600460009054906101000a90046001600160a01b03166001600160a01b031663f3238cec8d8d8d8b8d8860006040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185151581526020018481526020018381526020018215158152602001975050505050505050600060405180830381600087803b158015613ec557600080fd5b505af1158015613ed9573d6000803e3d6000fd5b50505050806001600160a01b0316636d63c1d0846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015613f2c57600080fd5b505af1158015613f40573d6000803e3d6000fd5b505050506000600560009054906101000a90046001600160a01b03166001600160a01b0316632662166b8e8e8e8e8e8e8e6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b158015613ff757600080fd5b505af115801561400b573d6000803e3d6000fd5b505050506040513d602081101561402157600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03878116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561407157600080fd5b505af1158015614085573d6000803e3d6000fd5b505050506140938d8a614e35565b9c9b505050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526140f590849061502a565b505050565b60008351600214156141415761413a8460008151811061411657fe5b60200260200101518560018151811061412b57fe5b602002602001015185856150db565b9050613bef565b6040805162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60631b604482015290519081900360640190fd5b60065460408051632e1a7d4d60e01b81526004810185905290516001600160a01b03909216918291632e1a7d4d91602480830192600092919082900301818387803b1580156141d357600080fd5b505af11580156141e7573d6000803e3d6000fd5b5050600754604051600093506001600160a01b0386169250869084818181858888f193505050503d806000811461423a576040519150601f19603f3d011682016040523d82523d6000602084013e61423f565b606091505b505090508015614250575050611be3565b816001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561428b57600080fd5b505af115801561429f573d6000803e3d6000fd5b5050505050816001600160a01b031663a9059cbb84866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156142fb57600080fd5b505af115801561430f573d6000803e3d6000fd5b505050506040513d602081101561432557600080fd5b505050505050565b6000613bef83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506151c0565b6001600160a01b0384166143825761449b565b614394846001600160a01b0316615257565b61439d5761449b565b6017546001600160a01b038516600090815260186020526040902054818111156143c5578091505b816143d157505061449b565b6000866001600160a01b031663edf3daec848888886040518563ffffffff1660e01b815260040180848152602001831515815260200182151581526020019350505050600060405180830381600088803b15801561442e57600080fd5b5087f193505050508015614440575060015b6144495761444d565b5060015b604080516001600160a01b0389168152821515602082015280820185905290517fc9123a2a8e16684aa24686f2bf8a6d0eb0c601bdc109140c9729916865a58bc49181900360600190a15050505b50505050565b6000613bec848484614d04565b80471015614503576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d806000811461454e576040519150601f19603f3d011682016040523d82523d6000602084013e614553565b606091505b50509050806140f55760405162461bcd60e51b815260040180806020018281038252603a815260200180615dd8603a913960400191505060405180910390fd5b60008073__$4ebf70e2aa99c076c4a72b3e77f175d419$__63e0cab550600360009054906101000a90046001600160a01b03168a8a8a8a8a8a6009546040518963ffffffff1660e01b815260040180896001600160a01b03168152602001886001600160a01b0316815260200180602001878152602001866001600160a01b031681526020018515158152602001848152602001838152602001828103825288818151815260200191508051906020019060200280838360005b8381101561466557818101518382015260200161464d565b50505050905001995050505050505050505060206040518083038186803b15801561468f57600080fd5b505af41580156146a3573d6000803e3d6000fd5b505050506040513d60208110156146b957600080fd5b50519050801561477a5760006146f26127106146ec6146e560085461271061432d90919063ffffffff16565b8a9061525d565b906152b6565b90506000614700888361432d565b905060008960018b51038151811061471457fe5b6020026020010151905061475682600b6000846001600160a01b03166001600160a01b0316815260200190815260200160002054614cac90919063ffffffff16565b6001600160a01b039091166000908152600b602052604090205550915061477f9050565b859150505b9695505050505050565b6147948483856152f5565b60035460055460048054604080516317c3cf0f60e31b81526001600160a01b03958616938101939093529284166024830152831660448201528883166064820152878316608482015291861660a483015260c4820185905283151560e483015261010482018390525173__$4ebf70e2aa99c076c4a72b3e77f175d419$__9163be1e787891610124808301926000929190829003018186803b15801561483957600080fd5b505af415801561484d573d6000803e3d6000fd5b5050505061432586846154be565b34156148c557600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156148b157600080fd5b505af11580156133b1573d6000803e3d6000fd5b565b80158015906148e05750600a546001600160a01b031615155b1561493857600a54604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b1580156148b157600080fd5b50565b6000614945615c77565b604051806101a001604052808e6001600160a01b031681526020018d81526020018c6001600160a01b031681526020018b81526020018a815260200189815260200188151581526020018781526020018681526020014381526020014281526020018515158152602001846001600160a01b031681525090506000806149ca83615645565b915091508e6001600160a01b03167f5265bc4952da402633b3fc35f67ab4245493a0ab94dd8ab123667c8d45a4485c8f8f8f8f8f8f8f8f8b60016013805490500343423a60405180806020018e6001600160a01b031681526020018d81526020018c81526020018b81526020018a1515815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528f818151815260200191508051906020019060200280838360005b83811015614aa1578181015183820152602001614a89565b505050509050019e50505050505050505050505050505060405180910390a29e9d5050505050505050505050505050565b6000614adc615bc2565b604051806101c001604052808f6001600160a01b031681526020018e81526020018d6001600160a01b031681526020018c81526020018b81526020018a15158152602001896001600160a01b031681526020018881526020018781526020018681526020014381526020014281526020018515158152602001846001600160a01b03168152509050600080614b70836157e3565b9150915082600001516001600160a01b03167f81ed0476a7e785a9e4728fffd679ea97176ca1ac85e1003462558bb5677da57b84602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001518c600160148054905003434260405180806020018e6001600160a01b031681526020018d81526020018c81526020018b151581526020018a6001600160a01b0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528f818151815260200191508051906020019060200280838360005b83811015614c7a578181015183820152602001614c62565b505050509050019e50505050505050505050505050505060405180910390a29f9e505050505050505050505050505050565b600082820183811015613bef576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60008033301480614d2457503360009081526019602052604090205460ff165b60125490915060ff16158015614d38575080155b15614d70576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b8015614d965743614d8c600f5487614cac90919063ffffffff16565b1115915050613bef565b336001600160a01b03841614614dd9576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b42614def60105486614cac90919063ffffffff16565b1115614e2a576040805162461bcd60e51b815260206004820152600560248201526464656c617960d81b604482015290519081900360640190fd5b506001949350505050565b600a546001600160a01b031680614e4c5750611be3565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b158015614e9b57600080fd5b505afa158015614eaf573d6000803e3d6000fd5b505050506040513d6040811015614ec557600080fd5b508051602090910151909250905081614ee057505050611be3565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b158015614f2557600080fd5b505afa158015614f39573d6000803e3d6000fd5b505050506040513d6020811015614f4f57600080fd5b50516040805163318bc68960e01b815290519192507f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b791889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b158015614fbc57600080fd5b505af1158015614fd0573d6000803e3d6000fd5b505050506040513d6020811015614fe657600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201879052918516608082015290519081900360a00190a1505050505050565b606061507f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661598c9092919063ffffffff16565b8051909150156140f55780806020019051602081101561509e57600080fd5b50516140f55760405162461bcd60e51b815260040180806020018281038252602a815260200180615e59602a913960400191505060405180910390fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b15801561513b57600080fd5b505af115801561514f573d6000803e3d6000fd5b505050506040513d602081101561516557600080fd5b50519050838110156151b7576040805162461bcd60e51b81526020600482015260166024820152751a5b9cdd59999a58da595b9d08185b5bdd5b9d13dd5d60521b604482015290519081900360640190fd5b95945050505050565b6000818484111561524f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156152145781810151838201526020016151fc565b50505050905090810190601f1680156152415780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b60008261526c57506000612a59565b8282028284828161527957fe5b0414613bef5760405162461bcd60e51b8152600401808060200182810382526021815260200180615e386021913960400191505060405180910390fd5b6000613bef83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061599b565b806152ff576140f5565b81156153fd576001600160a01b0383166000908152600c602052604090205480158015906153b057506003546040805163783a2b6760e11b81526001600160a01b038781166004830152915184936153ae93879391169163f07456ce91602480820192602092909190829003018186803b15801561537c57600080fd5b505afa158015615390573d6000803e3d6000fd5b505050506040513d60208110156153a657600080fd5b505190614cac565b115b156153f7576040805162461bcd60e51b81526020600482015260126024820152711b585e081b1bdb99dcc8195e18d95959195960721b604482015290519081900360640190fd5b506140f5565b6001600160a01b0383166000908152600d6020526040902054801580159061547657506003546040805163114f1b5560e31b81526001600160a01b03878116600483015291518493615474938793911691638a78daa891602480820192602092909190829003018186803b15801561537c57600080fd5b115b1561449b576040805162461bcd60e51b81526020600482015260136024820152721b585e081cda1bdc9d1cc8195e18d959591959606a1b604482015290519081900360640190fd5b600a546001600160a01b0316806154d55750611be3565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b15801561552457600080fd5b505afa158015615538573d6000803e3d6000fd5b505050506040513d604081101561554e57600080fd5b50805160209091015190925090508161556957505050611be3565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b1580156155ae57600080fd5b505afa1580156155c2573d6000803e3d6000fd5b505050506040513d60208110156155d857600080fd5b50516040805163318bc68960e01b815290519192507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee91889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b158015614fbc57600080fd5b80516001600160a01b0381166000908152601a6020526040812054909182918290615671906001614cac565b6001600160a01b0383166000908152601a602052604081208290559091506156998383612a19565b6000818152601b60209081526040909120885181546001600160a01b0319166001600160a01b03909116178155888201518051939450899391926156e592600185019290910190615cfe565b5060408201516002820180546001600160a01b039283166001600160a01b0319909116179055606083015160038301556080830151600483015560a0830151600583015560c083015160068301805491151560ff1992831617905560e084015160078401556101008085015160088501556101208501516009850155610140850151600a850155610160850151600b90940180546101809096015190931602610100600160a81b0319931515949091169390931791909116919091179055601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09001819055909350915050915091565b80516001600160a01b0381166000908152601c602052604081205490918291829061580f906001614cac565b6001600160a01b0383166000908152601c602052604081208290559091506158378383612a19565b6000818152601d60209081526040909120885181546001600160a01b0319166001600160a01b039091161781558882015180519394508993919261588392600185019290910190615cfe565b5060408201516002820180546001600160a01b039283166001600160a01b0319909116179055606083015160038301556080830151600483015560a083015160058301805460c08601518416610100908102610100600160a81b031994151560ff199384161785161790925560e0860151600686015581860151600786015561012086015160088601556101408601516009860155610160860151600a860155610180860151600b90950180546101a090970151909416909102931515941693909317909216179055601480546001810182556000919091527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec01819055909350915050915091565b6060613bec8484600085615a00565b600081836159ea5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156152145781810151838201526020016151fc565b5060008385816159f657fe5b0495945050505050565b606082471015615a415760405162461bcd60e51b8152600401808060200182810382526026815260200180615e126026913960400191505060405180910390fd5b615a4a85615257565b615a9b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310615ada5780518252601f199092019160209182019101615abb565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615b3c576040519150601f19603f3d011682016040523d82523d6000602084013e615b41565b606091505b5091509150615b51828286615b5c565b979650505050505050565b60608315615b6b575081613bef565b825115615b7b5782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156152145781810151838201526020016151fc565b604051806101c0016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b50805460008255906000526020600020908101906149389190615d63565b604051806101a0016040528060006001600160a01b031681526020016060815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000151581526020016000815260200160008152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b828054828255906000526020600020908101928215615d53579160200282015b82811115615d5357825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615d1e565b50615d5f929150615d78565b5090565b5b80821115615d5f5760008155600101615d64565b5b80821115615d5f5780546001600160a01b0319168155600101615d7956fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220265e969fb5b1c0954ad938acb31a72de91c47bbaba7cb78d40059516ad56eea664736f6c634300060c0033", + "deployedBytecode": "0x6080604052600436106102aa5760003560e01c80626cc35e1461030657806304225954146103375780630d4d003d146103735780631045c74e146103c0578063126082cf146103f357806312d43a51146104085780631bca8cf01461041d5780631ce9cb8f146104325780631f28510614610465578063225fc9fd14610507578063233bfe3b1461054057806324a084df1461056a57806324f74697146105a357806327b42c0f146105b85780632d79cf42146105f1578063308aa81f146106065780633422ead11461063657806336eba48a146106715780633a2a80c7146106a45780633a9b52ad146106b95780633e72a262146106e35780633fc8cef3146106f85780634067b1321461070d5780634278555f14610743578063490ae2101461076d5780635841fcaa146107975780635b88e8c6146107ac5780635d5c22e81461088557806360a362e2146108ff57806362f8a3fe14610938578063633451de1461097157806363ae2103146109a4578063657bc5d0146109b957806367a52793146109ce578063704b6c02146109e35780637be7d14114610a165780637c2eb9f714610b01578063804fc70214610b2d5780638a54942f14610b6657806395e9bbd714610b905780639698d25a14610bba57806398d1e03a14610bed5780639a20810014610c025780639b57862014610c3b578063ae4d7f9a14610c50578063c4f38e3314610c83578063cb0269c914610cb6578063cfad57a214610ccb578063e1f21c6714610cfe578063ef12c67e14610d41578063f255527814610ef3578063f2ae372f14610f2e578063f2cea6a51461100d578063f3883d8b14611048578063f851a44014611081578063f887ea4014611096578063fa444577146110ab578063faf990f3146110de578063fbfa77cf14611177578063fc2cee621461118c57610301565b36610301576006546001600160a01b031633146102ff576040805162461bcd60e51b815260206004820152600e60248201526d34b73b30b634b21039b2b73232b960911b604482015290519081900360640190fd5b005b600080fd5b34801561031257600080fd5b5061031b6111b6565b604080516001600160a01b039092168252519081900360200190f35b34801561034357600080fd5b506103616004803603602081101561035a57600080fd5b50356111c5565b60408051918252519081900360200190f35b34801561037f57600080fd5b506103ac6004803603604081101561039657600080fd5b50803590602001356001600160a01b03166111e3565b604080519115158252519081900360200190f35b3480156103cc57600080fd5b50610361600480360360208110156103e357600080fd5b50356001600160a01b0316611681565b3480156103ff57600080fd5b50610361611693565b34801561041457600080fd5b5061031b611699565b34801561042957600080fd5b506103616116a8565b34801561043e57600080fd5b506103616004803603602081101561045557600080fd5b50356001600160a01b03166116ae565b34801561047157600080fd5b5061048f6004803603602081101561048857600080fd5b50356116c0565b604080516001600160a01b039e8f1681529c8e1660208e01528c81019b909b5260608c019990995296151560808b0152948a1660a08a015260c089019390935260e088019190915261010087015261012086015261014085015215156101608401529092166101808201529051908190036101a00190f35b34801561051357600080fd5b506103ac6004803603604081101561052a57600080fd5b50803590602001356001600160a01b0316611733565b34801561054c57600080fd5b506102ff6004803603602081101561056357600080fd5b5035611afd565b34801561057657600080fd5b506102ff6004803603604081101561058d57600080fd5b506001600160a01b038135169060200135611b83565b3480156105af57600080fd5b50610361611be7565b3480156105c457600080fd5b506103ac600480360360408110156105db57600080fd5b50803590602001356001600160a01b0316611bed565b3480156105fd57600080fd5b50610361612053565b34801561061257600080fd5b506102ff6004803603604081101561062957600080fd5b5080359060200135612059565b34801561064257600080fd5b506102ff6004803603604081101561065957600080fd5b506001600160a01b03813516906020013515156120ed565b34801561067d57600080fd5b506103ac6004803603602081101561069457600080fd5b50356001600160a01b0316612198565b3480156106b057600080fd5b506103616121ad565b3480156106c557600080fd5b506102ff600480360360208110156106dc57600080fd5b50356121b3565b3480156106ef57600080fd5b506103ac612239565b34801561070457600080fd5b5061031b612242565b34801561071957600080fd5b506102ff6004803603606081101561073057600080fd5b5080359060208101359060400135612251565b34801561074f57600080fd5b506103616004803603602081101561076657600080fd5b50356122f0565b34801561077957600080fd5b506102ff6004803603602081101561079057600080fd5b50356122fd565b3480156107a357600080fd5b50610361612383565b61036160048036036101208110156107c357600080fd5b810190602081018135600160201b8111156107dd57600080fd5b8201836020820111156107ef57600080fd5b803590602001918460208302840111600160201b8311171561081057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b03908116935060208301359260408101359250606081013515159160808201359160a08101359160c08201359160e0013516612389565b34801561089157600080fd5b506108af600480360360208110156108a857600080fd5b5035612545565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156108eb5781810151838201526020016108d3565b505050509050019250505060405180910390f35b34801561090b57600080fd5b506103ac6004803603604081101561092257600080fd5b50803590602001356001600160a01b031661267b565b34801561094457600080fd5b506103616004803603604081101561095b57600080fd5b506001600160a01b038135169060200135612a19565b34801561097d57600080fd5b506103616004803603602081101561099457600080fd5b50356001600160a01b0316612a5f565b3480156109b057600080fd5b50610361612a71565b3480156109c557600080fd5b5061031b612a77565b3480156109da57600080fd5b50610361612a86565b3480156109ef57600080fd5b506102ff60048036036020811015610a0657600080fd5b50356001600160a01b0316612a8c565b6103616004803603610160811015610a2d57600080fd5b810190602081018135600160201b811115610a4757600080fd5b820183602082011115610a5957600080fd5b803590602001918460208302840111600160201b83111715610a7a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b039081169350602083013592604081013592506060810135151591608082013581169160a08101359160c08201359160e081013591610100820135151591610120013516612b2d565b348015610b0d57600080fd5b506102ff60048036036020811015610b2457600080fd5b50351515612cdd565b348015610b3957600080fd5b506102ff60048036036040811015610b5057600080fd5b506001600160a01b038135169060200135612d6f565b348015610b7257600080fd5b506102ff60048036036020811015610b8957600080fd5b5035612e13565b348015610b9c57600080fd5b506108af60048036036020811015610bb357600080fd5b5035612e99565b348015610bc657600080fd5b5061036160048036036020811015610bdd57600080fd5b50356001600160a01b0316612fc7565b348015610bf957600080fd5b50610361612fd9565b348015610c0e57600080fd5b506102ff60048036036040811015610c2557600080fd5b50803590602001356001600160a01b0316612fdf565b348015610c4757600080fd5b506103616131b7565b348015610c5c57600080fd5b506102ff60048036036020811015610c7357600080fd5b50356001600160a01b03166131bd565b348015610c8f57600080fd5b5061036160048036036020811015610ca657600080fd5b50356001600160a01b031661325c565b348015610cc257600080fd5b5061036161326e565b348015610cd757600080fd5b506102ff60048036036020811015610cee57600080fd5b50356001600160a01b0316613274565b348015610d0a57600080fd5b506102ff60048036036060811015610d2157600080fd5b506001600160a01b038135811691602081013590911690604001356132e3565b348015610d4d57600080fd5b506102ff60048036036060811015610d6457600080fd5b810190602081018135600160201b811115610d7e57600080fd5b820183602082011115610d9057600080fd5b803590602001918460208302840111600160201b83111715610db157600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e0057600080fd5b820183602082011115610e1257600080fd5b803590602001918460208302840111600160201b83111715610e3357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610e8257600080fd5b820183602082011115610e9457600080fd5b803590602001918460208302840111600160201b83111715610eb557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506133b8945050505050565b348015610eff57600080fd5b506102ff60048036036040811015610f1657600080fd5b506001600160a01b03813581169160200135166135a5565b6103616004803603610140811015610f4557600080fd5b810190602081018135600160201b811115610f5f57600080fd5b820183602082011115610f7157600080fd5b803590602001918460208302840111600160201b83111715610f9257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b038335811694506020840135936040810135935060608101359250608081013515159160a08201359160c08101359160e082013591610100013516613687565b34801561101957600080fd5b5061102261386a565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561105457600080fd5b506102ff6004803603604081101561106b57600080fd5b50803590602001356001600160a01b031661387c565b34801561108d57600080fd5b5061031b613a54565b3480156110a257600080fd5b5061031b613a63565b3480156110b757600080fd5b50610361600480360360208110156110ce57600080fd5b50356001600160a01b0316613a72565b3480156110ea57600080fd5b506111086004803603602081101561110157600080fd5b5035613a84565b604080516001600160a01b039d8e1681529b8d1660208d01528b81019a909a5260608b019890985260808a019690965293151560a089015260c088019290925260e087015261010086015261012085015215156101408401529092166101608201529051908190036101800190f35b34801561118357600080fd5b5061031b613af8565b34801561119857600080fd5b506102ff600480360360208110156111af57600080fd5b5035613b07565b600a546001600160a01b031681565b601381815481106111d257fe5b600091825260209091200154905081565b60006002600054141561122b576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611238615bc2565b6000848152601d602090815260409182902082516101c08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156112b857602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161129a575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154828501526009850154610120850152600a850154610140850152600b90940154938416151561016084015290920482166101809091015281519192501661136c576001915050611676565b60006113878261014001518361016001518460000151613b8d565b90508061139957600092505050611676565b6000858152601d6020526040812080546001600160a01b0319168155906113c36001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031990811690915560068301829055600783018290556008830182905560098301829055600a8301829055600b9092018054909216909155825160208401518051611469929190849061144257fe5b60200260200101518560400151866060015187608001518860a00151308a60e00151613bf6565b9050801561151857600183602001515111156114d957600354602084015180516114c2926001600160a01b03169184916000906114a257fe5b60200260200101516001600160a01b03166140a39092919063ffffffff16565b6114d68360200151846101000151306140fa565b90505b826101800151156114f7576114f2818460c00151614185565b611518565b6115188360c00151828560200151600187602001515103815181106114a257fe5b61152783610120015186614185565b82600001516001600160a01b03167f21435c5b618d77ff3657140cd3318e2cffaebc5e0e1b7318f56a9ba4044c3ed284602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c610120015161159d8e61014001514361432d90919063ffffffff16565b6101608f01516115ae90429061432d565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b8381101561163e578181015183820152602001611626565b505050509050019c5050505050505050505050505060405180910390a261166e836101a00151876001600061436f565b600193505050505b600160005592915050565b600c6020526000908152604090205481565b61271081565b6001546001600160a01b031681565b60165481565b600b6020526000908152604090205481565b601d602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a16999798969760ff80881698610100988990048316989093918216929104168d565b60006002600054141561177b576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611788615c77565b6000848152601b602090815260409182902082516101a08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561180857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116117ea575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e0840152600984015461010080850191909152600a850154610120850152600b909401549081161515610140840152929092048216610160909101528151919250166118b4576001915050611676565b60006118cf82610120015183610140015184600001516144a1565b9050806118e157600092505050611676565b6000858152601b6020526040812080546001600160a01b03191681559061190b6001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19169055600782018190556008820181905560098201819055600a820155600b0180546001600160a81b03191690556101608201511561198e5761198982606001518360000151614185565b6119ac565b6119ac8260000151836060015184602001516000815181106114a257fe5b6119bb82610100015185614185565b81600001516001600160a01b03167f35b638e650e2328786fb405bd69d2083dbedc018d086662e74b775b4f1dae4bf83602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611a2b8c61012001514361432d90919063ffffffff16565b6101408d0151611a3c90429061432d565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b83811015611abd578181015183820152602001611aa5565b505050509050019b50505050505050505050505060405180910390a2611aec826101800151866000600161436f565b600192505050600160005592915050565b6002546001600160a01b03163314611b48576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60098190556040805182815290517f21167d0d4661af93817ebce920f18986eed3d75d5e1c03f2aed05efcbafbc4529181900360200190a150565b6001546001600160a01b03163314611bd0576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b611be36001600160a01b038316826144ae565b5050565b60175481565b600060026000541415611c35576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055611c42615c77565b6000848152601b602090815260409182902082516101a08101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015611cc257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611ca4575b505050918352505060028201546001600160a01b039081166020830152600383015460408301526004830154606083015260058301546080830152600683015460ff908116151560a0840152600784015460c0840152600884015460e0840152600984015461010080850191909152600a850154610120850152600b90940154908116151561014084015292909204821661016090910152815191925016611d6e576001915050611676565b6000611d898261012001518361014001518460000151613b8d565b905080611d9b57600092505050611676565b6000858152601b6020526040812080546001600160a01b031916815590611dc56001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820181905560068201805460ff19169055600782018190556008820181905560098201819055600a820155600b0180546001600160a81b0319169055606082015115611ed657606082015160208301515160011015611e8157600354606084015160208501518051611e6b936001600160a01b03169291906000906114a257fe5b611e7e83602001518460800151306140fa565b90505b6000611ea5846000015185602001518487604001518860c001518960a00151614593565b60035460208601518051929350611ed3926001600160a01b039092169184919060001981019081106114a257fe5b50505b815160208301518051611f149291906000198101908110611ef357fe5b602002602001015184604001518560a001518660c001518760e00151614789565b611f2382610100015185614185565b81600001516001600160a01b03167f1be316b94d38c07bd41cdb4913772d0a0a82802786a2f8b657b6e85dbcdfc64183602001518460400151856060015186608001518760a001518860c001518960e001518a6101000151611f938c61012001514361432d90919063ffffffff16565b6101408d0151611fa490429061432d565b60405180806020018b6001600160a01b031681526020018a8152602001898152602001888152602001871515815260200186815260200185815260200184815260200183815260200182810382528c818151815260200191508051906020019060200280838360005b8381101561202557818101518382015260200161200d565b505050509050019b50505050505050505050505060405180910390a2611aec8261018001518660018061436f565b60075481565b6002546001600160a01b031633146120a4576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60158290556016819055604080518381526020810183905281517febb0f666150f4be5b60c45df8f3e49992510b0128027fe58eea6110f296493bc929181900390910190a15050565b6002546001600160a01b03163314612138576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b038216600081815260196020908152604091829020805460ff1916851515908117909155825190815291517ffbabc02389290a451c6e600d05bf9887b99bfad39d8e1237e4e3df042e4941fe9281900390910190a25050565b60196020526000908152604090205460ff1681565b60105481565b6002546001600160a01b031633146121fe576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60078190556040805182815290517f4d371d598d3a13f99ce992a17975bbaf1e1c256e072ec7d2f93ce88e40d9ba1c9181900360200190a150565b60125460ff1681565b6006546001600160a01b031681565b6002546001600160a01b0316331461229c576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600f83905560108290556011819055604080518481526020810184905280820183905290517fb98e759701eaca2e60c25e91109003c1c7442ef731b5d569037063005da8254d9181900360600190a1505050565b601481815481106111d257fe5b6002546001600160a01b03163314612348576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60088190556040805182815290517f974fd3c1fcb4653dfc4fb740c4c692cd212d55c28f163f310128cb64d83006759181900360200190a150565b600f5481565b6000600260005414156123d1576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015612413576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b8334101561244e576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b89516001148061245f575089516002145b612496576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b6006548a516001600160a01b03909116908b906000906124b257fe5b60200260200101516001600160a01b0316146124fe576040805162461bcd60e51b815260206004808301919091526024820152630e0c2e8d60e31b604482015290519081900360640190fd5b61250661485b565b61250f836148c7565b600061251b348661432d565b9050612531338c8c848d8d8d8d8d60018d61493b565b60016000559b9a5050505050505050505050565b606061254f615bc2565b6000838152601d602090815260409182902082516101c08101845281546001600160a01b03168152600182018054855181860281018601909652808652919492938581019392908301828280156125cf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116125b1575b505050918352505060028201546001600160a01b039081166020808401919091526003840154604084015260048401546060840152600584015460ff8082161515608086015261010091829004841660a0860152600686015460c0860152600786015460e08601526008860154828601526009860154610120860152600a860154610140860152600b909501549485161515610160850152909304166101809091015201519392505050565b6000600260005414156126c3576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b60026000556126d0615bc2565b6000848152601d602090815260409182902082516101c08101845281546001600160a01b031681526001820180548551818602810186019096528086529194929385810193929083018282801561275057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612732575b505050918352505060028201546001600160a01b0390811660208301526003830154604083015260048301546060830152600583015460ff8082161515608085015261010091829004831660a0850152600685015460c0850152600785015460e08501526008850154828501526009850154610120850152600a850154610140850152600b909401549384161515610160840152909204821661018090910152815191925016612804576001915050611676565b600061281f82610140015183610160015184600001516144a1565b90508061283157600092505050611676565b6000858152601d6020526040812080546001600160a01b03191681559061285b6001830182615c59565b506002810180546001600160a01b0319169055600060038201819055600482018190556005820180546001600160a81b031990811690915560068301829055600783018290556008830182905560098301829055600a830191909155600b909101805490911690556101208201516128d39085614185565b81600001516001600160a01b03167f87abfd78e844f28318363bdf3da99eab2f4a2da9ff7ae365484507f7b6c3f80583602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001516129498d61014001514361432d90919063ffffffff16565b6101608e015161295a90429061432d565b60405180806020018c6001600160a01b031681526020018b81526020018a81526020018915158152602001886001600160a01b0316815260200187815260200186815260200185815260200184815260200183815260200182810382528d818151815260200191508051906020019060200280838360005b838110156129ea5781810151838201526020016129d2565b505050509050019c5050505050505050505050505060405180910390a2611aec826101a001518660008061436f565b6000828260405160200180836001600160a01b031660601b8152601401828152602001925050506040516020818303038152906040528051906020012090505b92915050565b601a6020526000908152604090205481565b600e5481565b6004546001600160a01b031681565b60085481565b6001546001600160a01b03163314612ad9576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b600280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f5a272403b402d892977df56625f4164ccaf70ca3863991c43ecfe76a6905b0a19181900360200190a150565b600060026000541415612b75576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015612bb7576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b833414612bf1576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b8b5160011480612c0257508b516002145b612c39576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b8215612cac576006548c516001600160a01b03909116908d906000198101908110612c6057fe5b60200260200101516001600160a01b031614612cac576040805162461bcd60e51b815260206004808301919091526024820152630e0c2e8d60e31b604482015290519081900360640190fd5b612cb461485b565b612cc8338d8d8d8d8d8d8d8d8d8d8d614ad2565b60016000559c9b505050505050505050505050565b6002546001600160a01b03163314612d28576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6012805482151560ff19909116811790915560408051918252517f4eb87a5935d402aa24c01b45bfb30adefcd2328b480f2d967864de4b64ea929f9181900360200190a150565b6002546001600160a01b03163314612dba576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000818152601860209081526040918290208490558151928352820183905280517f0a585bcfd5f265014b902e5350c05f3a465468d433f13009dcf83f17dc1316be9281900390910190a15050565b6002546001600160a01b03163314612e5e576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60178190556040805182815290517f22bd2c9f980325d046be74aaef5fc76df4a2bc3fbc7c5a1200fcc79fe80dab6c9181900360200190a150565b6060612ea3615c77565b6000838152601b602090815260409182902082516101a08101845281546001600160a01b0316815260018201805485518186028101860190965280865291949293858101939290830182828015612f2357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612f05575b505050918352505060028201546001600160a01b03908116602080840191909152600384015460408401526004840154606084015260058401546080840152600684015460ff908116151560a0850152600785015460c0850152600885015460e0850152600985015461010080860191909152600a860154610120860152600b90950154908116151561014085015293909304166101609091015201519392505050565b600d6020526000908152604090205481565b60095481565b3360009081526019602052604090205460ff16613029576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b60155460135480821061303d575050611be3565b80841115613049578093505b838210156131af5760006013838154811061306057fe5b90600052602060002001549050306001600160a01b03166327b42c0f82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b1580156130c457600080fd5b505af19250505080156130e957506040513d60208110156130e457600080fd5b505160015b61317d576040805163225fc9fd60e01b8152600481018390526001600160a01b03861660248201529051309163225fc9fd9160448083019260209291908290030181600087803b15801561313c57600080fd5b505af192505050801561316157506040513d602081101561315c57600080fd5b505160015b61316a57613178565b806131765750506131af565b505b61318b565b806131895750506131af565b505b6013838154811061319857fe5b600091825260208220015550600190910190613049565b506015555050565b60155481565b6002546001600160a01b03163314613208576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600a80546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f828abcccea18192c21d645e575652c49e20b986dab777906fc473d056b01b6a89181900360200190a150565b60186020526000908152604090205481565b60115481565b6001546001600160a01b031633146132c1576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314613330576040805162461bcd60e51b81526020600482015260156024820152600080516020615db8833981519152604482015290519081900360640190fd5b826001600160a01b031663095ea7b383836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561338757600080fd5b505af115801561339b573d6000803e3d6000fd5b505050506040513d60208110156133b157600080fd5b5050505050565b6002546001600160a01b03163314613403576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b60005b835181101561349e57600084828151811061341d57fe5b6020026020010151905083828151811061343357fe5b6020026020010151600c6000836001600160a01b03166001600160a01b031681526020019081526020016000208190555082828151811061347057fe5b6020908102919091018101516001600160a01b039092166000908152600d9091526040902055600101613406565b507fae32d569b058895b9620d6552b09aaffedc9a6f396be4d595a224ad09f8b213983838360405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561350b5781810151838201526020016134f3565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561354a578181015183820152602001613532565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015613589578181015183820152602001613571565b50505050905001965050505050505060405180910390a1505050565b6002546001600160a01b031633146135f0576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054806136145750611be3565b6001600160a01b0383166000818152600b60205260408120556136389083836140a3565b604080516001600160a01b0380861682528416602082015280820183905290517f4f1b51dd7a2fcb861aa2670f668be66835c4ee12b4bbbf037e4d0018f39819e49181900360600190a1505050565b6000600260005414156136cf576040805162461bcd60e51b815260206004820152601f6024820152600080516020615d98833981519152604482015290519081900360640190fd5b6002600055600e54841015613711576040805162461bcd60e51b815260206004820152600360248201526266656560e81b604482015290519081900360640190fd5b83341461374b576040805162461bcd60e51b81526020600482015260036024820152621d985b60ea1b604482015290519081900360640190fd5b8a516001148061375c57508a516002145b613793576040805162461bcd60e51b81526020600482015260036024820152623632b760e91b604482015290519081900360640190fd5b61379b61485b565b6137a4836148c7565b8815613856576005548b516001600160a01b0390911690631b827878908d906000906137cc57fe5b602002602001015133308d6040518563ffffffff1660e01b815260040180856001600160a01b03168152602001846001600160a01b03168152602001836001600160a01b03168152602001828152602001945050505050600060405180830381600087803b15801561383d57600080fd5b505af1158015613851573d6000803e3d6000fd5b505050505b612531338c8c8c8c8c8c8c8c60008c61493b565b60155460135460165460145490919293565b3360009081526019602052604090205460ff166138c6576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b6016546014548082106138da575050611be3565b808411156138e6578093505b83821015613a4c576000601483815481106138fd57fe5b90600052602060002001549050306001600160a01b0316630d4d003d82866040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b15801561396157600080fd5b505af192505050801561398657506040513d602081101561398157600080fd5b505160015b613a1a5760408051633051b17160e11b8152600481018390526001600160a01b0386166024820152905130916360a362e29160448083019260209291908290030181600087803b1580156139d957600080fd5b505af19250505080156139fe57506040513d60208110156139f957600080fd5b505160015b613a0757613a15565b80613a13575050613a4c565b505b613a28565b80613a26575050613a4c565b505b60148381548110613a3557fe5b6000918252602082200155506001909101906138e6565b506016555050565b6002546001600160a01b031681565b6005546001600160a01b031681565b601c6020526000908152604090205481565b601b602052600090815260409020805460028201546003830154600484015460058501546006860154600787015460088801546009890154600a8a0154600b909a01546001600160a01b03998a169a988a169997989697959660ff958616969495939492939092908216916101009004168c565b6003546001600160a01b031681565b6002546001600160a01b03163314613b52576040805162461bcd60e51b81526020600482015260096024820152683337b93134b23232b760b91b604482015290519081900360640190fd5b600e8190556040805182815290517f52a8358457e20bbb36e4086b83fb0749599f1893fe4c35a876c46dc4886d12db9181900360200190a150565b600042613ba560115485614cac90919063ffffffff16565b11613be1576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b613bec848484614d04565b90505b9392505050565b6003546000906001600160a01b03168185613c8957816001600160a01b031663e124e6d28a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613c5857600080fd5b505afa158015613c6c573d6000803e3d6000fd5b505050506040513d6020811015613c8257600080fd5b5051613d03565b816001600160a01b03166381a612d68a6040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613cd657600080fd5b505afa158015613cea573d6000803e3d6000fd5b505050506040513d6020811015613d0057600080fd5b50515b90508515613d595783811015613d54576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203c20707269636560781b604482015290519081900360640190fd5b613da2565b83811115613da2576040805162461bcd60e51b81526020600482015260116024820152706d61726b5072696365203e20707269636560781b604482015290519081900360640190fd5b6000826001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015613ddd57600080fd5b505afa158015613df1573d6000803e3d6000fd5b505050506040513d6020811015613e0757600080fd5b81019080805190602001909291905050509050600460009054906101000a90046001600160a01b03166001600160a01b031663f3238cec8d8d8d8b8d8860006040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b0316815260200185151581526020018481526020018381526020018215158152602001975050505050505050600060405180830381600087803b158015613ec557600080fd5b505af1158015613ed9573d6000803e3d6000fd5b50505050806001600160a01b0316636d63c1d0846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015613f2c57600080fd5b505af1158015613f40573d6000803e3d6000fd5b505050506000600560009054906101000a90046001600160a01b03166001600160a01b0316632662166b8e8e8e8e8e8e8e6040518863ffffffff1660e01b815260040180886001600160a01b03168152602001876001600160a01b03168152602001866001600160a01b031681526020018581526020018481526020018315158152602001826001600160a01b03168152602001975050505050505050602060405180830381600087803b158015613ff757600080fd5b505af115801561400b573d6000803e3d6000fd5b505050506040513d602081101561402157600080fd5b50516040805163d3c87bbb60e01b81526001600160a01b03878116600483015291519293509084169163d3c87bbb9160248082019260009290919082900301818387803b15801561407157600080fd5b505af1158015614085573d6000803e3d6000fd5b505050506140938d8a614e35565b9c9b505050505050505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526140f590849061502a565b505050565b60008351600214156141415761413a8460008151811061411657fe5b60200260200101518560018151811061412b57fe5b602002602001015185856150db565b9050613bef565b6040805162461bcd60e51b81526020600482015260146024820152730d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60631b604482015290519081900360640190fd5b60065460408051632e1a7d4d60e01b81526004810185905290516001600160a01b03909216918291632e1a7d4d91602480830192600092919082900301818387803b1580156141d357600080fd5b505af11580156141e7573d6000803e3d6000fd5b5050600754604051600093506001600160a01b0386169250869084818181858888f193505050503d806000811461423a576040519150601f19603f3d011682016040523d82523d6000602084013e61423f565b606091505b505090508015614250575050611be3565b816001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561428b57600080fd5b505af115801561429f573d6000803e3d6000fd5b5050505050816001600160a01b031663a9059cbb84866040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156142fb57600080fd5b505af115801561430f573d6000803e3d6000fd5b505050506040513d602081101561432557600080fd5b505050505050565b6000613bef83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506151c0565b6001600160a01b0384166143825761449b565b614394846001600160a01b0316615257565b61439d5761449b565b6017546001600160a01b038516600090815260186020526040902054818111156143c5578091505b816143d157505061449b565b6000866001600160a01b031663edf3daec848888886040518563ffffffff1660e01b815260040180848152602001831515815260200182151581526020019350505050600060405180830381600088803b15801561442e57600080fd5b5087f193505050508015614440575060015b6144495761444d565b5060015b604080516001600160a01b0389168152821515602082015280820185905290517fc9123a2a8e16684aa24686f2bf8a6d0eb0c601bdc109140c9729916865a58bc49181900360600190a15050505b50505050565b6000613bec848484614d04565b80471015614503576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d806000811461454e576040519150601f19603f3d011682016040523d82523d6000602084013e614553565b606091505b50509050806140f55760405162461bcd60e51b815260040180806020018281038252603a815260200180615dd8603a913960400191505060405180910390fd5b60008073__$4ebf70e2aa99c076c4a72b3e77f175d419$__63e0cab550600360009054906101000a90046001600160a01b03168a8a8a8a8a8a6009546040518963ffffffff1660e01b815260040180896001600160a01b03168152602001886001600160a01b0316815260200180602001878152602001866001600160a01b031681526020018515158152602001848152602001838152602001828103825288818151815260200191508051906020019060200280838360005b8381101561466557818101518382015260200161464d565b50505050905001995050505050505050505060206040518083038186803b15801561468f57600080fd5b505af41580156146a3573d6000803e3d6000fd5b505050506040513d60208110156146b957600080fd5b50519050801561477a5760006146f26127106146ec6146e560085461271061432d90919063ffffffff16565b8a9061525d565b906152b6565b90506000614700888361432d565b905060008960018b51038151811061471457fe5b6020026020010151905061475682600b6000846001600160a01b03166001600160a01b0316815260200190815260200160002054614cac90919063ffffffff16565b6001600160a01b039091166000908152600b602052604090205550915061477f9050565b859150505b9695505050505050565b6147948483856152f5565b60035460055460048054604080516317c3cf0f60e31b81526001600160a01b03958616938101939093529284166024830152831660448201528883166064820152878316608482015291861660a483015260c4820185905283151560e483015261010482018390525173__$4ebf70e2aa99c076c4a72b3e77f175d419$__9163be1e787891610124808301926000929190829003018186803b15801561483957600080fd5b505af415801561484d573d6000803e3d6000fd5b5050505061432586846154be565b34156148c557600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156148b157600080fd5b505af11580156133b1573d6000803e3d6000fd5b565b80158015906148e05750600a546001600160a01b031615155b1561493857600a54604080516356b4b2ad60e01b81523360048201526024810184905290516001600160a01b03909216916356b4b2ad9160448082019260009290919082900301818387803b1580156148b157600080fd5b50565b6000614945615c77565b604051806101a001604052808e6001600160a01b031681526020018d81526020018c6001600160a01b031681526020018b81526020018a815260200189815260200188151581526020018781526020018681526020014381526020014281526020018515158152602001846001600160a01b031681525090506000806149ca83615645565b915091508e6001600160a01b03167f5265bc4952da402633b3fc35f67ab4245493a0ab94dd8ab123667c8d45a4485c8f8f8f8f8f8f8f8f8b60016013805490500343423a60405180806020018e6001600160a01b031681526020018d81526020018c81526020018b81526020018a1515815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528f818151815260200191508051906020019060200280838360005b83811015614aa1578181015183820152602001614a89565b505050509050019e50505050505050505050505050505060405180910390a29e9d5050505050505050505050505050565b6000614adc615bc2565b604051806101c001604052808f6001600160a01b031681526020018e81526020018d6001600160a01b031681526020018c81526020018b81526020018a15158152602001896001600160a01b031681526020018881526020018781526020018681526020014381526020014281526020018515158152602001846001600160a01b03168152509050600080614b70836157e3565b9150915082600001516001600160a01b03167f81ed0476a7e785a9e4728fffd679ea97176ca1ac85e1003462558bb5677da57b84602001518560400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001518c600160148054905003434260405180806020018e6001600160a01b031681526020018d81526020018c81526020018b151581526020018a6001600160a01b0316815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528f818151815260200191508051906020019060200280838360005b83811015614c7a578181015183820152602001614c62565b505050509050019e50505050505050505050505050505060405180910390a29f9e505050505050505050505050505050565b600082820183811015613bef576040805162461bcd60e51b815260206004820152601b60248201527a536166654d6174683a206164646974696f6e206f766572666c6f7760281b604482015290519081900360640190fd5b60008033301480614d2457503360009081526019602052604090205460ff165b60125490915060ff16158015614d38575080155b15614d70576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b8015614d965743614d8c600f5487614cac90919063ffffffff16565b1115915050613bef565b336001600160a01b03841614614dd9576040805162461bcd60e51b815260206004820152600360248201526234303360e81b604482015290519081900360640190fd5b42614def60105486614cac90919063ffffffff16565b1115614e2a576040805162461bcd60e51b815260206004820152600560248201526464656c617960d81b604482015290519081900360640190fd5b506001949350505050565b600a546001600160a01b031680614e4c5750611be3565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b158015614e9b57600080fd5b505afa158015614eaf573d6000803e3d6000fd5b505050506040513d6040811015614ec557600080fd5b508051602090910151909250905081614ee057505050611be3565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b158015614f2557600080fd5b505afa158015614f39573d6000803e3d6000fd5b505050506040513d6020811015614f4f57600080fd5b50516040805163318bc68960e01b815290519192507f474c763ff84bf2c2039a6d9fea955ecd0f724030e3c365b91169c6a16fe751b791889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b158015614fbc57600080fd5b505af1158015614fd0573d6000803e3d6000fd5b505050506040513d6020811015614fe657600080fd5b5051604080516001600160a01b03948516815260208101939093528281019190915260608201879052918516608082015290519081900360a00190a1505050505050565b606061507f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661598c9092919063ffffffff16565b8051909150156140f55780806020019051602081101561509e57600080fd5b50516140f55760405162461bcd60e51b815260040180806020018281038252602a815260200180615e59602a913960400191505060405180910390fd5b60035460408051634998b10960e11b81526001600160a01b03878116600483015286811660248301528481166044830152915160009384931691639331621291606480830192602092919082900301818787803b15801561513b57600080fd5b505af115801561514f573d6000803e3d6000fd5b505050506040513d602081101561516557600080fd5b50519050838110156151b7576040805162461bcd60e51b81526020600482015260166024820152751a5b9cdd59999a58da595b9d08185b5bdd5b9d13dd5d60521b604482015290519081900360640190fd5b95945050505050565b6000818484111561524f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156152145781810151838201526020016151fc565b50505050905090810190601f1680156152415780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b60008261526c57506000612a59565b8282028284828161527957fe5b0414613bef5760405162461bcd60e51b8152600401808060200182810382526021815260200180615e386021913960400191505060405180910390fd5b6000613bef83836040518060400160405280601a815260200179536166654d6174683a206469766973696f6e206279207a65726f60301b81525061599b565b806152ff576140f5565b81156153fd576001600160a01b0383166000908152600c602052604090205480158015906153b057506003546040805163783a2b6760e11b81526001600160a01b038781166004830152915184936153ae93879391169163f07456ce91602480820192602092909190829003018186803b15801561537c57600080fd5b505afa158015615390573d6000803e3d6000fd5b505050506040513d60208110156153a657600080fd5b505190614cac565b115b156153f7576040805162461bcd60e51b81526020600482015260126024820152711b585e081b1bdb99dcc8195e18d95959195960721b604482015290519081900360640190fd5b506140f5565b6001600160a01b0383166000908152600d6020526040902054801580159061547657506003546040805163114f1b5560e31b81526001600160a01b03878116600483015291518493615474938793911691638a78daa891602480820192602092909190829003018186803b15801561537c57600080fd5b115b1561449b576040805162461bcd60e51b81526020600482015260136024820152721b585e081cda1bdc9d1cc8195e18d959591959606a1b604482015290519081900360640190fd5b600a546001600160a01b0316806154d55750611be3565b600080826001600160a01b031663534ef883866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050604080518083038186803b15801561552457600080fd5b505afa158015615538573d6000803e3d6000fd5b505050506040513d604081101561554e57600080fd5b50805160209091015190925090508161556957505050611be3565b600354604080516312d43a5160e01b815290516000926001600160a01b0316916312d43a51916004808301926020929190829003018186803b1580156155ae57600080fd5b505afa1580156155c2573d6000803e3d6000fd5b505050506040513d60208110156155d857600080fd5b50516040805163318bc68960e01b815290519192507fc2414023ce7002ee98557d1e7be21e5559073336f2217ee5f9b2e50fd85f71ee91889188916001600160a01b0386169163318bc6899160048083019260209291908290030181600087803b158015614fbc57600080fd5b80516001600160a01b0381166000908152601a6020526040812054909182918290615671906001614cac565b6001600160a01b0383166000908152601a602052604081208290559091506156998383612a19565b6000818152601b60209081526040909120885181546001600160a01b0319166001600160a01b03909116178155888201518051939450899391926156e592600185019290910190615cfe565b5060408201516002820180546001600160a01b039283166001600160a01b0319909116179055606083015160038301556080830151600483015560a0830151600583015560c083015160068301805491151560ff1992831617905560e084015160078401556101008085015160088501556101208501516009850155610140850151600a850155610160850151600b90940180546101809096015190931602610100600160a81b0319931515949091169390931791909116919091179055601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09001819055909350915050915091565b80516001600160a01b0381166000908152601c602052604081205490918291829061580f906001614cac565b6001600160a01b0383166000908152601c602052604081208290559091506158378383612a19565b6000818152601d60209081526040909120885181546001600160a01b0319166001600160a01b039091161781558882015180519394508993919261588392600185019290910190615cfe565b5060408201516002820180546001600160a01b039283166001600160a01b0319909116179055606083015160038301556080830151600483015560a083015160058301805460c08601518416610100908102610100600160a81b031994151560ff199384161785161790925560e0860151600686015581860151600786015561012086015160088601556101408601516009860155610160860151600a860155610180860151600b90950180546101a090970151909416909102931515941693909317909216179055601480546001810182556000919091527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec01819055909350915050915091565b6060613bec8484600085615a00565b600081836159ea5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156152145781810151838201526020016151fc565b5060008385816159f657fe5b0495945050505050565b606082471015615a415760405162461bcd60e51b8152600401808060200182810382526026815260200180615e126026913960400191505060405180910390fd5b615a4a85615257565b615a9b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310615ada5780518252601f199092019160209182019101615abb565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615b3c576040519150601f19603f3d011682016040523d82523d6000602084013e615b41565b606091505b5091509150615b51828286615b5c565b979650505050505050565b60608315615b6b575081613bef565b825115615b7b5782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156152145781810151838201526020016151fc565b604051806101c0016040528060006001600160a01b031681526020016060815260200160006001600160a01b03168152602001600081526020016000815260200160001515815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b50805460008255906000526020600020908101906149389190615d63565b604051806101a0016040528060006001600160a01b031681526020016060815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000151581526020016000815260200160008152602001600081526020016000815260200160001515815260200160006001600160a01b031681525090565b828054828255906000526020600020908101928215615d53579160200282015b82811115615d5357825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190615d1e565b50615d5f929150615d78565b5090565b5b80821115615d5f5760008155600101615d64565b5b80821115615d5f5780546001600160a01b0319168155600101615d7956fe5265656e7472616e637947756172643a207265656e7472616e742063616c6c00476f7665726e61626c653a20666f7262696464656e0000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220265e969fb5b1c0954ad938acb31a72de91c47bbaba7cb78d40059516ad56eea664736f6c634300060c0033", + "linkReferences": { + "contracts/core/PositionUtils.sol": { + "PositionUtils": [ + { + "length": 20, + "start": 18058 + }, + { + "length": 20, + "start": 18673 + } + ] + } + }, + "deployedLinkReferences": { + "contracts/core/PositionUtils.sol": { + "PositionUtils": [ + { + "length": 20, + "start": 17816 + }, + { + "length": 20, + "start": 18431 + } + ] + } + } +} diff --git a/projects/amped/src/abis/PositionRouter.ts b/projects/amped/src/abis/PositionRouter.ts new file mode 100644 index 00000000..1d73c214 --- /dev/null +++ b/projects/amped/src/abis/PositionRouter.ts @@ -0,0 +1,268 @@ +import { Abi } from 'viem'; + +export const PositionRouter = [ + { + "inputs": [], + "name": "minExecutionFee", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePosition", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePositionETH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withdrawETH", + "type": "bool" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createDecreasePosition", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createDecreasePositionETH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + } +] as const satisfies Abi; \ No newline at end of file diff --git a/projects/amped/src/abis/RewardDistributor.ts b/projects/amped/src/abis/RewardDistributor.ts new file mode 100644 index 00000000..fb9a2fb0 --- /dev/null +++ b/projects/amped/src/abis/RewardDistributor.ts @@ -0,0 +1,47 @@ +export const RewardDistributor = [ + { + "inputs": [], + "name": "tokensPerInterval", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "pendingRewards", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/abis/RewardRouter.ts b/projects/amped/src/abis/RewardRouter.ts new file mode 100644 index 00000000..3d49ae46 --- /dev/null +++ b/projects/amped/src/abis/RewardRouter.ts @@ -0,0 +1,68 @@ +import { Abi } from 'viem'; + +export const RewardRouter = [ + { + inputs: [ + { name: '_token', type: 'address' }, + { name: '_amount', type: 'uint256' }, + { name: '_minUsdg', type: 'uint256' }, + { name: '_minGlp', type: 'uint256' } + ], + name: 'mintAndStakeGlp', + outputs: [{ name: "", type: "uint256" }], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { name: '_minUsdg', type: 'uint256' }, + { name: '_minGlp', type: 'uint256' } + ], + name: 'mintAndStakeGlpETH', + outputs: [{ name: "", type: "uint256" }], + stateMutability: 'payable', + type: 'function' + }, + { + inputs: [ + { name: '_tokenOut', type: 'address' }, + { name: '_glpAmount', type: 'uint256' }, + { name: '_minOut', type: 'uint256' }, + { name: '_receiver', type: 'address' } + ], + name: 'unstakeAndRedeemGlp', + outputs: [{ type: 'uint256' }], + stateMutability: 'nonpayable', + type: 'function' + }, + { + inputs: [ + { name: '_glpAmount', type: 'uint256' }, + { name: '_minOut', type: 'uint256' }, + { name: '_receiver', type: 'address' } + ], + name: 'unstakeAndRedeemGlpETH', + outputs: [{ type: 'uint256' }], + stateMutability: 'nonpayable', + type: 'function' + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "StakeGlp", + "type": "event" + } +] as const satisfies Abi; \ No newline at end of file diff --git a/projects/amped/src/abis/RewardTracker.ts b/projects/amped/src/abis/RewardTracker.ts new file mode 100644 index 00000000..ce7e4f4d --- /dev/null +++ b/projects/amped/src/abis/RewardTracker.ts @@ -0,0 +1,82 @@ +export const RewardTracker = [ + { + "inputs": [ + { + "internalType": "string", + "name": "_name", + "type": "string" + }, + { + "internalType": "string", + "name": "_symbol", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "tokensPerInterval", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "claimable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stakedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/abis/Router.js b/projects/amped/src/abis/Router.js new file mode 100644 index 00000000..dcf74278 --- /dev/null +++ b/projects/amped/src/abis/Router.js @@ -0,0 +1,184 @@ +export var Router = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "approvePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedPlugins", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePositionETH", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_shouldWrap", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_shouldUnwrap", + "type": "bool" + } + ], + "name": "createSwapOrder", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + } +]; diff --git a/projects/amped/src/abis/Router.json b/projects/amped/src/abis/Router.json new file mode 100644 index 00000000..8c55fc0e --- /dev/null +++ b/projects/amped/src/abis/Router.json @@ -0,0 +1,703 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "Router", + "sourceName": "contracts/core/Router.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_vault", + "type": "address" + }, + { + "internalType": "address", + "name": "_usdg", + "type": "address" + }, + { + "internalType": "address", + "name": "_weth", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenIn", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "tokenOut", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } + ], + "name": "Swap", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "addPlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "approvePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedPlugins", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "decreasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + } + ], + "name": "decreasePositionAndSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + } + ], + "name": "decreasePositionAndSwapETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address payable", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "decreasePositionETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "denyPlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "directPoolDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "gov", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "increasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_price", + "type": "uint256" + } + ], + "name": "increasePositionETH", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "pluginDecreasePosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "pluginIncreasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "pluginTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "plugins", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "removePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_gov", + "type": "address" + } + ], + "name": "setGov", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swapETHToTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address payable", + "name": "_receiver", + "type": "address" + } + ], + "name": "swapTokensToETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "usdg", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "vault", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "weth", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b506040516124773803806124778339818101604052606081101561003357600080fd5b5080516020820151604090920151600380546001600160a01b039384166001600160a01b0319918216179091556002805494841694821694909417909355600180549290911691831691909117905560008054909116331790556123db8061009c6000396000f3fe60806040526004361061011f5760003560e01c806312d43a51146101835780631b827878146101b45780631f1dd176146101fd5780632662166b1461024e5780632d4ba6a7146102c15780633039e37f1461038357806338c74dd9146104635780633fc8cef314610496578063430ed37c146104ab5780634b12e6431461050a5780635fc8500e146105515780636023e9661461063157806390205d8c146106f357806390b64ad314610752578063956f285e1461078b578063a4d95b64146107c6578063abe68eaa146107f9578063b32755de146108a8578063b7ddc9921461096b578063cedd437514610a41578063cfad57a214610a74578063d8867fc814610aa7578063f5b91b7b14610ada578063fbfa77cf14610aef5761017e565b3661017e576001546001600160a01b0316331461017c576040805162461bcd60e51b81526020600482015260166024820152752937baba32b91d1034b73b30b634b21039b2b73232b960511b604482015290519081900360640190fd5b005b600080fd5b34801561018f57600080fd5b50610198610b04565b604080516001600160a01b039092168252519081900360200190f35b3480156101c057600080fd5b5061017c600480360360808110156101d757600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610b13565b34801561020957600080fd5b5061017c600480360360a081101561022057600080fd5b506001600160a01b038135811691602081013582169160408201351690606081013590608001351515610b37565b34801561025a57600080fd5b506102af600480360360e081101561027157600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359160808201359160a081013515159160c09091013516610bcc565b60408051918252519081900360200190f35b3480156102cd57600080fd5b5061017c600480360360808110156102e457600080fd5b810190602081018135600160201b8111156102fe57600080fd5b82018360208201111561031057600080fd5b803590602001918460208302840111600160201b8311171561033157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610c8c565b34801561038f57600080fd5b5061017c60048036036101008110156103a757600080fd5b810190602081018135600160201b8111156103c157600080fd5b8201836020820111156103d357600080fd5b803590602001918460208302840111600160201b831117156103f457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135610df3565b34801561046f57600080fd5b5061017c6004803603602081101561048657600080fd5b50356001600160a01b0316610ef8565b3480156104a257600080fd5b50610198610f29565b3480156104b757600080fd5b5061017c600480360360e08110156104ce57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135610f38565b34801561051657600080fd5b5061053d6004803603602081101561052d57600080fd5b50356001600160a01b0316610f5f565b604080519115158252519081900360200190f35b34801561055d57600080fd5b5061017c600480360361010081101561057557600080fd5b810190602081018135600160201b81111561058f57600080fd5b8201836020820111156105a157600080fd5b803590602001918460208302840111600160201b831117156105c257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135610f74565b34801561063d57600080fd5b5061017c6004803603608081101561065457600080fd5b810190602081018135600160201b81111561066e57600080fd5b82018360208201111561068057600080fd5b803590602001918460208302840111600160201b831117156106a157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610fba565b3480156106ff57600080fd5b5061017c600480360360e081101561071657600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135610ff1565b34801561075e57600080fd5b5061017c6004803603604081101561077557600080fd5b506001600160a01b038135169060200135611000565b34801561079757600080fd5b5061053d600480360360408110156107ae57600080fd5b506001600160a01b038135811691602001351661108c565b3480156107d257600080fd5b5061017c600480360360208110156107e957600080fd5b50356001600160a01b03166110ac565b61017c6004803603606081101561080f57600080fd5b810190602081018135600160201b81111561082957600080fd5b82018360208201111561083b57600080fd5b803590602001918460208302840111600160201b8311171561085c57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602001356001600160a01b0316611120565b61017c600480360360c08110156108be57600080fd5b810190602081018135600160201b8111156108d857600080fd5b8201836020820111156108ea57600080fd5b803590602001918460208302840111600160201b8311171561090b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060800135611235565b34801561097757600080fd5b5061017c600480360360e081101561098e57600080fd5b810190602081018135600160201b8111156109a857600080fd5b8201836020820111156109ba57600080fd5b803590602001918460208302840111600160201b831117156109db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a00135611325565b348015610a4d57600080fd5b5061017c60048036036020811015610a6457600080fd5b50356001600160a01b03166113d2565b348015610a8057600080fd5b5061017c60048036036020811015610a9757600080fd5b50356001600160a01b0316611400565b348015610ab357600080fd5b5061017c60048036036020811015610aca57600080fd5b50356001600160a01b0316611475565b348015610ae657600080fd5b506101986114ec565b348015610afb57600080fd5b506101986114fb565b6000546001600160a01b031681565b610b1c8361150a565b610b316001600160a01b0385168484846115e0565b50505050565b610b408561150a565b600354604080516348d91abf60e01b81526001600160a01b03888116600483015287811660248301528681166044830152606482018690528415156084830152915191909216916348d91abf9160a480830192600092919082900301818387803b158015610bad57600080fd5b505af1158015610bc1573d6000803e3d6000fd5b505050505050505050565b6000610bd78861150a565b6003546040805163082a084960e41b81526001600160a01b038b811660048301528a811660248301528981166044830152606482018990526084820188905286151560a483015285811660c4830152915191909216916382a084909160e48083019260209291908290030181600087803b158015610c5457600080fd5b505af1158015610c68573d6000803e3d6000fd5b505050506040513d6020811015610c7e57600080fd5b505198975050505050505050565b60015484516001600160a01b039091169085906000198101908110610cad57fe5b60200260200101516001600160a01b031614610cfe576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b610d48610d0961163a565b60035486516001600160a01b039091169086908890600090610d2757fe5b60200260200101516001600160a01b03166115e0909392919063ffffffff16565b6000610d5585843061163e565b9050610d61818361177e565b6000805160206123388339815191523386600081518110610d7e57fe5b602002602001015187600189510381518110610d9657fe5b6020026020010151878560405180866001600160a01b03168152602001856001600160a01b03168152602001846001600160a01b031681526020018381526020018281526020019550505050505060405180910390a15050505050565b60015488516001600160a01b039091169089906000198101908110610e1457fe5b60200260200101516001600160a01b031614610e65576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b6000610e8a89600081518110610e7757fe5b60200260200101518989898930896117fb565b9050610ed3600360009054906101000a90046001600160a01b0316828b600081518110610eb357fe5b60200260200101516001600160a01b0316611a089092919063ffffffff16565b6000610ee08a843061163e565b9050610eec818661177e565b50505050505050505050565b3360009081526005602090815260408083206001600160a01b0394909416835292905220805460ff19166001179055565b6001546001600160a01b031681565b6000610f49888888888830886117fb565b9050610f55818461177e565b5050505050505050565b60046020526000908152604090205460ff1681565b6000610f8689600081518110610e7757fe5b9050610faf600360009054906101000a90046001600160a01b0316828b600081518110610eb357fe5b610eec89838661163e565b610fc5610d0961163a565b6000610fd285848461163e565b90506000805160206123388339815191523386600081518110610d7e57fe5b610f55878787878787876117fb565b61102261100b61163a565b6003546001600160a01b03858116929116846115e0565b60035460408051635f7bc11960e01b81526001600160a01b03858116600483015291519190921691635f7bc11991602480830192600092919082900301818387803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050505050565b600560209081526000928352604080842090915290825290205460ff1681565b6000546001600160a01b031633146110ff576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b6001600160a01b03166000908152600460205260409020805460ff19169055565b60015483516001600160a01b0390911690849060009061113c57fe5b60200260200101516001600160a01b03161461118d576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b611195611a5f565b60006111a284848461163e565b905060008051602061233883398151915233856000815181106111c157fe5b6020026020010151866001885103815181106111d957fe5b6020026020010151348560405180866001600160a01b03168152602001856001600160a01b03168152602001846001600160a01b031681526020018381526020018281526020019550505050505060405180910390a150505050565b60015486516001600160a01b0390911690879060009061125157fe5b60200260200101516001600160a01b0316146112a2576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b34156112b0576112b0611a5f565b600186511180156112c15750600034115b156113015760006112d387863061163e565b90506112ff600360009054906101000a90046001600160a01b0316828960018b510381518110610eb357fe5b505b6110848660018851038151811061131457fe5b602002602001015186858585611ae8565b84156113545761135461133661163a565b60035489516001600160a01b039091169088908b90600090610d2757fe5b600187511180156113655750600085115b156113a557600061137788863061163e565b90506113a3600360009054906101000a90046001600160a01b0316828a60018c510381518110610eb357fe5b505b6113c9876001895103815181106113b857fe5b602002602001015187858585611ae8565b50505050505050565b3360009081526005602090815260408083206001600160a01b0394909416835292905220805460ff19169055565b6000546001600160a01b03163314611453576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146114c8576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6002546001600160a01b031681565b6003546001600160a01b031681565b3360009081526004602052604090205460ff16611567576040805162461bcd60e51b81526020600482015260166024820152752937baba32b91d1034b73b30b634b21038363ab3b4b760511b604482015290519081900360640190fd5b6001600160a01b038116600090815260056020908152604080832033845290915290205460ff166115dd576040805162461bcd60e51b815260206004820152601b60248201527a149bdd5d195c8e881c1b1d59da5b881b9bdd08185c1c1c9bdd9959602a1b604482015290519081900360640190fd5b50565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610b31908590611ce3565b3390565b60008351600214156116855761167e8460008151811061165a57fe5b60200260200101518560018151811061166f57fe5b60200260200101518585611d94565b9050611777565b83516003141561172b5760006116c6856000815181106116a157fe5b6020026020010151866001815181106116b657fe5b6020026020010151600030611d94565b90506116ef600360009054906101000a90046001600160a01b03168287600181518110610eb357fe5b611723856001815181106116ff57fe5b60200260200101518660028151811061171457fe5b60200260200101518686611d94565b915050611777565b6040805162461bcd60e51b815260206004820152601c60248201527b0a4deeae8cae47440d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60231b604482015290519081900360640190fd5b9392505050565b60015460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156117cb57600080fd5b505af11580156117df573d6000803e3d6000fd5b506117f7925050506001600160a01b03821683611f92565b5050565b600083156118c157600354604080516340d3096b60e11b81526001600160a01b038a811660048301529151859392909216916381a612d691602480820192602092909190829003018186803b15801561185357600080fd5b505afa158015611867573d6000803e3d6000fd5b505050506040513d602081101561187d57600080fd5b505110156118bc5760405162461bcd60e51b81526004018080602001828103825260238152602001806123156023913960400191505060405180910390fd5b61197a565b60035460408051637092736960e11b81526001600160a01b038a8116600483015291518593929092169163e124e6d291602480820192602092909190829003018186803b15801561191157600080fd5b505afa158015611925573d6000803e3d6000fd5b505050506040513d602081101561193b57600080fd5b5051111561197a5760405162461bcd60e51b81526004018080602001828103825260248152602001806123826024913960400191505060405180910390fd5b6003546001600160a01b03166382a0849061199361163a565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828d166024820152828c166044820152606481018b9052608481018a905288151560a482015291871660c48301525160e48083019260209291908290030181600087803b158015610c5457600080fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611a5a908490611ce3565b505050565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611aaf57600080fd5b505af1158015611ac3573d6000803e3d6000fd5b5050600354600154611ae694506001600160a01b03908116935016905034611a08565b565b8115611bac5760035460408051637092736960e11b81526001600160a01b03878116600483015291518493929092169163e124e6d291602480820192602092909190829003018186803b158015611b3e57600080fd5b505afa158015611b52573d6000803e3d6000fd5b505050506040513d6020811015611b6857600080fd5b50511115611ba75760405162461bcd60e51b81526004018080602001828103825260248152602001806123826024913960400191505060405180910390fd5b611c65565b600354604080516340d3096b60e11b81526001600160a01b0387811660048301529151849392909216916381a612d691602480820192602092909190829003018186803b158015611bfc57600080fd5b505afa158015611c10573d6000803e3d6000fd5b505050506040513d6020811015611c2657600080fd5b50511015611c655760405162461bcd60e51b81526004018080602001828103825260238152602001806123156023913960400191505060405180910390fd5b6003546001600160a01b03166348d91abf611c7e61163a565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828a16602482015291881660448301526064820187905285151560848301525160a480830192600092919082900301818387803b158015610bad57600080fd5b6060611d38826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120779092919063ffffffff16565b805190915015611a5a57808060200190516020811015611d5757600080fd5b5051611a5a5760405162461bcd60e51b815260040180806020018281038252602a815260200180612358602a913960400191505060405180910390fd5b60025460009081906001600160a01b0386811691161415611e39576003546040805163817bb85760e01b81526001600160a01b03898116600483015286811660248301529151919092169163817bb8579160448083019260209291908290030181600087803b158015611e0657600080fd5b505af1158015611e1a573d6000803e3d6000fd5b505050506040513d6020811015611e3057600080fd5b50519050611f34565b6002546001600160a01b0387811691161415611ea65760035460408051630711e61960e41b81526001600160a01b03888116600483015286811660248301529151919092169163711e61909160448083019260209291908290030181600087803b158015611e0657600080fd5b60035460408051634998b10960e11b81526001600160a01b038981166004830152888116602483015286811660448301529151919092169163933162129160648083019260209291908290030181600087803b158015611f0557600080fd5b505af1158015611f19573d6000803e3d6000fd5b505050506040513d6020811015611f2f57600080fd5b505190505b83811015611f89576040805162461bcd60e51b815260206004820152601e60248201527f526f757465723a20696e73756666696369656e7420616d6f756e744f75740000604482015290519081900360640190fd5b95945050505050565b80471015611fe7576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114612032576040519150601f19603f3d011682016040523d82523d6000602084013e612037565b606091505b5050905080611a5a5760405162461bcd60e51b815260040180806020018281038252603a8152602001806122b5603a913960400191505060405180910390fd5b6060612086848460008561208e565b949350505050565b6060824710156120cf5760405162461bcd60e51b81526004018080602001828103825260268152602001806122ef6026913960400191505060405180910390fd5b6120d8856121ea565b612129576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106121685780518252601f199092019160209182019101612149565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146121ca576040519150601f19603f3d011682016040523d82523d6000602084013e6121cf565b606091505b50915091506121df8282866121f0565b979650505050505050565b3b151590565b606083156121ff575081611777565b82511561220f5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612259578181015183820152602001612241565b50505050905090810190601f1680156122865780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe526f757465723a20696e76616c6964205f706174680000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c526f757465723a206d61726b207072696365206c6f776572207468616e206c696d6974cd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460625361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564526f757465723a206d61726b20707269636520686967686572207468616e206c696d6974a264697066735822122095e612464b669c951d7d8ef44bdbc4a5516c23e0e9e7c6f06016975ece18860c64736f6c634300060c0033", + "deployedBytecode": "0x60806040526004361061011f5760003560e01c806312d43a51146101835780631b827878146101b45780631f1dd176146101fd5780632662166b1461024e5780632d4ba6a7146102c15780633039e37f1461038357806338c74dd9146104635780633fc8cef314610496578063430ed37c146104ab5780634b12e6431461050a5780635fc8500e146105515780636023e9661461063157806390205d8c146106f357806390b64ad314610752578063956f285e1461078b578063a4d95b64146107c6578063abe68eaa146107f9578063b32755de146108a8578063b7ddc9921461096b578063cedd437514610a41578063cfad57a214610a74578063d8867fc814610aa7578063f5b91b7b14610ada578063fbfa77cf14610aef5761017e565b3661017e576001546001600160a01b0316331461017c576040805162461bcd60e51b81526020600482015260166024820152752937baba32b91d1034b73b30b634b21039b2b73232b960511b604482015290519081900360640190fd5b005b600080fd5b34801561018f57600080fd5b50610198610b04565b604080516001600160a01b039092168252519081900360200190f35b3480156101c057600080fd5b5061017c600480360360808110156101d757600080fd5b506001600160a01b03813581169160208101358216916040820135169060600135610b13565b34801561020957600080fd5b5061017c600480360360a081101561022057600080fd5b506001600160a01b038135811691602081013582169160408201351690606081013590608001351515610b37565b34801561025a57600080fd5b506102af600480360360e081101561027157600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359160808201359160a081013515159160c09091013516610bcc565b60408051918252519081900360200190f35b3480156102cd57600080fd5b5061017c600480360360808110156102e457600080fd5b810190602081018135600160201b8111156102fe57600080fd5b82018360208201111561031057600080fd5b803590602001918460208302840111600160201b8311171561033157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610c8c565b34801561038f57600080fd5b5061017c60048036036101008110156103a757600080fd5b810190602081018135600160201b8111156103c157600080fd5b8201836020820111156103d357600080fd5b803590602001918460208302840111600160201b831117156103f457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135610df3565b34801561046f57600080fd5b5061017c6004803603602081101561048657600080fd5b50356001600160a01b0316610ef8565b3480156104a257600080fd5b50610198610f29565b3480156104b757600080fd5b5061017c600480360360e08110156104ce57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135610f38565b34801561051657600080fd5b5061053d6004803603602081101561052d57600080fd5b50356001600160a01b0316610f5f565b604080519115158252519081900360200190f35b34801561055d57600080fd5b5061017c600480360361010081101561057557600080fd5b810190602081018135600160201b81111561058f57600080fd5b8201836020820111156105a157600080fd5b803590602001918460208302840111600160201b831117156105c257600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505081356001600160a01b0390811693506020830135926040810135925060608101351515916080820135169060a08101359060c00135610f74565b34801561063d57600080fd5b5061017c6004803603608081101561065457600080fd5b810190602081018135600160201b81111561066e57600080fd5b82018360208201111561068057600080fd5b803590602001918460208302840111600160201b831117156106a157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602081013590604001356001600160a01b0316610fba565b3480156106ff57600080fd5b5061017c600480360360e081101561071657600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013515159160a08101359091169060c00135610ff1565b34801561075e57600080fd5b5061017c6004803603604081101561077557600080fd5b506001600160a01b038135169060200135611000565b34801561079757600080fd5b5061053d600480360360408110156107ae57600080fd5b506001600160a01b038135811691602001351661108c565b3480156107d257600080fd5b5061017c600480360360208110156107e957600080fd5b50356001600160a01b03166110ac565b61017c6004803603606081101561080f57600080fd5b810190602081018135600160201b81111561082957600080fd5b82018360208201111561083b57600080fd5b803590602001918460208302840111600160201b8311171561085c57600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050823593505050602001356001600160a01b0316611120565b61017c600480360360c08110156108be57600080fd5b810190602081018135600160201b8111156108d857600080fd5b8201836020820111156108ea57600080fd5b803590602001918460208302840111600160201b8311171561090b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013515159060800135611235565b34801561097757600080fd5b5061017c600480360360e081101561098e57600080fd5b810190602081018135600160201b8111156109a857600080fd5b8201836020820111156109ba57600080fd5b803590602001918460208302840111600160201b831117156109db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550506001600160a01b0383351693505050602081013590604081013590606081013590608081013515159060a00135611325565b348015610a4d57600080fd5b5061017c60048036036020811015610a6457600080fd5b50356001600160a01b03166113d2565b348015610a8057600080fd5b5061017c60048036036020811015610a9757600080fd5b50356001600160a01b0316611400565b348015610ab357600080fd5b5061017c60048036036020811015610aca57600080fd5b50356001600160a01b0316611475565b348015610ae657600080fd5b506101986114ec565b348015610afb57600080fd5b506101986114fb565b6000546001600160a01b031681565b610b1c8361150a565b610b316001600160a01b0385168484846115e0565b50505050565b610b408561150a565b600354604080516348d91abf60e01b81526001600160a01b03888116600483015287811660248301528681166044830152606482018690528415156084830152915191909216916348d91abf9160a480830192600092919082900301818387803b158015610bad57600080fd5b505af1158015610bc1573d6000803e3d6000fd5b505050505050505050565b6000610bd78861150a565b6003546040805163082a084960e41b81526001600160a01b038b811660048301528a811660248301528981166044830152606482018990526084820188905286151560a483015285811660c4830152915191909216916382a084909160e48083019260209291908290030181600087803b158015610c5457600080fd5b505af1158015610c68573d6000803e3d6000fd5b505050506040513d6020811015610c7e57600080fd5b505198975050505050505050565b60015484516001600160a01b039091169085906000198101908110610cad57fe5b60200260200101516001600160a01b031614610cfe576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b610d48610d0961163a565b60035486516001600160a01b039091169086908890600090610d2757fe5b60200260200101516001600160a01b03166115e0909392919063ffffffff16565b6000610d5585843061163e565b9050610d61818361177e565b6000805160206123388339815191523386600081518110610d7e57fe5b602002602001015187600189510381518110610d9657fe5b6020026020010151878560405180866001600160a01b03168152602001856001600160a01b03168152602001846001600160a01b031681526020018381526020018281526020019550505050505060405180910390a15050505050565b60015488516001600160a01b039091169089906000198101908110610e1457fe5b60200260200101516001600160a01b031614610e65576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b6000610e8a89600081518110610e7757fe5b60200260200101518989898930896117fb565b9050610ed3600360009054906101000a90046001600160a01b0316828b600081518110610eb357fe5b60200260200101516001600160a01b0316611a089092919063ffffffff16565b6000610ee08a843061163e565b9050610eec818661177e565b50505050505050505050565b3360009081526005602090815260408083206001600160a01b0394909416835292905220805460ff19166001179055565b6001546001600160a01b031681565b6000610f49888888888830886117fb565b9050610f55818461177e565b5050505050505050565b60046020526000908152604090205460ff1681565b6000610f8689600081518110610e7757fe5b9050610faf600360009054906101000a90046001600160a01b0316828b600081518110610eb357fe5b610eec89838661163e565b610fc5610d0961163a565b6000610fd285848461163e565b90506000805160206123388339815191523386600081518110610d7e57fe5b610f55878787878787876117fb565b61102261100b61163a565b6003546001600160a01b03858116929116846115e0565b60035460408051635f7bc11960e01b81526001600160a01b03858116600483015291519190921691635f7bc11991602480830192600092919082900301818387803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050505050565b600560209081526000928352604080842090915290825290205460ff1681565b6000546001600160a01b031633146110ff576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b6001600160a01b03166000908152600460205260409020805460ff19169055565b60015483516001600160a01b0390911690849060009061113c57fe5b60200260200101516001600160a01b03161461118d576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b611195611a5f565b60006111a284848461163e565b905060008051602061233883398151915233856000815181106111c157fe5b6020026020010151866001885103815181106111d957fe5b6020026020010151348560405180866001600160a01b03168152602001856001600160a01b03168152602001846001600160a01b031681526020018381526020018281526020019550505050505060405180910390a150505050565b60015486516001600160a01b0390911690879060009061125157fe5b60200260200101516001600160a01b0316146112a2576040805162461bcd60e51b81526020600482015260156024820152600080516020612295833981519152604482015290519081900360640190fd5b34156112b0576112b0611a5f565b600186511180156112c15750600034115b156113015760006112d387863061163e565b90506112ff600360009054906101000a90046001600160a01b0316828960018b510381518110610eb357fe5b505b6110848660018851038151811061131457fe5b602002602001015186858585611ae8565b84156113545761135461133661163a565b60035489516001600160a01b039091169088908b90600090610d2757fe5b600187511180156113655750600085115b156113a557600061137788863061163e565b90506113a3600360009054906101000a90046001600160a01b0316828a60018c510381518110610eb357fe5b505b6113c9876001895103815181106113b857fe5b602002602001015187858585611ae8565b50505050505050565b3360009081526005602090815260408083206001600160a01b0394909416835292905220805460ff19169055565b6000546001600160a01b03163314611453576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146114c8576040805162461bcd60e51b81526020600482015260116024820152702937baba32b91d103337b93134b23232b760791b604482015290519081900360640190fd5b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6002546001600160a01b031681565b6003546001600160a01b031681565b3360009081526004602052604090205460ff16611567576040805162461bcd60e51b81526020600482015260166024820152752937baba32b91d1034b73b30b634b21038363ab3b4b760511b604482015290519081900360640190fd5b6001600160a01b038116600090815260056020908152604080832033845290915290205460ff166115dd576040805162461bcd60e51b815260206004820152601b60248201527a149bdd5d195c8e881c1b1d59da5b881b9bdd08185c1c1c9bdd9959602a1b604482015290519081900360640190fd5b50565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610b31908590611ce3565b3390565b60008351600214156116855761167e8460008151811061165a57fe5b60200260200101518560018151811061166f57fe5b60200260200101518585611d94565b9050611777565b83516003141561172b5760006116c6856000815181106116a157fe5b6020026020010151866001815181106116b657fe5b6020026020010151600030611d94565b90506116ef600360009054906101000a90046001600160a01b03168287600181518110610eb357fe5b611723856001815181106116ff57fe5b60200260200101518660028151811061171457fe5b60200260200101518686611d94565b915050611777565b6040805162461bcd60e51b815260206004820152601c60248201527b0a4deeae8cae47440d2dcecc2d8d2c840bee0c2e8d05cd8cadccee8d60231b604482015290519081900360640190fd5b9392505050565b60015460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156117cb57600080fd5b505af11580156117df573d6000803e3d6000fd5b506117f7925050506001600160a01b03821683611f92565b5050565b600083156118c157600354604080516340d3096b60e11b81526001600160a01b038a811660048301529151859392909216916381a612d691602480820192602092909190829003018186803b15801561185357600080fd5b505afa158015611867573d6000803e3d6000fd5b505050506040513d602081101561187d57600080fd5b505110156118bc5760405162461bcd60e51b81526004018080602001828103825260238152602001806123156023913960400191505060405180910390fd5b61197a565b60035460408051637092736960e11b81526001600160a01b038a8116600483015291518593929092169163e124e6d291602480820192602092909190829003018186803b15801561191157600080fd5b505afa158015611925573d6000803e3d6000fd5b505050506040513d602081101561193b57600080fd5b5051111561197a5760405162461bcd60e51b81526004018080602001828103825260248152602001806123826024913960400191505060405180910390fd5b6003546001600160a01b03166382a0849061199361163a565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828d166024820152828c166044820152606481018b9052608481018a905288151560a482015291871660c48301525160e48083019260209291908290030181600087803b158015610c5457600080fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611a5a908490611ce3565b505050565b600160009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611aaf57600080fd5b505af1158015611ac3573d6000803e3d6000fd5b5050600354600154611ae694506001600160a01b03908116935016905034611a08565b565b8115611bac5760035460408051637092736960e11b81526001600160a01b03878116600483015291518493929092169163e124e6d291602480820192602092909190829003018186803b158015611b3e57600080fd5b505afa158015611b52573d6000803e3d6000fd5b505050506040513d6020811015611b6857600080fd5b50511115611ba75760405162461bcd60e51b81526004018080602001828103825260248152602001806123826024913960400191505060405180910390fd5b611c65565b600354604080516340d3096b60e11b81526001600160a01b0387811660048301529151849392909216916381a612d691602480820192602092909190829003018186803b158015611bfc57600080fd5b505afa158015611c10573d6000803e3d6000fd5b505050506040513d6020811015611c2657600080fd5b50511015611c655760405162461bcd60e51b81526004018080602001828103825260238152602001806123156023913960400191505060405180910390fd5b6003546001600160a01b03166348d91abf611c7e61163a565b604080516001600160e01b031960e085901b1681526001600160a01b039283166004820152828a16602482015291881660448301526064820187905285151560848301525160a480830192600092919082900301818387803b158015610bad57600080fd5b6060611d38826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120779092919063ffffffff16565b805190915015611a5a57808060200190516020811015611d5757600080fd5b5051611a5a5760405162461bcd60e51b815260040180806020018281038252602a815260200180612358602a913960400191505060405180910390fd5b60025460009081906001600160a01b0386811691161415611e39576003546040805163817bb85760e01b81526001600160a01b03898116600483015286811660248301529151919092169163817bb8579160448083019260209291908290030181600087803b158015611e0657600080fd5b505af1158015611e1a573d6000803e3d6000fd5b505050506040513d6020811015611e3057600080fd5b50519050611f34565b6002546001600160a01b0387811691161415611ea65760035460408051630711e61960e41b81526001600160a01b03888116600483015286811660248301529151919092169163711e61909160448083019260209291908290030181600087803b158015611e0657600080fd5b60035460408051634998b10960e11b81526001600160a01b038981166004830152888116602483015286811660448301529151919092169163933162129160648083019260209291908290030181600087803b158015611f0557600080fd5b505af1158015611f19573d6000803e3d6000fd5b505050506040513d6020811015611f2f57600080fd5b505190505b83811015611f89576040805162461bcd60e51b815260206004820152601e60248201527f526f757465723a20696e73756666696369656e7420616d6f756e744f75740000604482015290519081900360640190fd5b95945050505050565b80471015611fe7576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114612032576040519150601f19603f3d011682016040523d82523d6000602084013e612037565b606091505b5050905080611a5a5760405162461bcd60e51b815260040180806020018281038252603a8152602001806122b5603a913960400191505060405180910390fd5b6060612086848460008561208e565b949350505050565b6060824710156120cf5760405162461bcd60e51b81526004018080602001828103825260268152602001806122ef6026913960400191505060405180910390fd5b6120d8856121ea565b612129576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106121685780518252601f199092019160209182019101612149565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146121ca576040519150601f19603f3d011682016040523d82523d6000602084013e6121cf565b606091505b50915091506121df8282866121f0565b979650505050505050565b3b151590565b606083156121ff575081611777565b82511561220f5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612259578181015183820152602001612241565b50505050905090810190601f1680156122865780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe526f757465723a20696e76616c6964205f706174680000000000000000000000416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c526f757465723a206d61726b207072696365206c6f776572207468616e206c696d6974cd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e460625361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564526f757465723a206d61726b20707269636520686967686572207468616e206c696d6974a264697066735822122095e612464b669c951d7d8ef44bdbc4a5516c23e0e9e7c6f06016975ece18860c64736f6c634300060c0033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/projects/amped/src/abis/Router.ts b/projects/amped/src/abis/Router.ts new file mode 100644 index 00000000..60678d8c --- /dev/null +++ b/projects/amped/src/abis/Router.ts @@ -0,0 +1,230 @@ +export const Router = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "approvePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "approvedPlugins", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_acceptablePrice", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_referralCode", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_callbackTarget", + "type": "address" + } + ], + "name": "createIncreasePositionETH", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_triggerPrice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_triggerAboveThreshold", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "_executionFee", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_shouldWrap", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_shouldUnwrap", + "type": "bool" + } + ], + "name": "createSwapOrder", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swapETHToTokens", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_path", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_minOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiver", + "type": "address" + } + ], + "name": "swapTokensToETH", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]; \ No newline at end of file diff --git a/projects/amped/src/abis/Vault.js b/projects/amped/src/abis/Vault.js new file mode 100644 index 00000000..232a7191 --- /dev/null +++ b/projects/amped/src/abis/Vault.js @@ -0,0 +1,303 @@ +export var Vault = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "poolAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "reservedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getMaxPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "name": "getAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "maxGlobalLongSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "maxGlobalShortSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "cumulativeFundingRates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "increasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "decreasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "getPosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "approvePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]; diff --git a/projects/amped/src/abis/Vault.ts b/projects/amped/src/abis/Vault.ts new file mode 100644 index 00000000..dce45095 --- /dev/null +++ b/projects/amped/src/abis/Vault.ts @@ -0,0 +1,303 @@ +export const Vault = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "poolAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "reservedAmounts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "getMaxPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenIn", + "type": "address" + }, + { + "internalType": "address", + "name": "_tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amountIn", + "type": "uint256" + } + ], + "name": "getAmountOut", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "maxGlobalLongSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "maxGlobalShortSizes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + } + ], + "name": "cumulativeFundingRates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "increasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_collateralDelta", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_sizeDelta", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "decreasePosition", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "address", + "name": "_collateralToken", + "type": "address" + }, + { + "internalType": "address", + "name": "_indexToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_isLong", + "type": "bool" + } + ], + "name": "getPosition", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_plugin", + "type": "address" + } + ], + "name": "approvePlugin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +]; \ No newline at end of file diff --git a/projects/amped/src/abis/VaultPriceFeed.js b/projects/amped/src/abis/VaultPriceFeed.js new file mode 100644 index 00000000..8447aa40 --- /dev/null +++ b/projects/amped/src/abis/VaultPriceFeed.js @@ -0,0 +1,36 @@ +export var VaultPriceFeed = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "bool", + "name": "_maximise", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_includeAmmPrice", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_useSwapPricing", + "type": "bool" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +]; diff --git a/projects/amped/src/abis/VaultPriceFeed.ts b/projects/amped/src/abis/VaultPriceFeed.ts new file mode 100644 index 00000000..8a4a1aea --- /dev/null +++ b/projects/amped/src/abis/VaultPriceFeed.ts @@ -0,0 +1,36 @@ +export const VaultPriceFeed = [ + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "bool", + "name": "_maximise", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_includeAmmPrice", + "type": "bool" + }, + { + "internalType": "bool", + "name": "_useSwapPricing", + "type": "bool" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/abis/Vester.js b/projects/amped/src/abis/Vester.js new file mode 100644 index 00000000..49ee6b77 --- /dev/null +++ b/projects/amped/src/abis/Vester.js @@ -0,0 +1,21 @@ +export const Vester = [ + { + inputs: [ + { + internalType: "address", + name: "_account", + type: "address" + } + ], + name: "pairAmounts", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +]; \ No newline at end of file diff --git a/projects/amped/src/abis/Vester.ts b/projects/amped/src/abis/Vester.ts new file mode 100644 index 00000000..b1a05fb5 --- /dev/null +++ b/projects/amped/src/abis/Vester.ts @@ -0,0 +1,21 @@ +export const Vester = [ + { + inputs: [ + { + internalType: "address", + name: "_account", + type: "address" + } + ], + name: "pairAmounts", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + } +] as const; \ No newline at end of file diff --git a/projects/amped/src/constants.ts b/projects/amped/src/constants.ts new file mode 100644 index 00000000..9cfbd767 --- /dev/null +++ b/projects/amped/src/constants.ts @@ -0,0 +1,56 @@ +import { Chain, EVM } from '@heyanon/sdk'; +import { Address } from 'viem'; + +// Constants for APR calculations +export const PRECISION = 1e30; +export const SECONDS_PER_YEAR = 31536000; // 365 * 24 * 60 * 60 +export const BASIS_POINTS_DIVISOR = 10000; + +const { ChainIds } = EVM.constants; + +// Supported chains enum +export enum SupportedChain { + SONIC = ChainIds[Chain.SONIC], + BASE = ChainIds[Chain.BASE] +} + +// Supported chains array +export const supportedChains = Object.values(SupportedChain).filter((v): v is number => typeof v === 'number') as readonly number[]; + +// Other global constants can go here + +export const CONTRACT_ADDRESSES: Record> = { + [SupportedChain.SONIC]: { + GLP_MANAGER: '0x4DE729B85dDB172F1bb775882f355bA25764E430' as Address, + GLP_TOKEN: '0x6fbaeE8bEf2e8f5c34A08BdD4A4AB777Bd3f6764' as Address, + REWARD_ROUTER: '0xE72A2d5B3b09c88D4E8Cc60e74BD438d7168e80F' as Address, + REWARD_DISTRIBUTOR: '0xfcb51C49cE6A23d370797a7E3e601046b43B6172' as Address, + ALP_REWARD_DISTRIBUTOR: '0x2a7663A3e6961dC43bEcbF752DcC9798C1c22a6A' as Address, + ALP_FEE_REWARD_DISTRIBUTOR: '0xb6600B4328e417d21a7CfbAa11758F57A0E5A3E6' as Address, + REWARD_TRACKER: '0x765d548229169E14b397c8c87FF7E8a64f36F469' as Address, + VAULT: '0x5B8caae7cC6Ea61fb96Fd251C4Bc13e48749C7Da' as Address, + ROUTER: '0x451D212c080267feF47Fd777002C9186e61C5a2C' as Address, + POSITION_ROUTER: '0x69E44517D74709d552A69046585bef02d8c34D5B' as Address, + VAULT_PRICE_FEED: '0x51B9fcDF00423D597066A8a041ab38152a74Fe96' as Address, + FS_ALP: '0xB895e3DBFB37A4Cc6b4FB50B1cf903608e942FF9' as Address, + ALP_VESTER: '0x931d5560D236e0780FD872331e28D7598E0DeDcc' as Address, + // Special addresses + NATIVE_TOKEN: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' as Address, + WRAPPED_NATIVE_TOKEN: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38' as Address // WS + }, + [SupportedChain.BASE]: { + GLP_MANAGER: '0xD24c217230DAf4036E290133861EfF4B9aDB2b27' as Address, + GLP_TOKEN: '0x317b79Ac01Ed43755F72472B04ad31297e33ab98' as Address, + REWARD_ROUTER: '0xa9B2E867520EbD705018a4E088057bE1cdBB2A78' as Address, + REWARD_DISTRIBUTOR: '0x15602eD2C2A4c9Fb91EdC884D215de94b3769276' as Address, + REWARD_TRACKER: '0x12905Eb64C3A70c6a7D3E1f0A4BA3213C23BE051' as Address, + VAULT: '0xed33E4767B8d68bd7F64c429Ce4989686426a926' as Address, + ROUTER: '0x700d165ef6e5c79b9BD83D2C328391FE61917af6' as Address, + POSITION_ROUTER: '0xff2B2953C11D1B431Fa03dAA12489124d8E47BdB' as Address, + VAULT_PRICE_FEED: '0x2d918cBEbc9818FB372E2327bc6709132Aa17A71' as Address, + ALP_VESTER: '0x059580aC18587202FE37AA53D29f44D42dF992b4' as Address, + // Special addresses + NATIVE_TOKEN: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' as Address, + WRAPPED_NATIVE_TOKEN: '0x4200000000000000000000000000000000000006' as Address // WETH + } +} as const; diff --git a/projects/amped/src/functionMap.ts b/projects/amped/src/functionMap.ts new file mode 100644 index 00000000..8e068b85 --- /dev/null +++ b/projects/amped/src/functionMap.ts @@ -0,0 +1,37 @@ +/** + * Maps function names to their implementations + */ + +import { addLiquidity } from './functions/liquidity/addLiquidity.js'; +import { removeLiquidity } from './functions/liquidity/removeLiquidity.js'; +import { getPerpsLiquidity } from './functions/trading/leverage/getPerpsLiquidity.js'; +import { getPosition } from './functions/trading/leverage/getPosition.js'; +import { getALPAPR } from './functions/liquidity/getALPAPR.js'; +import { getUserTokenBalances } from './functions/liquidity/getUserTokenBalances.js'; +import { getUserLiquidity } from './functions/liquidity/getUserLiquidity.js'; +import { getPoolLiquidity } from './functions/liquidity/getPoolLiquidity.js'; +import { claimRewards } from './functions/liquidity/claimRewards.js'; +import { getSwapsLiquidity } from './functions/trading/swaps/getSwapsLiquidity.js'; +import { marketSwap } from './functions/trading/swaps/marketSwap.js'; +import { getAllOpenPositions } from './functions/trading/leverage/getAllOpenPositions.js'; +import { openPosition } from './functions/trading/leverage/openPosition.js'; +import { closePosition } from './functions/trading/leverage/closePosition.js'; +import { getEarnings } from './functions/liquidity/getEarnings.js'; + +export const functionMap = { + addLiquidity, + removeLiquidity, + getPerpsLiquidity, + getPosition, + getALPAPR, + getUserTokenBalances, + getUserLiquidity, + getPoolLiquidity, + claimRewards, + getSwapsLiquidity, + marketSwap, + getAllOpenPositions, + openPosition, + closePosition, + getEarnings, +}; \ No newline at end of file diff --git a/projects/amped/src/functions/index.ts b/projects/amped/src/functions/index.ts new file mode 100644 index 00000000..99edbad0 --- /dev/null +++ b/projects/amped/src/functions/index.ts @@ -0,0 +1,20 @@ +// Liquidity functions +export { getALPAPR } from './liquidity/getALPAPR.js'; +export { getEarnings } from './liquidity/getEarnings.js'; +export { claimRewards } from './liquidity/claimRewards.js'; +export { addLiquidity } from './liquidity/addLiquidity.js'; +export { removeLiquidity } from './liquidity/removeLiquidity.js'; +export { getUserLiquidity } from './liquidity/getUserLiquidity.js'; +export { getPoolLiquidity } from './liquidity/getPoolLiquidity.js'; +export { getUserTokenBalances } from './liquidity/getUserTokenBalances.js'; + +// Swap functions +export { getSwapsLiquidity } from './trading/swaps/getSwapsLiquidity.js'; +export { marketSwap } from './trading/swaps/marketSwap.js'; + +// Leverage trading functions +export { getPerpsLiquidity } from './trading/leverage/getPerpsLiquidity.js'; +export { openPosition } from './trading/leverage/openPosition.js'; +export { getPosition } from './trading/leverage/getPosition.js'; +export { getAllOpenPositions } from './trading/leverage/getAllOpenPositions.js'; +export { closePosition } from './trading/leverage/closePosition.js'; diff --git a/projects/amped/src/functions/liquidity/addLiquidity.ts b/projects/amped/src/functions/liquidity/addLiquidity.ts new file mode 100644 index 00000000..e2f42b74 --- /dev/null +++ b/projects/amped/src/functions/liquidity/addLiquidity.ts @@ -0,0 +1,363 @@ +import { parseUnits, formatUnits, decodeEventLog, type TransactionReceipt, type Address, encodeFunctionData } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES } from '../../constants.js'; +import { ERC20 } from '../../abis/ERC20.js'; +import { RewardRouter } from '../../abis/RewardRouter.ts'; +import { getPoolLiquidity } from './getPoolLiquidity.js'; +import { getTokenAddress, getChainFromName } from '../../utils.js'; +import { TokenSymbol, getTokenDecimals } from '../../utils/tokens.js'; + +interface Props { + chainName: string; + account: Address; + tokenSymbol: TokenSymbol; + amount: string | null; + slippageTolerance?: number; + percentOfBalance: number | null; + minUsdg?: string; + minGlp?: string; + publicClient?: any; + walletClient?: any; +} + +/** + * Adds liquidity to the protocol by providing tokens and receiving ALP in return + * + * @param props - The function parameters + * @param props.chainName - The name of the chain (sonic or base) + * @param props.account - The account address to add liquidity for + * @param props.tokenSymbol - Symbol of the token to provide as liquidity + * @param props.amount - Exact amount of tokens to provide (null if using percentOfBalance) + * @param props.slippageTolerance - Optional slippage tolerance percentage + * @param props.percentOfBalance - Percentage of token balance to use (1-100) (null if using amount) + * @param props.minUsdg - Optional minimum USDG to receive (default: 0) + * @param props.minGlp - Optional minimum ALP to receive (default: 0) + * @param props.publicClient - Optional Viem Public Client for interacting with the blockchain + * @param props.walletClient - Optional Viem Wallet Client for interacting with the blockchain + * @param options - System tools (notify) + * @returns Transaction result with liquidity addition details + */ +export async function addLiquidity( + { chainName, account, tokenSymbol, amount, slippageTolerance = 0.5, percentOfBalance, minUsdg = '0', minGlp = '0', publicClient, walletClient }: Props, + options: FunctionOptions +): Promise { + const { notify, evm: { sendTransactions } } = options; + const { checkToApprove } = EVM.utils; + + // Check wallet connection + if (!account) { + return toResult('Wallet not connected', true); + } + + try { + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Chain not supported: ${chainName}`, true); + } + + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + // Get token-specific information + const tokenAddress = getTokenAddress(tokenSymbol, networkName); + const tokenDecimals = getTokenDecimals(tokenSymbol); + const isNativeToken = tokenSymbol === 'S' || tokenSymbol === 'ETH'; + + // Validate input parameters - must provide either amount or percentOfBalance + if (percentOfBalance && amount) { + return toResult('Cannot provide both amount and percentOfBalance', true); + } + + if (!percentOfBalance && (!amount || typeof amount !== 'string' || isNaN(Number(amount)) || Number(amount) <= 0)) { + return toResult('Must provide either a valid amount greater than 0 or percentOfBalance', true); + } + + if (percentOfBalance && (percentOfBalance <= 0 || percentOfBalance > 100)) { + return toResult('Percentage must be between 1 and 100', true); + } + + await notify(`Adding liquidity with ${tokenSymbol}...`); + + // Get user token balance directly + let userBalance: bigint; + let userBalanceFormatted: string; + + if (isNativeToken) { + // For native tokens, get the balance directly + userBalance = await publicClient.getBalance({ address: account }); + userBalanceFormatted = formatUnits(userBalance, tokenDecimals); + } else { + // For ERC20 tokens, read the balance from the contract + const tokenContractAddress = tokenAddress as `0x${string}`; + if (!tokenContractAddress) { + return toResult(`Token address for ${tokenSymbol} not found`, true); + } + + userBalance = await publicClient.readContract({ + address: tokenContractAddress, + abi: ERC20, + functionName: 'balanceOf', + args: [account], + }) as bigint; + userBalanceFormatted = formatUnits(userBalance, tokenDecimals); + } + + // Calculate amount to add + let numericAmountToAdd: number; + if (percentOfBalance) { + const balance = Number(userBalanceFormatted); + if (balance <= 0) { + return toResult(`Insufficient ${tokenSymbol} balance (calculated from percentage)`, true); + } + numericAmountToAdd = balance * (percentOfBalance / 100); + } else { + // amount is guaranteed to be a valid string from validation above + numericAmountToAdd = Number(amount); + } + + // Convert the numeric amount to string for display and contract interaction + const amountToAddString = numericAmountToAdd.toString(); + // Convert amount to contract units + const amountInWei = parseUnits(amountToAddString, tokenDecimals); + + // Check balance again with wei amount + if (userBalance < amountInWei) { + return toResult( + // Use string version for message + `Insufficient ${tokenSymbol} balance. Required: ${amountToAddString}, Available: ${userBalanceFormatted}`, + true + ); + } + + // Get pool liquidity to check capacity + let estimatedImpact = "0.00%"; + const poolLiquidityResult = await getPoolLiquidity({ + chainName: networkName as ('sonic' | 'base'), + publicClient + } as any, options); + + if (poolLiquidityResult.success && poolLiquidityResult.data) { + try { + const poolData = JSON.parse(poolLiquidityResult.data); + + // Find the token we're trying to deposit + const tokenData = poolData.tokens.find((t: any) => t.symbol === tokenSymbol); + + if (tokenData && tokenData.depositCapacity) { + // Check if deposits are allowed + if (!tokenData.depositCapacity.canDeposit) { + return toResult( + `Cannot add liquidity: ${tokenSymbol} pool is over-utilized (${tokenData.depositCapacity.utilizationPercent}% utilized)`, + true + ); + } + + // Check if deposit amount exceeds theoretical max + const theoreticalMaxAmount = parseFloat(tokenData.depositCapacity.theoreticalMax); + if (numericAmountToAdd > theoreticalMaxAmount) { + return toResult( + `Deposit amount (${amountToAddString}) exceeds maximum allowed (${theoreticalMaxAmount.toFixed(6)} ${tokenSymbol})`, + true + ); + } + + // Calculate and warn about price impact + const depositValueUsd = numericAmountToAdd * parseFloat(tokenData.price); + + if (depositValueUsd < 5000) { + estimatedImpact = tokenData.depositCapacity.priceImpactEstimates.small; + } else if (depositValueUsd < 50000) { + estimatedImpact = tokenData.depositCapacity.priceImpactEstimates.medium; + } else { + estimatedImpact = tokenData.depositCapacity.priceImpactEstimates.large; + } + + // Warn if price impact is significant + const impactValue = parseFloat(estimatedImpact); + if (impactValue > 1) { + await notify(`⚠️ Warning: Estimated price impact of ${estimatedImpact} for this deposit`); + } + + // Log pool utilization info + await notify(`Pool utilization for ${tokenSymbol}: ${tokenData.depositCapacity.utilizationPercent}%`); + } + } catch (e) { + // If parsing fails, continue anyway + await notify(`Could not parse pool liquidity data, continuing...`); + } + } + + if (!tokenAddress && tokenSymbol !== 'S' && tokenSymbol !== 'ETH') { + return toResult(`Token ${tokenSymbol} not found on ${networkName}`, true); + } + + // Prepare transactions array + const transactions: EVM.types.TransactionParams[] = []; + + // --- Handle Approval for ERC20 tokens --- + if (!isNativeToken) { + const tokenInAddress = getTokenAddress(tokenSymbol, networkName); + if (!tokenInAddress) { + return toResult(`Token address for ${tokenSymbol} not found`, true); + } + + const glpManagerAddressTyped = networkContracts.GLP_MANAGER as Address; + + // Use SDK's checkToApprove utility + await checkToApprove({ + args: { + account, + target: tokenInAddress as Address, + spender: glpManagerAddressTyped, + amount: amountInWei, + }, + provider: publicClient, + transactions, + }); + + } + + // --- Mint Transaction --- + + const rewardRouterAddressTyped = networkContracts.REWARD_ROUTER as Address; + + const parsedMinUsdg = parseUnits(minUsdg, 18); + const parsedMinGlp = parseUnits(minGlp, 18); + + // Prepare mint transaction + let mintTx: EVM.types.TransactionParams; + + if (isNativeToken) { + // Native token mint + mintTx = { + target: rewardRouterAddressTyped, + data: encodeFunctionData({ + abi: RewardRouter, + functionName: 'mintAndStakeGlpETH', + args: [parsedMinUsdg, parsedMinGlp], + }), + value: amountInWei.toString(), // Pass value for native token + }; + } else { + // ERC20 token mint + const tokenInAddress = getTokenAddress(tokenSymbol, networkName); + if (!tokenInAddress) { + return toResult(`Token address for ${tokenSymbol} not found on ${networkName}`, true); + } + + mintTx = { + target: rewardRouterAddressTyped, + data: encodeFunctionData({ + abi: RewardRouter, + functionName: 'mintAndStakeGlp', + args: [tokenInAddress as `0x${string}`, amountInWei, parsedMinUsdg, parsedMinGlp], + }), + }; + } + + transactions.push(mintTx); + + // Send all transactions + try { + await notify(`Sending ${transactions.length} transaction(s)...`); + const txResult = await sendTransactions({ + chainId, + from: account, + transactions, // Changed from params to transactions + }); + + if (!txResult.success) { + throw new Error(txResult.error || 'Transaction failed'); + } + + // Parse the result to get transaction details + let transactionHash: string | undefined; + let alpReceived = 'N/A'; + + // Handle different response formats + if (txResult.data) { + // Check if data is array (direct tx responses) or object with results + if (Array.isArray(txResult.data) && txResult.data.length > 0) { + // Direct transaction response format from our sendTransactions + const lastTx = txResult.data[txResult.data.length - 1]; + transactionHash = lastTx.hash; + + // Wait for receipt to get events + if (lastTx.wait) { + try { + const receipt = await lastTx.wait(); + await notify(`Transaction completed with status: ${receipt.status}`); + + // TODO: Parse receipt logs to get ALP amount + // For now, just indicate success + if (receipt.status === 'success') { + alpReceived = 'Check transaction for details'; + } + } catch (e) { + await notify(`Warning: Could not get transaction receipt`); + } + } + } else if (typeof txResult.data === 'object' && txResult.data.results) { + // SDK format with results array + const results = txResult.data.results; + if (results.length > 0) { + const lastTx = results[results.length - 1]; + transactionHash = lastTx.transactionHash; + + // Try to extract ALP received from events + if (lastTx.events) { + for (const event of lastTx.events) { + if (event.eventName === 'StakeGlp' && event.args) { + // amount is typically the second argument + const mintAmount = event.args[1]; + if (mintAmount) { + alpReceived = formatUnits(BigInt(mintAmount), 18); + break; + } + } + } + } + } + } + } + + // Include capacity check results in response + let capacityInfo = {}; + if (poolLiquidityResult.success && poolLiquidityResult.data) { + try { + const poolData = JSON.parse(poolLiquidityResult.data); + const tokenData = poolData.tokens.find((t: any) => t.symbol === tokenSymbol); + if (tokenData && tokenData.depositCapacity) { + capacityInfo = { + poolUtilization: tokenData.depositCapacity.utilizationPercent + "%", + estimatedPriceImpact: estimatedImpact || "N/A", + }; + } + } catch (e) { + // Ignore parse errors + } + } + + return toResult( + JSON.stringify({ + success: true, + transactionHash, + details: { + tokenSymbol, + amountAdded: amountToAddString, + alpReceived: alpReceived, + minUsdgSet: minUsdg, + minGlpSet: minGlp, + transactionCount: transactions.length, + ...capacityInfo, + }, + }), + ); + + } catch (e: any) { + return toResult(`Failed to add liquidity: ${e.message}`, true); + } + } catch (error: any) { + return toResult(`Failed to add liquidity: ${error.message}`, true); + } +} \ No newline at end of file diff --git a/projects/amped/src/functions/liquidity/claimRewards.ts b/projects/amped/src/functions/liquidity/claimRewards.ts new file mode 100644 index 00000000..2bd99a76 --- /dev/null +++ b/projects/amped/src/functions/liquidity/claimRewards.ts @@ -0,0 +1,101 @@ +import { Address, encodeFunctionData, formatUnits } from 'viem'; +import { FunctionReturn, FunctionOptions, TransactionParams, toResult, EVM } from '@heyanon/sdk'; +const { getChainFromName } = EVM.utils; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../constants.js'; +import { RewardTracker } from '../../abis/RewardTracker.js'; + +interface Props { + chainName: string; + account: Address; +} + +/** + * Claims available rewards from the reward tracker + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to claim rewards for + * @param options - System tools for blockchain interactions + * @returns Transaction result with claim details + */ +export async function claimRewards({ chainName, account }: Props, options: FunctionOptions): Promise { + const { notify, getProvider, evm } = options; + const sendTransactions = evm?.sendTransactions || options.sendTransactions; + // Check wallet connection + if (!account) return toResult('Wallet not connected', true); + + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + if (chainId !== SupportedChain.SONIC) { + return toResult(`Protocol is only supported on Sonic chain`, true); + } + + await notify('Preparing to claim rewards...'); + + try { + const provider = getProvider(chainId); + const rewardTrackerAddress = CONTRACT_ADDRESSES[SupportedChain.SONIC].REWARD_TRACKER; + + // Check if there are rewards to claim + const claimableAmount = await provider.readContract({ + address: rewardTrackerAddress, + abi: RewardTracker, + functionName: 'claimable', + args: [account], + }) as bigint; + + if (claimableAmount <= 0n) { + return toResult('No rewards available to claim', true); + } + + await notify(`Claiming ${formatUnits(claimableAmount, 18)} wS rewards...`); + + const tx: TransactionParams = { + target: rewardTrackerAddress, + data: encodeFunctionData({ + abi: [ + { + inputs: [{ name: 'account', type: 'address' }], + name: 'claim', + outputs: [{ type: 'uint256' }], + stateMutability: 'nonpayable', + type: 'function', + }, + ], + functionName: 'claim', + args: [account], + }), + value: BigInt(0), + }; + + const result = await sendTransactions({ + chainId, + account, + transactions: [tx], + }); + + if (!result.data || result.data.length === 0) { + return toResult('Transaction failed: No transaction data returned', true); + } + + const txHash = result.data[0]?.hash; + if (!txHash) { + return toResult('Transaction failed: No transaction hash returned', true); + } + + return toResult( + JSON.stringify({ + success: true, + claimableAmount: claimableAmount.toString(), + isMultisig: result.isMultisig, + txHash, + message: `Successfully claimed ${formatUnits(claimableAmount, 18)} wS rewards. Transaction hash: ${txHash}`, + }), + ); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to claim rewards: ${error.message}`, true); + } + return toResult('Failed to claim rewards: Unknown error', true); + } +} diff --git a/projects/amped/src/functions/liquidity/getALPAPR.ts b/projects/amped/src/functions/liquidity/getALPAPR.ts new file mode 100644 index 00000000..536d8a97 --- /dev/null +++ b/projects/amped/src/functions/liquidity/getALPAPR.ts @@ -0,0 +1,208 @@ +import { Address, formatUnits, type PublicClient } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SECONDS_PER_YEAR, SupportedChain } from '../../constants.js'; +import { RewardTracker } from '../../abis/RewardTracker.js'; +import { RewardDistributor } from '../../abis/RewardDistributor.js'; +import { VaultPriceFeed } from '../../abis/VaultPriceFeed.js'; +import { GlpManager } from '../../abis/GlpManager.js'; +import { getChainFromName, getTokenAddress } from '../../utils.js'; + +interface Props { + chainName: string; + account: Address; + publicClient: PublicClient; +} + +// Helper function for safe number conversion +function safeToNumber(value: unknown): number { + if (value === null || value === undefined) return 0; + if (typeof value === 'string') { + const parsed = parseFloat(value); + return isNaN(parsed) ? 0 : parsed; + } + if (typeof value === 'number') return isNaN(value) ? 0 : value; + if (typeof value === 'bigint') { + try { + return Number(value); + } catch { + return 0; + } + } + return 0; +} + +/** + * Gets APR information for ALP (Amped Liquidity Provider) tokens + * @param props - The function parameters, including publicClient + * @param props.chainName - The name of the chain (sonic or base) + * @param props.account - The account address to check APR for + * @param props.publicClient - Viem Public Client for interacting with the blockchain + * @param options - System tools (like notify) + * @returns APR information including base APR and reward rates + */ +export async function getALPAPR( + { chainName, account, publicClient }: Props, + options: FunctionOptions +): Promise { + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + + // Get network contracts based on chainId + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + // Keep uppercase version for display in log messages + const displayNetwork = chainName.toUpperCase(); + + // Validate account + if (!account) { + return toResult('Wallet not connected', true); + } + + // Validate publicClient was passed + if (!publicClient) { + return toResult('Public client not provided in parameters', true); + } + + try { + // Use network-specific addresses from constants + const rewardTrackerAddress = networkContracts.REWARD_TRACKER; + const glpTokenAddress = networkContracts.GLP_TOKEN; + // We'll check both distributors + const ampRewardDistributorAddress = networkContracts.ALP_REWARD_DISTRIBUTOR; + const lpRewardDistributorAddress = networkContracts.ALP_FEE_REWARD_DISTRIBUTOR; + const vaultPriceFeedAddress = networkContracts.VAULT_PRICE_FEED; + const wrappedNativeTokenSymbol = chainId === SupportedChain.SONIC ? 'WS' : 'WETH'; + const wrappedNativeTokenAddress = getTokenAddress(wrappedNativeTokenSymbol, chainName.toLowerCase()); + const glpManagerAddress = networkContracts.GLP_MANAGER; + + + // Fetch all data using publicClient + const totalSupply = await publicClient.readContract({ + address: glpTokenAddress, + abi: RewardTracker, // GLP also uses RewardTracker ABI for totalSupply + functionName: 'totalSupply', + }) as bigint; + + if (!totalSupply || totalSupply === 0n) { + return toResult('Invalid total supply: zero or undefined', true); + } + + const ampTokensPerInterval = await publicClient.readContract({ + address: ampRewardDistributorAddress, + abi: RewardDistributor, + functionName: 'tokensPerInterval', + }) as bigint; + + const lpTokensPerInterval = await publicClient.readContract({ + address: lpRewardDistributorAddress, + abi: RewardDistributor, + functionName: 'tokensPerInterval', + }) as bigint; + + // Get reward token (wrapped native) price + const rewardTokenPrice = await publicClient.readContract({ + address: vaultPriceFeedAddress, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [wrappedNativeTokenAddress, false, true, false], + }) as bigint; + + // Get ALP price from GLP Manager + const alpPrice = await publicClient.readContract({ + address: glpManagerAddress, + abi: GlpManager, + functionName: 'getPrice', + args: [false], + }) as bigint; + + // Calculate yearly rewards (tokensPerInterval is in 1e18) + const ampYearlyRewards = ampTokensPerInterval * BigInt(SECONDS_PER_YEAR); + const lpYearlyRewards = lpTokensPerInterval * BigInt(SECONDS_PER_YEAR); + const totalYearlyRewards = ampYearlyRewards + lpYearlyRewards; + + // Calculate yearly rewards value in USD + const ampYearlyRewardsUsd = (ampYearlyRewards * rewardTokenPrice) / BigInt(1e30); + const lpYearlyRewardsUsd = (lpYearlyRewards * rewardTokenPrice) / BigInt(1e30); + const totalYearlyRewardsUsd = ampYearlyRewardsUsd + lpYearlyRewardsUsd; + + // Calculate total supply value in USD + const totalSupplyUsd = (totalSupply * alpPrice) / BigInt(1e30); + + // Calculate base APR + const ampRewardsUsdNumber = Number(formatUnits(ampYearlyRewardsUsd, 18)); + const lpRewardsUsdNumber = Number(formatUnits(lpYearlyRewardsUsd, 18)); + const totalRewardsUsdNumber = Number(formatUnits(totalYearlyRewardsUsd, 18)); + const totalSupplyUsdNumber = Number(formatUnits(totalSupplyUsd, 18)); + + // Handle division by zero if total supply USD is 0 + const ampApr = totalSupplyUsdNumber === 0 ? 0 : (ampRewardsUsdNumber / totalSupplyUsdNumber) * 100; + const lpApr = totalSupplyUsdNumber === 0 ? 0 : (lpRewardsUsdNumber / totalSupplyUsdNumber) * 100; + const totalApr = ampApr + lpApr; + + // Calculate daily and weekly rewards in USD for better understanding + const dailyRewardsUsd = totalYearlyRewardsUsd / BigInt(365); + const weeklyRewardsUsd = totalYearlyRewardsUsd / BigInt(52); + + // Format numbers for output + const ampYearlyRewardsFormatted = formatUnits(ampYearlyRewards, 18); + const lpYearlyRewardsFormatted = formatUnits(lpYearlyRewards, 18); + const totalYearlyRewardsFormatted = formatUnits(totalYearlyRewards, 18); + + const ampYearlyRewardsUsdFormatted = ampRewardsUsdNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + const lpYearlyRewardsUsdFormatted = lpRewardsUsdNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + const totalYearlyRewardsUsdFormatted = totalRewardsUsdNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + + const dailyRewardsUsdFormatted = Number(formatUnits(dailyRewardsUsd, 18)).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + const weeklyRewardsUsdFormatted = Number(formatUnits(weeklyRewardsUsd, 18)).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + const totalSupplyFormatted = Number(formatUnits(totalSupply, 18)).toLocaleString(); + const totalSupplyUsdFormatted = totalSupplyUsdNumber.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); + const alpPriceFormatted = Number(formatUnits(alpPrice, 30)).toLocaleString(undefined, { minimumFractionDigits: 6, maximumFractionDigits: 6 }); + const rewardTokenPriceFormatted = Number(formatUnits(rewardTokenPrice, 30)).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 6 }); + const rewardTokenSymbol = chainId === SupportedChain.SONIC ? 'wS' : 'WETH'; // Get symbol for logging + + return toResult( + JSON.stringify({ + totalApr: totalApr.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), + ampApr: ampApr.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), + lpApr: lpApr.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), + totalYearlyRewards: totalYearlyRewardsFormatted, + ampYearlyRewards: ampYearlyRewardsFormatted, + lpYearlyRewards: lpYearlyRewardsFormatted, + totalYearlyRewardsUsd: totalYearlyRewardsUsdFormatted, + ampYearlyRewardsUsd: ampYearlyRewardsUsdFormatted, + lpYearlyRewardsUsd: lpYearlyRewardsUsdFormatted, + dailyRewardsUsd: dailyRewardsUsdFormatted, + weeklyRewardsUsd: weeklyRewardsUsdFormatted, + totalSupply: totalSupplyFormatted, + totalSupplyUsd: totalSupplyUsdFormatted, + alpPrice: alpPriceFormatted, + ampTokensPerInterval: formatUnits(ampTokensPerInterval, 18), + lpTokensPerInterval: formatUnits(lpTokensPerInterval, 18), + rewardTokenPrice: rewardTokenPriceFormatted, + rewardTokenSymbol: rewardTokenSymbol, + raw: { + ampYearlyRewards: ampYearlyRewards.toString(), + lpYearlyRewards: lpYearlyRewards.toString(), + totalYearlyRewards: totalYearlyRewards.toString(), + ampYearlyRewardsUsd: ampYearlyRewardsUsd.toString(), + lpYearlyRewardsUsd: lpYearlyRewardsUsd.toString(), + totalYearlyRewardsUsd: totalYearlyRewardsUsd.toString(), + totalSupply: totalSupply.toString(), + totalSupplyUsd: totalSupplyUsd.toString(), + ampTokensPerInterval: ampTokensPerInterval.toString(), + lpTokensPerInterval: lpTokensPerInterval.toString(), + rewardTokenPrice: rewardTokenPrice.toString(), + alpPrice: alpPrice.toString(), + }, + }), + ); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to get ALP APR information: ${error.message}`, true); + } + return toResult('Failed to get ALP APR information: Unknown error', true); + } +} diff --git a/projects/amped/src/functions/liquidity/getEarnings.ts b/projects/amped/src/functions/liquidity/getEarnings.ts new file mode 100644 index 00000000..e3570865 --- /dev/null +++ b/projects/amped/src/functions/liquidity/getEarnings.ts @@ -0,0 +1,76 @@ +import { Address, getContract, PublicClient, Chain, Transport } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM } from '@heyanon/sdk'; +const { getChainFromName } = EVM.utils; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../constants.js'; +import { RewardTracker } from '../../abis/RewardTracker.js'; +import { VaultPriceFeed } from '../../abis/VaultPriceFeed.js'; + +interface Props { + chainName: 'sonic' | 'base'; + account: Address; +} + +/** + * Gets earnings information for a user's staked tokens + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to check earnings for + * @param options - System tools for blockchain interactions + * @returns Earnings information including claimable rewards, staked amount, and reward token price + */ +export async function getEarnings({ chainName, account }: Props, options: FunctionOptions): Promise { + const { evm: { getProvider }, notify } = options; + // Validate chain + if (chainName !== 'sonic' && chainName !== 'base') { + return toResult(`Network ${chainName} not supported`, true); + } + + await notify('Checking earnings information...'); + + try { + const provider = getProvider(146) as unknown as PublicClient; // Sonic chain ID + const rewardTrackerAddress = CONTRACT_ADDRESSES[SupportedChain.SONIC].REWARD_TRACKER; + const fsAlpAddress = CONTRACT_ADDRESSES[SupportedChain.SONIC].FS_ALP; + const wrappedNativeTokenAddress = CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN; + const vaultPriceFeedAddress = CONTRACT_ADDRESSES[SupportedChain.SONIC].VAULT_PRICE_FEED; + + const [claimableRewards, stakedAmount, rewardTokenPrice] = await Promise.all([ + provider.readContract({ + address: rewardTrackerAddress, + abi: RewardTracker, + functionName: 'claimable', + args: [account], + }), + provider.readContract({ + address: fsAlpAddress, + abi: RewardTracker, + functionName: 'stakedAmounts', + args: [account], + }), + provider.readContract({ + address: vaultPriceFeedAddress, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [wrappedNativeTokenAddress, false, true, false], + }), + ]); + + // The price is returned with 30 decimals of precision + const rewardTokenPriceUsd = rewardTokenPrice.toString(); + const rewardValueUsd = (claimableRewards * rewardTokenPrice) / 10n ** 30n; + + return toResult( + JSON.stringify({ + claimableRewards: claimableRewards.toString(), + stakedAmount: stakedAmount.toString(), + rewardTokenPriceUsd, + rewardValueUsd: rewardValueUsd.toString(), + }), + ); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to get earnings information: ${error.message}`, true); + } + return toResult('Failed to get earnings information: Unknown error', true); + } +} diff --git a/projects/amped/src/functions/liquidity/getPoolLiquidity.ts b/projects/amped/src/functions/liquidity/getPoolLiquidity.ts new file mode 100644 index 00000000..a9c22aff --- /dev/null +++ b/projects/amped/src/functions/liquidity/getPoolLiquidity.ts @@ -0,0 +1,284 @@ +import { formatUnits, Address, PublicClient, zeroAddress } from 'viem'; +// Import types from the SDK package +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES } from '../../constants.js'; +// Import new token utilities +import { getChainFromName, getSupportedTokens, type TokenSymbol, getTokenAddress } from '../../utils.js'; +import { VaultPriceFeed } from '../../abis/VaultPriceFeed.js'; + +// Use keys of NETWORKS directly for the chain name type +// type SupportedChainName = keyof typeof NETWORKS; + +interface Props { + chainName: string; + publicClient: PublicClient; +} + +interface TokenLiquidity { + symbol: string; + address: string; + poolAmount: string; + reservedAmount: string; + availableAmount: string; + price: string; + poolAmountUsd: string; + reservedAmountUsd: string; + availableAmountUsd: string; + // Deposit capacity information + depositCapacity: { + // Theoretical maximum that could be deposited without constraints + theoreticalMax: string; + theoreticalMaxUsd: string; + // Pool utilization percentage (reserved/pool * 100) + utilizationPercent: string; + // Whether deposits are currently possible + canDeposit: boolean; + // Estimated price impact for different deposit sizes + priceImpactEstimates: { + small: string; // $1,000 worth + medium: string; // $10,000 worth + large: string; // $100,000 worth + }; + }; +} + +interface PoolLiquidity { + aum: string; + totalCapacityUsd: string; + totalUtilizationPercent: string; + tokens: TokenLiquidity[]; +} + +// Define the specific ABI for the functions we need +const GLP_MANAGER_ABI = [ + { + inputs: [{ type: 'bool', name: 'maximise' }], + name: 'getAum', + outputs: [{ type: 'uint256', name: '' }], + stateMutability: 'view', + type: 'function', + }, +] as const; + +const VAULT_ABI = [ + { + inputs: [{ name: '_token', type: 'address' }], + name: 'poolAmounts', + outputs: [{ type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ name: '_token', type: 'address' }], + name: 'reservedAmounts', + outputs: [{ type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ name: '_token', type: 'address' }], + name: 'getMinPrice', + outputs: [{ type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, +] as const; + +/** + * Gets the total liquidity pool (ALP/GLP) supply, Assets Under Management (AUM), and deposit capacity information + * @param props - The function parameters + * @param props.chainName - The name of the chain (sonic or base) + * @param props.publicClient - Viem Public Client for blockchain interaction + * @param options - System tools (only notify is used) + * @returns Pool information including total supply, AUM, individual token liquidity, and deposit capacity for each token + */ +export async function getPoolLiquidity(props: Props, options: FunctionOptions): Promise { + const { chainName, publicClient } = props; + const { notify } = options; + + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + // const networkName = chainName.toLowerCase(); // No longer needed, chainName is already lowercase + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + + try { + // Get AUM (Assets Under Management) + const aum = await publicClient.readContract({ + address: networkContracts.GLP_MANAGER, + abi: GLP_MANAGER_ABI, + functionName: 'getAum', + args: [true], // Include pending changes + }) as bigint; + + // Define supported tokens for Vault interaction using getSupportedTokens and adjusting native tokens + const allChainTokens = getSupportedTokens(chainName); + const supportedTokensForVault: { symbol: TokenSymbol; address: Address; decimals: number }[] = []; + + // Define which symbols are relevant for GLP/ALP pools for each chain + // These are the tokens whose liquidity is tracked in the Vault for GLP composition. + const poolConstituentSymbols: Record = { + sonic: ['S', 'WETH', 'Anon', 'USDC', 'STS', 'scUSD'], + base: ['ETH', 'WETH', 'CBBTC', 'USDC', 'VIRTUAL'], + }; + + const relevantSymbols = poolConstituentSymbols[chainName] || []; + + for (const token of allChainTokens) { + if (!relevantSymbols.includes(token.symbol)) { + continue; // Skip tokens not part of GLP/ALP composition for this network + } + + let addressForVaultCall = token.address; + let displaySymbol = token.symbol; + + // If the token is native 'S' or 'ETH', use its wrapped address for Vault calls + // but keep the display symbol as 'S' or 'ETH'. + if (chainName === 'sonic' && token.symbol === 'S') { + if (networkContracts.WRAPPED_NATIVE_TOKEN) { + addressForVaultCall = networkContracts.WRAPPED_NATIVE_TOKEN; + } + displaySymbol = 'S'; // Ensure display symbol is native + } else if (chainName === 'base' && token.symbol === 'ETH') { + if (networkContracts.WRAPPED_NATIVE_TOKEN) { + addressForVaultCall = networkContracts.WRAPPED_NATIVE_TOKEN; + } + displaySymbol = 'ETH'; // Ensure display symbol is native + } + + if (addressForVaultCall && addressForVaultCall !== zeroAddress) { + supportedTokensForVault.push({ + symbol: displaySymbol, // Use the original native symbol for display + address: addressForVaultCall, + decimals: token.decimals, // Decimals from tokenList.ts + }); + } + } + + // Filter out any tokens where the address might be effectively zero or missing (already done by check above) + // supportedTokensForVault = supportedTokensForVault.filter(t => !!t.address && t.address !== zeroAddress); + + + // Get liquidity info for each token using publicClient + const tokenLiquidityPromises = supportedTokensForVault.map(async (token) => { + // Handle potential errors for individual tokens + try { + const [poolAmount, reservedAmount, price] = await Promise.all([ + publicClient.readContract({ + address: networkContracts.VAULT, + abi: VAULT_ABI, + functionName: 'poolAmounts', + args: [token.address], + }) as Promise, + publicClient.readContract({ + address: networkContracts.VAULT, + abi: VAULT_ABI, + functionName: 'reservedAmounts', + args: [token.address], + }) as Promise, + publicClient.readContract({ + address: networkContracts.VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [token.address, false, true, false], + }) as Promise, + ]); + + const availableAmount = poolAmount - reservedAmount; + const poolAmountUsd = (poolAmount * price) / BigInt(10 ** token.decimals); + const reservedAmountUsd = (reservedAmount * price) / BigInt(10 ** token.decimals); + const availableAmountUsd = (availableAmount * price) / BigInt(10 ** token.decimals); + + // Calculate deposit capacity metrics + const utilizationPercent = poolAmount > 0n + ? Number((reservedAmount * 10000n) / poolAmount) / 100 + : 0; + + // Theoretical max deposit - using a conservative 5x multiplier of current pool amount + // This prevents extreme pool imbalances + const theoreticalMax = poolAmount * 5n; + const theoreticalMaxUsd = (theoreticalMax * price) / BigInt(10 ** token.decimals); + + // Check if deposits are possible (pool has some liquidity and not over-utilized) + const canDeposit = poolAmount > 0n && utilizationPercent < 95; + + // Estimate price impact for different deposit sizes + // These are rough estimates - actual impact depends on AMM curve + const estimatePriceImpact = (depositUsd: bigint): string => { + if (poolAmountUsd === 0n) return "N/A"; + + // Simple linear approximation: impact = depositSize / (poolSize * factor) + // factor = 50 means 2% impact for deposit equal to pool size + const factor = 50n; + const impactBasisPoints = (depositUsd * 10000n) / (poolAmountUsd * factor); + return (Number(impactBasisPoints) / 100).toFixed(2); + }; + + // Calculate price impacts for standard sizes + const smallDepositUsd = BigInt(1000) * BigInt(10 ** 30); // $1,000 + const mediumDepositUsd = BigInt(10000) * BigInt(10 ** 30); // $10,000 + const largeDepositUsd = BigInt(100000) * BigInt(10 ** 30); // $100,000 + + return { + symbol: token.symbol, // This is now correctly the display symbol (e.g., 'S') + address: token.address, // This is the address used for vault calls (e.g., Wrapped Sonic address) + poolAmount: formatUnits(poolAmount, token.decimals), + reservedAmount: formatUnits(reservedAmount, token.decimals), + availableAmount: formatUnits(availableAmount, token.decimals), + price: formatUnits(price, 30), + poolAmountUsd: formatUnits(poolAmountUsd, 30), + reservedAmountUsd: formatUnits(reservedAmountUsd, 30), + availableAmountUsd: formatUnits(availableAmountUsd, 30), + depositCapacity: { + theoreticalMax: formatUnits(theoreticalMax, token.decimals), + theoreticalMaxUsd: formatUnits(theoreticalMaxUsd, 30), + utilizationPercent: utilizationPercent.toFixed(2), + canDeposit, + priceImpactEstimates: { + small: estimatePriceImpact(smallDepositUsd) + "%", + medium: estimatePriceImpact(mediumDepositUsd) + "%", + large: estimatePriceImpact(largeDepositUsd) + "%", + }, + }, + }; + } catch (tokenError: any) { + return null; // Return null for failed tokens + } + }); + + const tokenLiquidityResults = await Promise.all(tokenLiquidityPromises); + const tokenLiquidity = tokenLiquidityResults.filter(t => t !== null) as TokenLiquidity[]; // Filter out nulls + + // Format AUM + const aumFormatted = formatUnits(aum, 30); + + // Calculate total capacity metrics + let totalPoolAmountUsd = 0; + let totalReservedAmountUsd = 0; + + tokenLiquidity.forEach(token => { + totalPoolAmountUsd += parseFloat(token.poolAmountUsd); + totalReservedAmountUsd += parseFloat(token.reservedAmountUsd); + }); + + const totalUtilizationPercent = totalPoolAmountUsd > 0 + ? (totalReservedAmountUsd / totalPoolAmountUsd * 100).toFixed(2) + : "0.00"; + + const poolLiquidity: PoolLiquidity = { + aum: aumFormatted, + totalCapacityUsd: totalPoolAmountUsd.toFixed(2), + totalUtilizationPercent, + tokens: tokenLiquidity, + }; + + // Stringify the result to match toResult expectation + return toResult(JSON.stringify(poolLiquidity)); + + } catch (error: any) { + return toResult(`Failed to fetch pool liquidity: ${error.message}`, true); + } +} diff --git a/projects/amped/src/functions/liquidity/getUserLiquidity.ts b/projects/amped/src/functions/liquidity/getUserLiquidity.ts new file mode 100644 index 00000000..c66e24b7 --- /dev/null +++ b/projects/amped/src/functions/liquidity/getUserLiquidity.ts @@ -0,0 +1,123 @@ +import { formatUnits, Address, getContract, PublicClient, Chain, Transport } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM } from '@heyanon/sdk'; +const { getChainFromName } = EVM.utils; +import { CONTRACT_ADDRESSES, LowercaseChainName } from '../../constants.js'; +import { GlpManager } from '../../abis/GlpManager.js'; +import { ERC20 } from '../../abis/ERC20.js'; +import { Vester } from '../../abis/Vester.js'; + +/** + * Interface for getting user's liquidity information + * @property {string} chainName - The name of the chain (must be "sonic") + * @property {string} account - The account address to check + */ +export interface UserLiquidityProps { + chainName: LowercaseChainName; + account: Address; +} + +/** + * Interface for the user's ALP position details + */ +export interface UserLiquidityInfo { + /** Total fsALP balance */ + balance: string; + /** Total USD value of fsALP */ + usdValue: string; + /** Current ALP price */ + alpPrice: string; + /** Amount of ALP reserved in vesting */ + reservedAmount: string; + /** USD value of reserved ALP */ + reservedUsdValue: string; + /** Amount of ALP available to sell (total - reserved) */ + availableAmount: string; + /** USD value of available ALP */ + availableUsdValue: string; + /** Claimable rewards (to be implemented) */ + claimableRewards: string; +} + +/** + * Gets the user's ALP (Amped Liquidity Provider) information + * @param {UserLiquidityProps} props - The input parameters + * @param {FunctionOptions} options - The function options + * @returns {Promise} The user's ALP information including balances and values + */ +export async function getUserLiquidity({ chainName, account }: UserLiquidityProps, options: FunctionOptions): Promise { + const { evm: { getProvider }, notify } = options; + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + if (chainName !== 'sonic') { + return toResult('This function is only supported on Sonic chain', true); + } + + // Validate account + if (!account) { + return toResult('Account address is required', true); + } + + if (account === '0x0000000000000000000000000000000000000000') { + return toResult('Zero address not allowed', true); + } + + try { + await notify('Initializing contracts...'); + const provider = getProvider(chainId); + + // Get fsALP balance + const balance = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].FS_ALP, + abi: ERC20, + functionName: 'balanceOf', + args: [account], + }) as bigint; + + // Get ALP price + const alpPrice = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].GLP_MANAGER, + abi: GlpManager, + functionName: 'getPrice', + args: [false], + }) as bigint; + + // Get reserved amount in vesting + const reservedAmount = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].ALP_VESTER, + abi: Vester, + functionName: 'pairAmounts', + args: [account], + }) as bigint; + + // Calculate available amount (total balance - reserved) + const availableAmount = balance - reservedAmount; + + // Calculate USD values (ALP price is in 1e30) + const usdValue = (balance * alpPrice) / 10n ** 30n; + const availableUsdValue = (availableAmount * alpPrice) / 10n ** 30n; + const reservedUsdValue = (reservedAmount * alpPrice) / 10n ** 30n; + + await notify('Preparing response...'); + + const result: UserLiquidityInfo = { + balance: formatUnits(balance, 18), + usdValue: formatUnits(usdValue, 18), + alpPrice: formatUnits(alpPrice, 30), + reservedAmount: formatUnits(reservedAmount, 18), + reservedUsdValue: formatUnits(reservedUsdValue, 18), + availableAmount: formatUnits(availableAmount, 18), + availableUsdValue: formatUnits(availableUsdValue, 18), + claimableRewards: '0', // To be implemented + }; + + return toResult(JSON.stringify(result)); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to fetch user liquidity: ${error.message}`, true); + } + return toResult('Failed to fetch user liquidity: Unknown error', true); + } +} diff --git a/projects/amped/src/functions/liquidity/getUserTokenBalances.ts b/projects/amped/src/functions/liquidity/getUserTokenBalances.ts new file mode 100644 index 00000000..747009af --- /dev/null +++ b/projects/amped/src/functions/liquidity/getUserTokenBalances.ts @@ -0,0 +1,235 @@ +import { Address, createPublicClient, http, Chain, type PublicClient } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SupportedNetwork, CHAIN_CONFIG } from '../../constants.js'; +import { ERC20 } from '../../abis/ERC20.js'; +import { VaultPriceFeed } from '../../abis/VaultPriceFeed.js'; +import { getChainFromName, getTokenAddress, getSupportedTokens, getTokenDecimals } from '../../utils.js'; +import { formatUnits } from 'viem'; + +interface Props { + chainName: 'sonic' | 'base'; + account: Address; + publicClient?: PublicClient; +} + +interface TokenInfo { + symbol: string; + address: Address; + decimals: number; + balance: string; + balanceUsd: string; + price: string; +} + +// Helper function for safe string conversion +function safeToString(value: unknown): string { + if (value === null || value === undefined) return ''; + return String(value); +} + +// Helper function for safe number conversion +function safeToNumber(value: unknown): number { + if (value === null || value === undefined) return 0; + if (typeof value === 'string') { + const parsed = parseFloat(value); + return isNaN(parsed) ? 0 : parsed; + } + if (typeof value === 'number') return isNaN(value) ? 0 : value; + if (typeof value === 'bigint') { + try { + return Number(value); + } catch { + return 0; + } + } + return 0; +} + +/** + * Gets balances and USD values of all supported tokens on Amped Finance for a given network + * @param props - The function parameters + * @param props.chainName - The name of the chain (sonic or base) + * @param props.account - The account address to check balances for + * @param props.publicClient - Viem Public Client for interacting with the blockchain (optional) + * @param options - System tools (like notify) + * @returns Information about token balances and their USD values + */ +export async function getUserTokenBalances( + { chainName, account, publicClient }: Props, + options: FunctionOptions +): Promise { + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + + // Use lowercase network name for accessing CONTRACT_ADDRESSES keys + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + // Also use lowercase name for network-specific logic checks + const network = networkName as SupportedNetwork; + + // Check if contracts for the network exist + if (!networkContracts) { + return toResult(`Contract addresses not found for network: ${networkName}`, true); + } + + // Check wallet connection + if (!account) { + return toResult('Wallet not connected', true); + } + + // Use publicClient from props if provided, otherwise get it from options + const client = publicClient || options.getProvider(chainId); + + // Validate client + if (!client) { + return toResult('Failed to get a valid provider for the blockchain', true); + } + + try { + await options.notify(`Fetching token balances on ${networkName}...`); + + const tokenInfos: TokenInfo[] = []; + + // Get supported tokens from SDK + const supportedTokens = getSupportedTokens(networkName); + + // Define network-specific details + let nativeSymbol: string; + let wrappedNativeSymbol: string; + + if (networkName === 'sonic') { + nativeSymbol = 'S'; + wrappedNativeSymbol = 'WS'; + } else if (networkName === 'base') { + nativeSymbol = 'ETH'; + wrappedNativeSymbol = 'WETH'; + } else { + return toResult(`Logic not implemented for network: ${networkName}`, true); + } + + // Build token list using SDK utilities + const acceptedErc20Tokens: { symbol: string; address: Address; decimals: number }[] = []; + for (const symbol of supportedTokens) { + // Skip native tokens as they're handled separately + if (symbol === nativeSymbol || symbol === wrappedNativeSymbol) continue; + + try { + const address = getTokenAddress(symbol, networkName); + const decimals = getTokenDecimals(symbol, networkName); + acceptedErc20Tokens.push({ symbol, address, decimals }); + } catch (e) { + // Skip tokens that can't be resolved + continue; + } + } + + const nativeTokenAddress = networkContracts.NATIVE_TOKEN; + const wrappedNativeTokenAddress = networkContracts.WRAPPED_NATIVE_TOKEN; + const vaultPriceFeedAddress = networkContracts.VAULT_PRICE_FEED; + + // Validate required addresses + if (!nativeTokenAddress || !wrappedNativeTokenAddress || !vaultPriceFeedAddress) { + return toResult(`Core contract addresses missing for network ${network}`, true); + } + + // --- Native Token Balance & Price --- + try { + const nativeBalanceBigInt = await client.getBalance({ address: account }); + + const nativePrice = await client.readContract({ + address: vaultPriceFeedAddress, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [wrappedNativeTokenAddress, false, true, false], + }) as bigint; + + // Price is in 1e30, balance in 1e18, result should be in USD (1e30) + const nativeBalanceUsd = (nativeBalanceBigInt * nativePrice) / BigInt(1e18); + + tokenInfos.push({ + symbol: nativeSymbol, + address: nativeTokenAddress, // Use generic NATIVE_TOKEN address (e.g., 0xeee) + decimals: 18, + balance: formatUnits(nativeBalanceBigInt, 18), + balanceUsd: formatUnits(nativeBalanceUsd, 30), + price: formatUnits(nativePrice, 30), + }); + + // --- Wrapped Native Token Balance (uses same price) --- + const wrappedBalance = await client.readContract({ + address: wrappedNativeTokenAddress, + abi: ERC20, + functionName: 'balanceOf', + args: [account], + }) as bigint; + const wrappedBalanceUsd = (wrappedBalance * nativePrice) / BigInt(1e18); + + tokenInfos.push({ + symbol: wrappedNativeSymbol, + address: wrappedNativeTokenAddress, + decimals: 18, + balance: formatUnits(wrappedBalance, 18), + balanceUsd: formatUnits(wrappedBalanceUsd, 30), + price: formatUnits(nativePrice, 30), + }); + + } catch (error) { + return toResult(`Failed to get native/wrapped balances on ${network}: ${error instanceof Error ? error.message : 'Unknown error'}`, true); + } + + // --- ERC20 Token Balances & Prices --- + const tokenDataPromises = acceptedErc20Tokens.map(async (token) => { + const balancePromise = client.readContract({ + address: token.address, + abi: ERC20, + functionName: 'balanceOf', + args: [account], + }) as Promise; + + const pricePromise = client.readContract({ + address: vaultPriceFeedAddress, // Use network-specific price feed + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [token.address, false, true, false], + }) as Promise; + + // Process results + const [balance, price] = await Promise.all([balancePromise, pricePromise]); + + // Price is in 1e30, balance in token decimals, result should be in USD (1e30) + const balanceUsd = (balance * price) / BigInt(10 ** token.decimals); + + return { + symbol: token.symbol, + address: token.address, + decimals: token.decimals, + balance: formatUnits(balance, token.decimals), + balanceUsd: formatUnits(balanceUsd, 30), + price: formatUnits(price, 30), + }; + }); + + // Wait for all token data to be fetched + const tokenResults = await Promise.all(tokenDataPromises); + tokenInfos.push(...tokenResults); + + // Calculate total balance in USD + const totalBalanceUsd = tokenInfos.reduce((sum, token) => { + // Ensure balanceUsd is treated as a number + return sum + safeToNumber(token.balanceUsd); + }, 0); + + return toResult( + JSON.stringify({ + tokens: tokenInfos, + totalBalanceUsd: totalBalanceUsd.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), + }), + ); + } catch (error) { + return toResult(`Failed to get token balances on ${network}: ${error instanceof Error ? error.message : 'Unknown error'}`, true); + } +} diff --git a/projects/amped/src/functions/liquidity/index.ts b/projects/amped/src/functions/liquidity/index.ts new file mode 100644 index 00000000..06c13eaa --- /dev/null +++ b/projects/amped/src/functions/liquidity/index.ts @@ -0,0 +1,8 @@ +export * from './getALPAPR.js'; +export * from './getEarnings.js'; +export * from './claimRewards.js'; +export * from './addLiquidity.js'; +export * from './removeLiquidity.js'; +export * from './getUserLiquidity.js'; +export * from './getPoolLiquidity.js'; +export * from './getUserTokenBalances.js'; diff --git a/projects/amped/src/functions/liquidity/removeLiquidity.ts b/projects/amped/src/functions/liquidity/removeLiquidity.ts new file mode 100644 index 00000000..d81ea5f2 --- /dev/null +++ b/projects/amped/src/functions/liquidity/removeLiquidity.ts @@ -0,0 +1,327 @@ +import { parseUnits, encodeFunctionData, formatUnits, Address, type TransactionReceipt } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM, TransactionParams } from '@heyanon/sdk'; +const { getChainFromName } = EVM.utils; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../constants.js'; +import { RewardRouter } from '../../abis/RewardRouter.js'; +import { getUserLiquidity } from './getUserLiquidity.js'; +import { getPoolLiquidity } from './getPoolLiquidity.js'; +import { decodeEventLog } from 'viem'; +import { TokenSymbol, getTokenAddress } from '../../utils.js'; + +interface Props { + chainName: 'sonic' | 'base'; + account: Address; + tokenOutSymbol: TokenSymbol; + amount: string; + slippageTolerance?: number; + skipSafetyChecks?: boolean; +} + +/** + * Removes liquidity from the ALP pool + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to remove liquidity for + * @param props.tokenOutSymbol - The symbol of the token to receive when removing liquidity (e.g., "S", "USDC") + * @param props.amount - The amount of ALP to remove in decimal format + * @param props.slippageTolerance - Optional slippage tolerance in percentage (default: 0.5) + * @param props.skipSafetyChecks - Optional flag to skip liquidity checks (default: false) + * @param options - System tools for blockchain interactions + * @returns Transaction result with removal details + */ +export async function removeLiquidity( + { chainName, account, tokenOutSymbol, amount, slippageTolerance = 0.5, skipSafetyChecks = false }: Props, + options: FunctionOptions, +): Promise { + const { notify, getProvider, evm } = options; + const sendTransactions = evm?.sendTransactions || options.sendTransactions; + // Check wallet connection + if (!account) return toResult('Wallet not connected', true); + + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + + if (chainId !== SupportedChain.SONIC) { + return toResult(`Protocol is only supported on Sonic chain`, true); + } + + const currentNetworkContracts = CONTRACT_ADDRESSES[chainId]; + const networkName = chainName.toLowerCase(); + + try { + const publicClient = getProvider(chainId); + + // Resolve tokenOutSymbol to an address and determine if it's native + const isNativeRedemption = (chainId === SupportedChain.SONIC && tokenOutSymbol === 'S'); + + let tokenOutAddressContract: Address; + let addressForPoolLookup: Address; + + if (isNativeRedemption) { + addressForPoolLookup = currentNetworkContracts.WRAPPED_NATIVE_TOKEN; + tokenOutAddressContract = currentNetworkContracts.NATIVE_TOKEN; + } else { + const resolvedAddress = getTokenAddress(tokenOutSymbol, networkName); + if (!resolvedAddress) { + return toResult(`Token symbol ${tokenOutSymbol} not found or not supported on ${networkName}.`, true); + } + tokenOutAddressContract = resolvedAddress; + addressForPoolLookup = resolvedAddress; + } + + // Validate amount format + const parsedAmount = parseFloat(amount); + if (isNaN(parsedAmount) || parsedAmount <= 0) { + return toResult('Amount must be greater than zero', true); + } + + // Convert amount to wei with safe conversion + const amountInWei = parseUnits(parsedAmount.toString(), 18); + + // Get token decimals + const decimals = 18; // All tokens in the protocol use 18 decimals + let minOutInTokenWei: bigint; + + if (!skipSafetyChecks) { + // First check user's available ALP balance + const userLiquidityResult = await getUserLiquidity( + { + chainName: chainName, + account, + }, + { getProvider, notify, sendTransactions }, + ); + + if (!userLiquidityResult.success || !userLiquidityResult.data) { + return userLiquidityResult; + } + + const userLiquidity = JSON.parse(userLiquidityResult.data); + if (!userLiquidity || !userLiquidity.availableAmount) { + return toResult('Invalid user liquidity data returned', true); + } + + const userAvailableAmount = parseUnits(userLiquidity.availableAmount, 18); + + if (amountInWei > userAvailableAmount) { + return toResult(`Insufficient available ALP. Requested: ${amount}, Available: ${userLiquidity.availableAmount}`, true); + } + + // Then check pool liquidity and calculate minOut based on current price + const poolLiquidityResult = await getPoolLiquidity( + { + chainName: chainName, + publicClient + }, + { getProvider, notify, sendTransactions } + ); + if (!poolLiquidityResult.success || !poolLiquidityResult.data) { + return poolLiquidityResult; + } + + const poolData = JSON.parse(poolLiquidityResult.data); + if (!poolData || !poolData.aum || !poolData.totalSupply) { + return toResult('Invalid pool data returned', true); + } + + const glpPrice = Number(poolData.aum) / Number(poolData.totalSupply); + if (isNaN(glpPrice)) { + return toResult('Invalid GLP price calculation', true); + } + + const amountUsd = parsedAmount * glpPrice; + + // Get token price and available liquidity + const tokenInfo = poolData.tokens.find((t: any) => { + if (!t || !t.address) return false; + return t.address.toLowerCase() === addressForPoolLookup.toLowerCase(); + }); + + if (!tokenInfo || !tokenInfo.price || !tokenInfo.availableAmount) { + return toResult(`Token details for symbol ${tokenOutSymbol} (address ${addressForPoolLookup}) not found in pool`, true); + } + + const tokenPriceFormatted = Number(tokenInfo.price); + const tokenAvailableFormatted = Number(tokenInfo.availableAmount); + + if (isNaN(tokenPriceFormatted) || isNaN(tokenAvailableFormatted)) { + return toResult('Invalid token price or available amount', true); + } + + // Calculate minOut with slippage tolerance + const minOutAmount = (amountUsd / tokenPriceFormatted) * (1 - slippageTolerance / 100); + minOutInTokenWei = parseUnits(minOutAmount.toFixed(decimals), decimals); + + // Check if pool has enough available liquidity + if (minOutAmount > tokenAvailableFormatted) { + return toResult(`Insufficient pool liquidity for ${tokenOutSymbol}. ` + + `Required: ${minOutAmount.toFixed(decimals)}, Available: ${tokenAvailableFormatted}`, true); + } + + // Additional safety check for extreme price impact + const priceImpact = (minOutAmount / tokenAvailableFormatted) * 100; + if (priceImpact > 10) { + return toResult( + `Removal amount too large for ${tokenOutSymbol} - would cause significant price impact (${priceImpact.toFixed(2)}%). ` + + `Consider reducing the amount or splitting into multiple transactions.`, + true, + ); + } + } else { + // If skipping safety checks, use a default minOut based on amount and slippage + const minOutAmount = parsedAmount * (1 - slippageTolerance / 100); + minOutInTokenWei = parseUnits(minOutAmount.toFixed(decimals), decimals); + } + + // Prepare transaction based on output token type + const tx: TransactionParams = { + target: currentNetworkContracts.REWARD_ROUTER, + data: isNativeRedemption + ? encodeFunctionData({ + abi: RewardRouter, + functionName: 'unstakeAndRedeemGlpETH', + args: [amountInWei, minOutInTokenWei, account], + }) + : encodeFunctionData({ + abi: RewardRouter, + functionName: 'unstakeAndRedeemGlp', + args: [tokenOutAddressContract, amountInWei, minOutInTokenWei, account], + }), + }; + + // Send transaction + const sendTxInitialResult = await sendTransactions({ + chainId, + account, + transactions: [tx], + }); + + if (!sendTxInitialResult.data?.[0]?.hash) { + // Use a more generic error message if sendTxInitialResult.data itself is the error string + const errorMessage = typeof sendTxInitialResult.data === 'string' + ? sendTxInitialResult.data + : 'Transaction failed: No transaction hash returned'; + return toResult(errorMessage, true); + } + + const txHash = sendTxInitialResult.data[0].hash; + // Get transaction receipt with retry logic + let receipt: TransactionReceipt | null = null; + let attempts = 0; + const maxAttempts = 5; + const retryDelayMs = 3000; + + while (attempts < maxAttempts) { + try { + receipt = await publicClient.getTransactionReceipt({ hash: txHash }); + if (receipt) { + break; // Exit loop if receipt is found + } + } catch (e) { + // Log error during attempts, but continue retrying + } + attempts++; + if (attempts < maxAttempts) { + await new Promise(resolve => setTimeout(resolve, retryDelayMs)); + } + } + + if (!receipt) { + return toResult( + JSON.stringify({ + success: true, // Transaction was sent + hash: txHash, + details: { + amount: formatUnits(amountInWei, 18), + tokenOutSymbol, + minOut: formatUnits(minOutInTokenWei, decimals), + warning: `Transaction sent (${txHash}), but receipt could not be fetched after ${maxAttempts} attempts.` + }, + }), + ); + } + + if (receipt.status !== 'success') { + return toResult(`Transaction ${txHash} failed with status: ${receipt.status}`, true); + } + + const removeLiquidityEvents = receipt.logs.filter(log => { + return log.address.toLowerCase() === currentNetworkContracts.GLP_MANAGER.toLowerCase() && + log.topics[0] === '0x87b9679bb9a4944bafa98c267e7cd4a00ab29fed48afdefae25f0fca5da27940'; // Updated Event Signature Hash from SonicScan + }); + + if (removeLiquidityEvents.length === 0) { + return toResult( + JSON.stringify({ + success: true, + hash: txHash, + details: { + amount: formatUnits(amountInWei, 18), + tokenOutSymbol, + minOut: formatUnits(minOutInTokenWei, decimals), + warning: 'Could not parse RemoveLiquidity event from transaction receipt' + }, + }), + ); + } + + // Parse the event data + const eventData = removeLiquidityEvents[0]; + const decodedEvent = decodeEventLog({ + abi: [{ + anonymous: false, + inputs: [ + { indexed: false, name: 'account', type: 'address' }, + { indexed: false, name: 'token', type: 'address' }, + { indexed: false, name: 'glpAmount', type: 'uint256' }, + { indexed: false, name: 'aumInUsdg', type: 'uint256' }, + { indexed: false, name: 'glpSupply', type: 'uint256' }, + { indexed: false, name: 'usdgAmount', type: 'uint256' }, + { indexed: false, name: 'amountOut', type: 'uint256' } + ], + name: 'RemoveLiquidity', + type: 'event' + }], + data: eventData.data, + topics: eventData.topics + }); + + // Verify the event data matches our expectations + if (decodedEvent.args.account.toLowerCase() !== account.toLowerCase() || + decodedEvent.args.token.toLowerCase() !== addressForPoolLookup.toLowerCase() || + decodedEvent.args.glpAmount !== amountInWei) { + return toResult( + `Remove liquidity event validation failed. Expected account ${account}, token ${addressForPoolLookup}, and amount ${amountInWei}, but got account ${decodedEvent.args.account}, token ${decodedEvent.args.token}, and amount ${decodedEvent.args.glpAmount}`, + true + ); + } + + // Verify the amount received is not less than minOut + if (decodedEvent.args.amountOut < minOutInTokenWei) { + return toResult( + `Received amount ${decodedEvent.args.amountOut} is less than minimum expected ${minOutInTokenWei}`, + true + ); + } + + // Return data with all numeric values as strings + return toResult( + JSON.stringify({ + success: true, + hash: txHash, + details: { + amount: formatUnits(amountInWei, 18), + tokenOutSymbol, + minOut: formatUnits(minOutInTokenWei, decimals), + amountReceived: formatUnits(decodedEvent.args.amountOut, decimals), + }, + }), + ); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to remove liquidity: ${error.message}`, true); + } + return toResult('Failed to remove liquidity: Unknown error', true); + } +} diff --git a/projects/amped/src/functions/liquidity/types.ts b/projects/amped/src/functions/liquidity/types.ts new file mode 100644 index 00000000..a1988171 --- /dev/null +++ b/projects/amped/src/functions/liquidity/types.ts @@ -0,0 +1,35 @@ +import { Address } from 'viem'; + +/** + * Base properties for liquidity operations + * @property {string} chainName - The name of the chain to operate on + * @property {Address} account - The user's account address + * @property {string} amount - The amount to process + */ +export interface BaseLiquidityProps { + chainName: 'sonic' | 'base'; + account: Address; + amount: string; +} + +/** + * Properties for adding liquidity to the GLP pool + * @extends {BaseLiquidityProps} + * @property {Address} tokenIn - The token address to provide as liquidity + * @property {string} [minOut] - The minimum amount of GLP to receive (optional, will be calculated if not provided) + */ +export interface AddLiquidityProps extends BaseLiquidityProps { + tokenIn: Address; + minOut?: string; +} + +/** + * Properties for removing liquidity from the GLP pool + * @extends {BaseLiquidityProps} + * @property {Address} tokenOut - The token address to receive when removing liquidity + * @property {string} minOut - The minimum amount to receive when removing liquidity + */ +export interface RemoveLiquidityProps extends BaseLiquidityProps { + tokenOut: Address; + minOut: string; +} diff --git a/projects/amped/src/functions/trading/leverage/closePosition.ts b/projects/amped/src/functions/trading/leverage/closePosition.ts new file mode 100644 index 00000000..bae3431c --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/closePosition.ts @@ -0,0 +1,154 @@ +import { type Address, encodeFunctionData, parseEther, parseUnits } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../../constants.js'; +import { PositionRouter } from '../../../abis/PositionRouter.js'; +import { getAllOpenPositions } from './getAllOpenPositions.js'; +import { VaultPriceFeed } from '../../../abis/VaultPriceFeed.js'; + +export interface Props { + chainName: 'sonic' | 'base'; + account: string; + indexToken?: string; + collateralToken?: string; + isLong?: boolean; + sizeDelta?: string; + slippageBps?: number; + withdrawETH?: boolean; + callbackTarget?: string; +} + +export const closePosition = async (props: Props, options: FunctionOptions): Promise => { + const { chainName, account, indexToken, collateralToken, isLong, sizeDelta, + slippageBps = 30, withdrawETH = true, callbackTarget = '0x0000000000000000000000000000000000000000' } = props; + + try { + // Get minimum execution fee from contract + const minExecutionFee = await options.evm.getProvider(146).readContract({ + address: CONTRACT_ADDRESSES[SupportedChain.SONIC].POSITION_ROUTER, + abi: PositionRouter, + functionName: 'minExecutionFee', + }) as bigint; + + // Get all open positions (regardless of long/short if not specified) + const positionsResult = await getAllOpenPositions({ + chainName, + account: account as `0x${string}`, + isLong: isLong ?? true // Temporary value to get all positions + }, options); + + if (!positionsResult.success || !positionsResult.data) { + throw new Error('Failed to get open positions'); + } + + let positions = JSON.parse(positionsResult.data).positions || []; + + // Filter positions based on input parameters + if (indexToken) { + positions = positions.filter((p: any) => + p.indexToken.toLowerCase() === indexToken.toLowerCase() || + (p.tokenSymbol === 'S' && + (indexToken.toLowerCase() === CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN.toLowerCase() || + indexToken.toLowerCase() === CONTRACT_ADDRESSES[SupportedChain.SONIC].NATIVE_TOKEN.toLowerCase())) + ); + } + + if (typeof isLong === 'boolean') { + positions = positions.filter((p: any) => p.isLong === isLong); + } + + if (positions.length === 0) { + throw new Error(`No matching positions found${indexToken ? ` for ${indexToken}` : ''}`); + } + + // Notify user about starting to close positions + await options.notify(`Starting to close ${positions.length} position(s)...`); + + const wrappedToken = CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN; + const transactions = []; + const positionSummaries = []; + + for (const position of positions) { + // For path construction: + // 1. If withdrawing to ETH: [TOKEN, WS] for any token (including WETH) + // 2. If not withdrawing to ETH: [TOKEN] single token path + // Note: For WS/S positions, we always use [WS] regardless of withdrawETH + const isWSPosition = position.indexToken.toLowerCase() === CONTRACT_ADDRESSES[SupportedChain.SONIC].NATIVE_TOKEN.toLowerCase() || + position.indexToken.toLowerCase() === CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN.toLowerCase(); + + const path = isWSPosition + ? [CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN] as [`0x${string}`] + : withdrawETH + ? [position.indexToken, CONTRACT_ADDRESSES[SupportedChain.SONIC].WRAPPED_NATIVE_TOKEN] as [`0x${string}`, `0x${string}`] + : [position.indexToken] as [`0x${string}`]; + + // Store position summary for later notification + positionSummaries.push({ + tokenSymbol: position.tokenSymbol, + size: position.position.size, + collateral: position.position.collateral, + collateralSymbol: position.collateralSymbol, + type: position.isLong ? 'Long' : 'Short' + }); + + // Get current price from Vault Price Feed + const currentPrice = await options.evm.getProvider(146).readContract({ + address: CONTRACT_ADDRESSES[SupportedChain.SONIC].VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [position.indexToken.toLowerCase() === CONTRACT_ADDRESSES[SupportedChain.SONIC].NATIVE_TOKEN.toLowerCase() ? wrappedToken : position.indexToken as `0x${string}`, false, !position.isLong, true], + }) as bigint; + + // Use consistent slippage approach (0.3% for both open and close) + // For long positions: acceptablePrice = price * (1 - slippage) when closing + // For short positions: acceptablePrice = price * (1 + slippage) when closing + const slippageFactor = position.isLong ? (10000n - BigInt(slippageBps)) : (10000n + BigInt(slippageBps)); + const acceptablePrice = (currentPrice * slippageFactor) / 10000n; + + // Encode the transaction data + const data = encodeFunctionData({ + abi: PositionRouter, + functionName: 'createDecreasePosition', + args: [ + path, // _path + position.indexToken as `0x${string}`, // _indexToken + 0n, // _collateralDelta (0 for full close) + parseUnits(position.position.size, 30), // _sizeDelta (full position size) + position.isLong, // _isLong + account as `0x${string}`, // _receiver + acceptablePrice, // _acceptablePrice + 0n, // _minOut + minExecutionFee, // _executionFee + withdrawETH, // _withdrawETH + callbackTarget as `0x${string}` // _callbackTarget + ], + }); + + transactions.push({ + target: CONTRACT_ADDRESSES[SupportedChain.SONIC].POSITION_ROUTER as `0x${string}`, + data, + value: minExecutionFee + }); + } + + // Notify summary of positions being closed + const summaryMessage = positionSummaries.map((pos, index) => + ` ${index + 1}. ${pos.tokenSymbol} ${pos.type}: ${pos.size} USD (${pos.collateral} ${pos.collateralSymbol})` + ).join('\n'); + + await options.notify(`\nClosing positions:\n${summaryMessage}\n\nExecution fee: ${minExecutionFee.toString()} wei per position`); + + // Send the transactions + const result = await options.evm.sendTransactions({ + chainId: 146, + account: account as `0x${string}`, + transactions + }); + + return toResult(JSON.stringify(result)); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to close position: ${error.message}`, true); + } + return toResult('Failed to close position: Unknown error', true); + } +}; diff --git a/projects/amped/src/functions/trading/leverage/getAllOpenPositions.ts b/projects/amped/src/functions/trading/leverage/getAllOpenPositions.ts new file mode 100644 index 00000000..83b81298 --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/getAllOpenPositions.ts @@ -0,0 +1,222 @@ +import { CONTRACT_ADDRESSES, SupportedChain } from '../../../constants.js'; +import { FunctionOptions, FunctionReturn, toResult } from '@heyanon/sdk'; +import { getPosition } from './getPosition.js'; +import { getTokenSymbol, type TokenSymbol as UtilTokenSymbol } from '../../../utils/tokens.js'; +import { getChainFromName, getTokenAddress } from '../../../utils.js'; + +interface Props { + chainName: 'sonic' | 'base'; + account: `0x${string}`; +} + +// This interface should match the structure of `position` object returned by `getPosition` +interface PositionFromGetPosition { + size: string; + collateralAmount: string; // Amount of collateral token + collateralUsd: string; // USD value of collateral + averagePrice: string; + currentPrice: string; + entryFundingRate: string; + hasProfit: boolean; + realizedPnl: string; + unrealizedPnlUsd: string; + unrealizedPnlPercentage: string; + leverage: string; + liquidationPrice: string; + lastUpdated: string | null; +} + +interface OpenPosition { + indexToken: `0x${string}`; + collateralToken: `0x${string}`; + isLong: boolean; + position: PositionFromGetPosition; + tokenSymbol: string; + collateralSymbol: string; +} + +interface OpenPositionsResponse { + success: boolean; + positions: OpenPosition[]; + totalPositionValue: string; + totalUnrealizedPnl: string; + totalCollateralValue: string; +} + +/** + * Gets all open perpetual trading positions (long and short) for an account + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to check positions for + * @param options - System tools for blockchain interactions + * @returns Array of all open positions with their details + */ +export async function getAllOpenPositions({ chainName, account }: Props, options: FunctionOptions): Promise { + try { + // Validate chain name exists + if (!chainName) { + return toResult('Chain name is required', true); + } + + // Validate chain using SDK helper + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + const networkName = chainName.toLowerCase(); + if (networkName !== 'sonic' && networkName !== 'base') { + return toResult('This function currently supports Sonic or Base chain for symbol resolution', true); + } + + // Validate account + if (!account || account === '0x0000000000000000000000000000000000000000') { + return toResult('Invalid account address', true); + } + + await options.notify('Fetching all open positions (long and short)...'); + + // Define valid index tokens for positions + const indexTokens = []; + const indexTokenSymbols = ['WS', 'WETH', 'Anon', 'S', 'STS']; + + // Get addresses for all supported index tokens + for (const symbol of indexTokenSymbols) { + try { + const address = getTokenAddress(symbol as any, networkName); + indexTokens.push(address); + } catch (e) { + // Skip tokens that can't be resolved + } + } + + // Define possible collateral tokens for short positions (only stablecoins) + // Get short collateral token addresses from SDK + const shortCollateralTokens = []; + try { + shortCollateralTokens.push(getTokenAddress('USDC', networkName)); + shortCollateralTokens.push(getTokenAddress('scUSD', networkName)); + } catch (e) { + // If tokens not found, continue with empty array + } + + const openPositions: OpenPosition[] = []; + let totalPositionValue = 0; + let totalUnrealizedPnl = 0; + let totalCollateralValue = 0; + + // If no index tokens found, return empty result + if (indexTokens.length === 0) { + const response: OpenPositionsResponse = { + success: true, + positions: [], + totalPositionValue: '0', + totalUnrealizedPnl: '0', + totalCollateralValue: '0', + }; + return toResult(JSON.stringify(response)); + } + + // Iterate for both isLong true (long positions) and isLong false (short positions) + for (const isLongValue of [true, false]) { + // Check each index token + for (const indexToken of indexTokens) { + const currentTokenSymbol = getTokenSymbol(indexToken, networkName); + + const collateralTokensToCheck = isLongValue ? [indexToken] : shortCollateralTokens; + + for (const collateralToken of collateralTokensToCheck) { + const currentCollateralSymbol = getTokenSymbol(collateralToken as `0x${string}`, networkName); + + // Skip if we can't resolve symbols + if (!currentTokenSymbol || !currentCollateralSymbol) { + continue; + } + + let positionResult; + try { + positionResult = await getPosition( + { + chainName, + account, + tokenSymbol: currentTokenSymbol as any, + collateralTokenSymbol: currentCollateralSymbol as any, + isLong: isLongValue, + }, + options, + ); + } catch (err) { + // Skip positions that throw errors + continue; + } + + if (!positionResult.success || !positionResult.data) { + continue; + } + + const positionData = JSON.parse(positionResult.data); + if (positionData.success && positionData.position && Number(positionData.position.size) > 0) { + const position = positionData.position as PositionFromGetPosition; + + openPositions.push({ + indexToken: indexToken as `0x${string}`, + collateralToken: collateralToken as `0x${string}`, + isLong: isLongValue, // Store whether it was a long or short position + position, + tokenSymbol: currentTokenSymbol, + collateralSymbol: currentCollateralSymbol, + }); + + totalPositionValue += Number(position.size); + totalUnrealizedPnl += Number(position.unrealizedPnlUsd); + totalCollateralValue += Number(position.collateralUsd); + } + } + } + } + + if (openPositions.length === 0) { + const response: OpenPositionsResponse = { + success: true, + positions: [], + totalPositionValue: '0', + totalUnrealizedPnl: '0', + totalCollateralValue: '0', + }; + return toResult(JSON.stringify(response)); + } + + // Build consolidated summary message + let summaryMessage = `Found ${openPositions.length} active position(s):\n\n`; + + // Add position details + for (const [index, pos] of openPositions.entries()) { + summaryMessage += `${index + 1}. ${pos.tokenSymbol} ${pos.isLong ? 'LONG' : 'SHORT'}\n`; + summaryMessage += ` Collateral: ${pos.position.collateralAmount} ${pos.collateralSymbol} ($${pos.position.collateralUsd})\n`; + summaryMessage += ` Size: $${pos.position.size} | Leverage: ${pos.position.leverage}x\n`; + summaryMessage += ` Entry: $${pos.position.averagePrice} | Current: $${pos.position.currentPrice}\n`; + summaryMessage += ` PnL: $${pos.position.unrealizedPnlUsd} (${pos.position.unrealizedPnlPercentage}%)\n`; + summaryMessage += ` Liquidation: $${pos.position.liquidationPrice}\n\n`; + } + + // Add portfolio summary + summaryMessage += 'Portfolio Summary:\n'; + summaryMessage += `Total Position Value: $${totalPositionValue.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}\n`; + summaryMessage += `Total Unrealized PnL: $${totalUnrealizedPnl.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}\n`; + summaryMessage += `Total Collateral Value: $${totalCollateralValue.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`; + + await options.notify(summaryMessage); + + const response: OpenPositionsResponse = { + success: true, + positions: openPositions, + totalPositionValue: totalPositionValue.toString(), + totalUnrealizedPnl: totalUnrealizedPnl.toString(), + totalCollateralValue: totalCollateralValue.toString(), + }; + + return toResult(JSON.stringify(response)); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to get all positions: ${error.message}`, true); + } + return toResult('Failed to get all positions: Unknown error', true); + } +} \ No newline at end of file diff --git a/projects/amped/src/functions/trading/leverage/getPerpsLiquidity.ts b/projects/amped/src/functions/trading/leverage/getPerpsLiquidity.ts new file mode 100644 index 00000000..5725e78b --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/getPerpsLiquidity.ts @@ -0,0 +1,190 @@ +import { Address, isAddress, formatUnits } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES } from '../../../constants.js'; +import { Vault } from '../../../abis/Vault.js'; +import { VaultPriceFeed } from '../../../abis/VaultPriceFeed.js'; +import { getTokenAddress, getTokenDecimals, type TokenSymbol } from '../../../utils.js'; +import { getChainFromName } from '../../../utils.js'; + +interface Props { + chainName: 'sonic' | 'base'; + account: Address; + tokenSymbol: TokenSymbol; + isLong: boolean; +} + +interface LiquidityInfo { + maxLeverage: string; + poolAmount: string; + poolAmountUsd: string; + reservedAmount: string; + reservedAmountUsd: string; + availableLiquidity: string; + availableLiquidityUsd: string; + fundingRate: string; + priceUsd: string; +} + +interface LiquidityResponse { + success: boolean; + info: LiquidityInfo; +} + +/** + * Gets perpetual trading liquidity information for a token on Amped Finance + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to check liquidity for + * @param props.tokenSymbol - The token to trade (e.g., WETH, ANON) + * @param props.isLong - Whether this is for a long position + * @param options - System tools for blockchain interactions + * @returns Information about token liquidity and trading parameters + */ +export async function getPerpsLiquidity({ chainName, account, tokenSymbol, isLong }: Props, options: FunctionOptions): Promise { + // Validate chain and get chainId + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + if (!networkContracts || !networkContracts.VAULT || !networkContracts.VAULT_PRICE_FEED) { + return toResult(`Core contract addresses (VAULT, VAULT_PRICE_FEED) not found for network: ${networkName}`, true); + } + + let tokenAddressForContractCall: Address; + let tokenDecimalsValue: number; + let displaySymbol: TokenSymbol = tokenSymbol; // Keep the original symbol for display and messages + + // Define allowed tokens based on chain and isLong + const allowedTokens: Partial> = {}; + if (networkName === 'sonic') { + if (isLong) { + allowedTokens['WETH'] = true; + allowedTokens['Anon'] = true; + allowedTokens['S'] = true; + allowedTokens['STS'] = true; + } else { // Short + allowedTokens['USDC'] = true; + allowedTokens['scUSD'] = true; + } + } else if (networkName === 'base') { + if (isLong) { + allowedTokens['ETH'] = true; + allowedTokens['CBBTC'] = true; + } else { // Short + allowedTokens['USDC'] = true; + } + } + + if (!allowedTokens[tokenSymbol]) { + return toResult(`Token ${tokenSymbol} is not supported for the specified position type (long/short) on ${networkName}.`, true); + } + + try { + // Initial resolution for decimals and basic address. + // The actual address used for contract calls might be overridden for native tokens. + let preliminaryAddress = getTokenAddress(tokenSymbol, networkName); + tokenDecimalsValue = getTokenDecimals(tokenSymbol, networkName); + + // Determine the correct address for Vault operations (especially for native tokens) + if (networkName === 'sonic' && tokenSymbol === 'S') { + if (!networkContracts.WRAPPED_NATIVE_TOKEN) { + return toResult('Wrapped native token (WS) address not found for Sonic chain.', true); + } + tokenAddressForContractCall = networkContracts.WRAPPED_NATIVE_TOKEN; + displaySymbol = 'S'; // Ensure display symbol remains native + } else if (networkName === 'base' && tokenSymbol === 'ETH') { + if (!networkContracts.WRAPPED_NATIVE_TOKEN) { + return toResult('Wrapped native token (WETH) address not found for Base chain.', true); + } + tokenAddressForContractCall = networkContracts.WRAPPED_NATIVE_TOKEN; + displaySymbol = 'ETH'; // Ensure display symbol remains native + } else { + tokenAddressForContractCall = preliminaryAddress; // Use the directly resolved address for other ERC20s + } + + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error'; + return toResult(`Token ${displaySymbol} not supported on ${networkName}: ${errorMessage}`, true); + } + + // Validate addresses (account is already Address type) + if (!isAddress(account) || account === '0x0000000000000000000000000000000000000000') { + return toResult('Invalid account address provided', true); + } + // tokenAddressForContractCall is validated by getTokenAddress, which throws if not found/valid + + await options.notify(`Checking perpetual trading liquidity for ${displaySymbol}...`); + + // Use getProvider from FunctionOptions + const provider = options.getProvider(chainId); + if (!provider) { + return toResult('EVM provider not available. This function requires an EVM provider.', true); + } + + try { + // Get token price first to validate token is supported + const priceResponse = await provider.readContract({ + address: networkContracts.VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [tokenAddressForContractCall, false, true, false], // Use the (potentially wrapped) address + }) as bigint; + + if (priceResponse === 0n) { + return toResult(`No price feed available for ${displaySymbol} (${tokenAddressForContractCall}) on ${networkName}`, true); + } + + // Get pool and reserved amounts + const [poolAmount, reservedAmount] = await Promise.all([ + provider.readContract({ + address: networkContracts.VAULT, + abi: Vault, + functionName: 'poolAmounts', + args: [tokenAddressForContractCall], + }) as Promise, + provider.readContract({ + address: networkContracts.VAULT, + abi: Vault, + functionName: 'reservedAmounts', + args: [tokenAddressForContractCall], + }) as Promise, + ]); + + const availableLiquidity = poolAmount - reservedAmount; + + // Calculate USD values using tokenDecimalsValue + const divisorForUsd = BigInt(10 ** (tokenDecimalsValue + 30)); + + const poolAmountUsd = (poolAmount * priceResponse) / divisorForUsd; + const reservedAmountUsd = (reservedAmount * priceResponse) / divisorForUsd; + const availableLiquidityUsd = (availableLiquidity * priceResponse) / divisorForUsd; + + const liquidityInfo: LiquidityInfo = { + maxLeverage: '50', + poolAmount: formatUnits(poolAmount, tokenDecimalsValue), + poolAmountUsd: formatUnits(poolAmountUsd, 0), // USD values are now effectively in USD units (no decimals) + reservedAmount: formatUnits(reservedAmount, tokenDecimalsValue), + reservedAmountUsd: formatUnits(reservedAmountUsd, 0), + availableLiquidity: formatUnits(availableLiquidity, tokenDecimalsValue), + availableLiquidityUsd: formatUnits(availableLiquidityUsd, 0), + fundingRate: '0', + priceUsd: formatUnits(priceResponse, 30), + }; + + const response: LiquidityResponse = { + success: true, + info: liquidityInfo, + }; + + return toResult(JSON.stringify(response)); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to get perpetual trading liquidity for ${displaySymbol} on ${networkName}: ${error.message}`, true); + } + return toResult(`Failed to get perpetual trading liquidity for ${displaySymbol} on ${networkName}: Unknown error`, true); + } +} diff --git a/projects/amped/src/functions/trading/leverage/getPosition.ts b/projects/amped/src/functions/trading/leverage/getPosition.ts new file mode 100644 index 00000000..9b1dc771 --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/getPosition.ts @@ -0,0 +1,206 @@ +import { type PublicClient, formatUnits } from 'viem'; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../../constants.js'; +import { Vault } from '../../../abis/Vault.js'; +import { VaultPriceFeed } from '../../../abis/VaultPriceFeed.js'; +import { FunctionOptions, FunctionReturn, toResult } from '@heyanon/sdk'; +import { getChainFromName, getTokenDecimals as sdkGetTokenDecimals, getTokenAddress, type TokenSymbol } from '../../../utils.js'; +import { getTokenSymbol } from '../../../utils/tokens.js'; + +interface Props { + chainName: string; + account: `0x${string}`; + tokenSymbol: TokenSymbol; + collateralTokenSymbol: TokenSymbol; + isLong: boolean; +} + +interface Position { + size: string; + collateralAmount: string; + collateralUsd: string; + averagePrice: string; + currentPrice: string; + entryFundingRate: string; + hasProfit: boolean; + realizedPnl: string; + unrealizedPnlUsd: string; + unrealizedPnlPercentage: string; + leverage: string; + liquidationPrice: string; + lastUpdated: string | null; +} + +interface PositionResponse { + success: boolean; + position: Position; + indexTokenAddress?: `0x${string}`; + collateralTokenAddress?: `0x${string}`; +} + +/** + * Gets information about a specific perpetual trading position + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address to check position for + * @param props.tokenSymbol - The symbol of the token being traded (e.g., WETH, ANON) + * @param props.collateralTokenSymbol - The symbol of the token used as collateral + * @param props.isLong - Whether this is a long position + * @param options - System tools for blockchain interactions + * @returns Detailed information about the position including size, collateral, PnL, etc. + */ +export async function getPosition({ chainName, account, tokenSymbol, collateralTokenSymbol, isLong }: Props, { notify, getProvider }: FunctionOptions): Promise { + try { + const networkName = chainName.toLowerCase(); + // Validate chain using SDK helper + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + if (chainId !== SupportedChain.SONIC) { + return toResult('This function is only supported on Sonic chain', true); + } + + const provider = getProvider(chainId); + + // Get token addresses from symbols + const indexToken = getTokenAddress(tokenSymbol, chainName); + const collateralToken = getTokenAddress(collateralTokenSymbol, chainName); + + // Get raw position data + const positionRaw = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].VAULT, + abi: Vault, + functionName: 'getPosition', + args: [account, collateralToken, indexToken, isLong], + }) as [bigint, bigint, bigint, bigint, bigint, bigint, boolean, bigint]; + + await notify('Raw position data (size, collateralValueUsd, avgPrice, entryFunding, reserveAmount, realizedPnl, hasProfit, lastUpdated):'); + await notify(JSON.stringify(positionRaw.map(val => typeof val === 'bigint' ? val.toString() : val))); + + await notify('Fetching current price (index token)...'); + const currentPriceRaw = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [indexToken, false, true, false], + }) as bigint; + + if (currentPriceRaw === 0n) { + return toResult('Invalid price data for index token: price is zero', true); + } + + await notify('Fetching collateral token price...'); + const collateralPriceRaw = await provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [collateralToken, false, true, false], + }) as bigint; + + if (collateralPriceRaw === 0n && collateralToken.toLowerCase() !== CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN?.toLowerCase()) { + return toResult(`Invalid price data for collateral token ${collateralToken}: price is zero`, true); + } + + if (!positionRaw || positionRaw.length < 8) { + return toResult('Invalid position data returned from contract', true); + } + + const [sizeUsd_raw, collateralUsd_raw, avgPrice_raw, entryFunding_raw, reserveAmount_raw, realizedPnl_raw, hasProfit_raw, lastUpdated_raw] = positionRaw; + + if ([sizeUsd_raw, collateralUsd_raw, avgPrice_raw, entryFunding_raw, reserveAmount_raw, realizedPnl_raw].some(val => val === undefined)) { + return toResult('Invalid position values (undefined) returned from contract', true); + } + + const sizeUsdStr = formatUnits(sizeUsd_raw, 30); + const collateralUsdStr = formatUnits(collateralUsd_raw, 30); + const avgPriceStr = formatUnits(avgPrice_raw, 30); + const currentPriceStr = formatUnits(currentPriceRaw, 30); + const realizedPnlStr = formatUnits(realizedPnl_raw, 30); + + // Calculate collateral token amount + let collateralTokenAmountStr = '0'; + let collateralDecimals = 18; + if (collateralToken.toLowerCase() === CONTRACT_ADDRESSES[chainId].WETH?.toLowerCase()) { + collateralDecimals = 18; + } else if (collateralToken.toLowerCase() === CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN?.toLowerCase()) { + collateralDecimals = 18; + } else if (collateralToken.toLowerCase() === CONTRACT_ADDRESSES[chainId].USDC?.toLowerCase()) { + collateralDecimals = 6; + } + + if (collateralPriceRaw > 0n) { + const collateralAmountBigInt = (collateralUsd_raw * BigInt(10 ** collateralDecimals)) / collateralPriceRaw; + collateralTokenAmountStr = formatUnits(collateralAmountBigInt, collateralDecimals); + } + + let unrealizedPnlUsdStr = '0'; + let unrealizedPnlPercentageStr = '0'; + let leverageStr = '0'; + let liquidationPriceStr = '0'; + + if (sizeUsd_raw > 0n) { + const priceDelta_raw = isLong ? currentPriceRaw - avgPrice_raw : avgPrice_raw - currentPriceRaw; + + if (avgPrice_raw > 0n) { + const pnlBigInt = (sizeUsd_raw * priceDelta_raw) / avgPrice_raw; + unrealizedPnlUsdStr = formatUnits(pnlBigInt, 30); + + if (collateralUsd_raw > 0n) { + const percentage = (pnlBigInt * BigInt(100) * BigInt(10**30)) / collateralUsd_raw; + unrealizedPnlPercentageStr = formatUnits(percentage, 30); + } + } + + if (collateralUsd_raw > 0n) { + const leverageBigInt = (sizeUsd_raw * BigInt(10**30)) / collateralUsd_raw; + leverageStr = formatUnits(leverageBigInt, 30); + } + + const numericLeverage = parseFloat(leverageStr); + if (numericLeverage > 0) { + if (sizeUsd_raw > 0n) { + const maintenanceMarginFraction = BigInt(8000); + if (isLong) { + const priceDropToLiquidate = (collateralUsd_raw * avgPrice_raw) / sizeUsd_raw; + const liqPriceRaw = avgPrice_raw - priceDropToLiquidate; + liquidationPriceStr = formatUnits(liqPriceRaw, 30); + } else { + const priceRiseToLiquidate = (collateralUsd_raw * avgPrice_raw) / sizeUsd_raw; + const liqPriceRaw = avgPrice_raw + priceRiseToLiquidate; + liquidationPriceStr = formatUnits(liqPriceRaw, 30); + } + } + } + } + + const formattedPosition: Position = { + size: sizeUsdStr, + collateralAmount: collateralTokenAmountStr, + collateralUsd: collateralUsdStr, + averagePrice: avgPriceStr, + currentPrice: currentPriceStr, + entryFundingRate: entryFunding_raw.toString(), + hasProfit: hasProfit_raw, + realizedPnl: realizedPnlStr, + unrealizedPnlUsd: unrealizedPnlUsdStr, + unrealizedPnlPercentage: unrealizedPnlPercentageStr, + leverage: leverageStr, + liquidationPrice: liquidationPriceStr, + lastUpdated: lastUpdated_raw > 0n ? new Date(Number(lastUpdated_raw) * 1000).toISOString() : null, + }; + + await notify(`Position: ${formattedPosition.size} USD, Leverage: ${formattedPosition.leverage}x, PnL: ${formattedPosition.unrealizedPnlUsd} USD`); + + const response: PositionResponse = { + success: true, + position: formattedPosition, + indexTokenAddress: indexToken as `0x${string}`, + collateralTokenAddress: collateralToken as `0x${string}` + }; + + return toResult(JSON.stringify(response)); + } catch (error) { + if (error instanceof Error) { + return toResult(`Failed to get position: ${error.message}`, true); + } + return toResult('Failed to get position: Unknown error', true); + } +} \ No newline at end of file diff --git a/projects/amped/src/functions/trading/leverage/index.ts b/projects/amped/src/functions/trading/leverage/index.ts new file mode 100644 index 00000000..cb45bc03 --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/index.ts @@ -0,0 +1,5 @@ +export * from './getPerpsLiquidity.js'; +export * from './openPosition.js'; +export * from './getPosition.js'; +export * from './getAllOpenPositions.js'; +export * from './closePosition.js'; diff --git a/projects/amped/src/functions/trading/leverage/openPosition.ts b/projects/amped/src/functions/trading/leverage/openPosition.ts new file mode 100644 index 00000000..58380492 --- /dev/null +++ b/projects/amped/src/functions/trading/leverage/openPosition.ts @@ -0,0 +1,443 @@ +import { type PublicClient, encodeFunctionData, Address, formatUnits, parseUnits } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../../constants.js'; +import { VaultPriceFeed } from '../../../abis/VaultPriceFeed.js'; +import { PositionRouter } from '../../../abis/PositionRouter.js'; +import { ERC20 } from '../../../abis/ERC20.js'; +import { getPerpsLiquidity } from './getPerpsLiquidity.js'; +import { getUserTokenBalances } from '../../liquidity/getUserTokenBalances.js'; +import { type TokenSymbol, getTokenAddress, getTokenDecimals, getSupportedTokens, getChainFromName } from '../../../utils.js'; + +interface Props { + chainName: string; + account: Address; + tokenSymbol: TokenSymbol; + collateralTokenSymbol: TokenSymbol; + isLong: boolean; + sizeUsd: string; + collateralUsd: string; + referralCode?: Address; + slippageBps?: number; +} + +interface PositionValidation { + success: boolean; + error?: string; + details?: { + indexTokenPrice: string; + collateralTokenPrice: string; + leverage: string; + requiredCollateralAmount: bigint; + sizeDelta: bigint; + allowance: bigint; + minExecutionFee: bigint; + indexTokenPriceRaw: bigint; + }; +} + +interface TokenBalance { + symbol: string; + address: Address; + decimals: number; + balance: string; + balanceUsd: string; + price: string; +} + +interface OpenPositionResponse { + success: boolean; + hash: string; + details: { + tokenSymbol: TokenSymbol; + collateralTokenSymbol: TokenSymbol; + isLong: boolean; + sizeUsd: string; + collateralUsd: string; + leverage: string; + positionKey?: string; + collateralDelta?: string; + sizeDelta?: string; + price?: string; + fee?: string; + warning?: string; + }; +} + +async function checkTokenBalance(publicClient: PublicClient, tokenAddress: Address, userAddress: Address, decimals: number = 18): Promise { + try { + const balance = await publicClient.readContract({ + address: tokenAddress, + abi: ERC20, + functionName: 'balanceOf', + args: [userAddress], + }); + + return formatUnits(balance, decimals); + } catch (error) { + return '0'; + } +} + +export async function validateOpenPosition( + publicClient: PublicClient, + params: Props, + userAccountAddress: Address +): Promise { + const { chainName, tokenSymbol, collateralTokenSymbol, isLong } = params; + const chainId = getChainFromName(chainName); + if (!chainId) { + return { success: false, error: `Unsupported chain name: ${chainName}` }; + } + + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + if (!networkContracts || !networkContracts.VAULT_PRICE_FEED || !networkContracts.POSITION_ROUTER || !networkContracts.ROUTER) { + return { success: false, error: `Core contract addresses not found for network: ${networkName}` }; + } + + let indexTokenAddress: Address; + let collateralTokenAddress: Address; + let collateralTokenDecimals: number; + + try { + indexTokenAddress = getTokenAddress(tokenSymbol, networkName); + collateralTokenAddress = getTokenAddress(collateralTokenSymbol, networkName); + collateralTokenDecimals = getTokenDecimals(collateralTokenSymbol, networkName); + + if (!indexTokenAddress) { + return { success: false, error: `Token ${tokenSymbol} not found on ${networkName}` }; + } + if (!collateralTokenAddress) { + return { success: false, error: `Token ${collateralTokenSymbol} not found on ${networkName}` }; + } + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error'; + return { success: false, error: `Failed to resolve token addresses or decimals: ${errorMessage}` }; + } + + try { + const priceReferenceTokenAddress = collateralTokenSymbol === (networkName === 'sonic' ? 'S' : 'ETH') + ? getTokenAddress(networkName === 'sonic' ? 'WS' : 'WETH', networkName) + : collateralTokenAddress; + + const [indexTokenPrice, collateralTokenPrice] = (await Promise.all([ + publicClient.readContract({ + address: networkContracts.VAULT_PRICE_FEED as Address, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [indexTokenAddress, isLong, !isLong, true], + }), + publicClient.readContract({ + address: networkContracts.VAULT_PRICE_FEED as Address, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [priceReferenceTokenAddress, false, true, true], + }), + ])) as [bigint, bigint]; + + const indexTokenPriceStr = formatUnits(indexTokenPrice, 30); + const collateralTokenPriceStr = formatUnits(collateralTokenPrice, 30); + + // Price details logged internally + + const sizeUsdBigInt = parseUnits(params.sizeUsd, 30); + const collateralUsdBigInt = parseUnits(params.collateralUsd, 30); + const leverage = formatUnits(sizeUsdBigInt * BigInt(1e30) / collateralUsdBigInt, 30); + + const requiredCollateralAmount = (collateralUsdBigInt * BigInt(10 ** collateralTokenDecimals)) / collateralTokenPrice; + + const minExecutionFee = await publicClient.readContract({ + address: networkContracts.POSITION_ROUTER as Address, + abi: PositionRouter, + functionName: 'minExecutionFee', + }) as bigint; + + let allowance = 0n; + const nativeSymbolForChain = networkName === 'sonic' ? 'S' : 'ETH'; + if (collateralTokenSymbol !== nativeSymbolForChain) { + allowance = await publicClient.readContract({ + address: collateralTokenAddress, + abi: ERC20, + functionName: 'allowance', + args: [userAccountAddress, networkContracts.ROUTER], + }) as bigint; + } + + return { + success: true, + details: { + indexTokenPrice: indexTokenPriceStr, + collateralTokenPrice: collateralTokenPriceStr, + leverage, + requiredCollateralAmount, + sizeDelta: sizeUsdBigInt, + allowance, + minExecutionFee, + indexTokenPriceRaw: indexTokenPrice, + }, + }; + } catch (error) { + return { success: false, error: `Failed to validate position parameters on ${networkName}` }; + } +} + +async function checkAlternativeLiquidity( + publicClient: PublicClient, + chainName: string, + isLong: boolean, + options: FunctionOptions, + accountAddress: `0x${string}`, +): Promise<{ token: TokenSymbol; address: Address; availableLiquidityUsd: string }[]> { + const networkName = chainName.toLowerCase(); + const supportedTokens = getSupportedTokens(networkName); + + if (!supportedTokens.length) { + return []; + } + + const tradablePerpSymbols: TokenSymbol[] = networkName === 'sonic' + ? (isLong ? ['S', 'Anon', 'WETH', 'STS'] : ['USDC', 'scUSD']) + : (isLong ? ['ETH', 'WETH', 'CBBTC'] : ['USDC']); + + const tokensToCheck = supportedTokens.filter(t => tradablePerpSymbols.includes(t.symbol)); + + const results: { token: TokenSymbol; address: Address; availableLiquidityUsd: string }[] = []; + + for (const token of tokensToCheck) { + try { + const liquidityResult = await getPerpsLiquidity( + { + chainName: chainName, + account: accountAddress, + tokenSymbol: token.symbol, + isLong, + }, + options, + ); + + if (liquidityResult.success) { + const liquidityInfo = JSON.parse(liquidityResult.data); + results.push({ + token: token.symbol, + address: token.address, + availableLiquidityUsd: liquidityInfo.info.availableLiquidityUsd, + }); + } + } catch (e) { + // Skip tokens that fail liquidity check + } + } + return results.sort((a, b) => Number(b.availableLiquidityUsd) - Number(a.availableLiquidityUsd)); +} + +function isPublicClient(client: any): client is PublicClient { + return client && typeof client === 'object' && 'readContract' in client; +} + +/** + * Opens a new perpetual trading position + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address opening the position + * @param props.tokenSymbol - The symbol of the token being traded (e.g., WETH, ANON) + * @param props.collateralTokenSymbol - The symbol of the token used as collateral + * @param props.isLong - Whether this is a long position + * @param props.sizeUsd - The size of the position in USD + * @param props.collateralUsd - The collateral amount in USD + * @param props.referralCode - Optional referral code + * @param props.slippageBps - Optional slippage tolerance in basis points (default: 30) + * @param options - System tools for blockchain interactions + * @returns Transaction result with position opening details + */ +export async function openPosition( + { chainName, account, tokenSymbol, collateralTokenSymbol, isLong, sizeUsd, collateralUsd, referralCode, slippageBps = 30 }: Props, + options: FunctionOptions, +): Promise { + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + if (chainId !== SupportedChain.SONIC) { + return toResult('This function is only supported on Sonic chain', true); + } + + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + const positionRouterAddress = networkContracts.POSITION_ROUTER as Address; + + let indexTokenAddress: Address; + let collateralTokenAddress: Address; + let nativeSymbol: TokenSymbol; + let wrappedNativeAddress: Address; + + try { + indexTokenAddress = getTokenAddress(tokenSymbol, networkName); + collateralTokenAddress = getTokenAddress(collateralTokenSymbol, networkName); + nativeSymbol = 'S' as TokenSymbol; + wrappedNativeAddress = getTokenAddress('WS', networkName); + + if (!indexTokenAddress) { + return toResult(`Token ${tokenSymbol} not found on ${networkName}`, true); + } + if (!collateralTokenAddress) { + return toResult(`Token ${collateralTokenSymbol} not found on ${networkName}`, true); + } + if (!wrappedNativeAddress) { + return toResult(`Wrapped native token not found on ${networkName}`, true); + } + } catch (error) { + const errorMessage = error instanceof Error ? error.message : 'Unknown error'; + return toResult(`Failed to resolve token addresses or decimals: ${errorMessage}`, true); + } + + const publicClient = options.getProvider(chainId) as PublicClient; + if (!publicClient || !isPublicClient(publicClient)) { + return toResult('Public client is not initialized correctly from options.getProvider.', true); + } + + const userAccountAddress = account; + const validateProps: Props = { chainName, account: userAccountAddress, tokenSymbol, collateralTokenSymbol, isLong, sizeUsd, collateralUsd, referralCode, slippageBps }; + + const validation = await validateOpenPosition(publicClient, validateProps, userAccountAddress); + if (!validation.success || !validation.details) { + return toResult(validation.error || 'Position validation failed.', true); + } + + const { requiredCollateralAmount, sizeDelta, minExecutionFee, indexTokenPriceRaw } = validation.details; + + const amountIn = requiredCollateralAmount; + const basisPointsDivisor = BigInt(10000); // 10000 BPS = 100% + const slippageBigInt = BigInt(slippageBps); // Ensure slippageBps is BigInt for calculation + const slippageAmountOffset = (indexTokenPriceRaw * slippageBigInt) / basisPointsDivisor; + + let finalAcceptablePrice: bigint; + if (isLong) { + // For a long, _acceptablePrice is the MAX price we are willing to buy at. + // So, we add the slippage amount to the raw price. + finalAcceptablePrice = indexTokenPriceRaw + slippageAmountOffset; + } else { + // For a short, _acceptablePrice is the MIN price we are willing to sell at. + // So, we subtract the slippage amount from the raw price. + finalAcceptablePrice = indexTokenPriceRaw - slippageAmountOffset; + } + const acceptablePrice = finalAcceptablePrice; + + let data: `0x${string}`; + let value: bigint | undefined = undefined; + + const referralCodeBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000" as `0x${string}`; + + const callbackTargetAddress = "0x0000000000000000000000000000000000000000" as Address; + const minOut = BigInt(0); + + if (collateralTokenSymbol === nativeSymbol) { + const ethPath: readonly Address[] = [wrappedNativeAddress, indexTokenAddress]; + const args = [ + ethPath, + indexTokenAddress, + minOut, + sizeDelta, + isLong, + acceptablePrice, + minExecutionFee, + referralCodeBytes32, + callbackTargetAddress + ] as const; + // Call PositionRouter.createIncreasePositionETH + try { + data = encodeFunctionData({ + abi: PositionRouter, + functionName: 'createIncreasePositionETH', + args: args, + }); + value = amountIn + minExecutionFee; + } catch (error) { + return toResult(`Error encoding createIncreasePositionETH: ${(error as Error).message}`, true); + } + } else { + const erc20Path: readonly Address[] = [collateralTokenAddress, indexTokenAddress]; + const args = [ + erc20Path, + indexTokenAddress, + amountIn, + minOut, + sizeDelta, + isLong, + acceptablePrice, + minExecutionFee, + referralCodeBytes32, + callbackTargetAddress + ] as const; + // Call PositionRouter.createIncreasePosition + try { + data = encodeFunctionData({ + abi: PositionRouter, + functionName: 'createIncreasePosition', + args: args + }); + value = minExecutionFee; + } catch (error) { + return toResult(`Error encoding createIncreasePosition: ${(error as Error).message}`, true); + } + } + + // Prepare transactions + const { checkToApprove } = EVM.utils; + const { sendTransactions, notify } = options; + const transactions: EVM.types.TransactionParams[] = []; + + // Check approval for ERC20 collateral + if (collateralTokenSymbol !== nativeSymbol) { + await checkToApprove({ + args: { + account, + target: collateralTokenAddress, + spender: networkContracts.ROUTER, + amount: amountIn, + }, + provider: publicClient, + transactions, + }); + } + + // Add the position creation transaction + transactions.push({ + target: positionRouterAddress, + data, + value: value?.toString(), + }); + + // Send transactions + const result = await sendTransactions({ + chainId, + account, + transactions, + }); + + if (!result.data?.[0]?.hash) { + return toResult('Transaction failed: No transaction hash returned', true); + } + + const txHash = result.data[0].hash; + await notify(`Position opening initiated. Transaction: ${txHash}`); + + // Return response + const response: OpenPositionResponse = { + success: true, + hash: txHash, + details: { + tokenSymbol, + collateralTokenSymbol, + isLong, + sizeUsd, + collateralUsd, + leverage: validation.details.leverage, + sizeDelta: formatUnits(sizeDelta, 30), + collateralDelta: formatUnits(amountIn, getTokenDecimals(collateralTokenSymbol, networkName)), + price: validation.details.indexTokenPrice, + fee: formatUnits(minExecutionFee, 18), + }, + }; + + return toResult(JSON.stringify(response)); +} diff --git a/projects/amped/src/functions/trading/swaps/getSwapsLiquidity.ts b/projects/amped/src/functions/trading/swaps/getSwapsLiquidity.ts new file mode 100644 index 00000000..61198266 --- /dev/null +++ b/projects/amped/src/functions/trading/swaps/getSwapsLiquidity.ts @@ -0,0 +1,153 @@ +import { type Address, formatUnits, type PublicClient } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SupportedNetwork } from '../../../constants.js'; +import { Vault } from '../../../abis/Vault.js'; +import { getChainFromName } from '../../../utils.js'; + +interface Props { + chainName: 'sonic' | 'base'; + account: Address; + publicClient?: PublicClient; +} + +interface SwapLiquidity { + token: Address; + symbol: string; + poolAmount: string; + reservedAmount: string; + availableAmount: string; + priceUsd: string; + availableUsd: string; +} + +/** + * Gets swap liquidity information for available tokens on a given network + * @param props - The function parameters + * @param props.chainName - The name of the chain (sonic or base) + * @param props.account - The account address (used for context, not directly in logic) + * @param props.publicClient - Viem Public Client for interacting with the blockchain (optional) + * @param options - System tools (like notify) + * @returns Information about token liquidity and their USD values + */ +export async function getSwapsLiquidity( + { chainName, account, publicClient }: Props, + { notify, getProvider }: FunctionOptions +): Promise { + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) { + return toResult(`Network ${chainName} not supported`, true); + } + + // Use lowercase network name for accessing CONTRACT_ADDRESSES keys + const networkName = chainName.toLowerCase(); + const networkContracts = CONTRACT_ADDRESSES[chainId]; + + // Check if contracts for the network exist + if (!networkContracts || !networkContracts.VAULT) { + return toResult(`Contract addresses (including VAULT) not found for network: ${networkName}`, true); + } + const vaultAddress = networkContracts.VAULT; + + // Use publicClient from props if provided, otherwise get it from options + const client = publicClient || getProvider(chainId); + + // Validate client + if (!client) { + return toResult('Failed to get a valid provider for the blockchain', true); + } + + try { + // Define tokens to check based on network + let tokensToCheck: { address: Address; symbol: string; decimals: number }[]; + if (networkName === 'sonic') { + tokensToCheck = [ + { address: networkContracts.ANON, symbol: 'Anon', decimals: 18 }, + { address: networkContracts.WRAPPED_NATIVE_TOKEN, symbol: 'S', decimals: 18 }, + { address: networkContracts.WRAPPED_NATIVE_TOKEN, symbol: 'WS', decimals: 18 }, + { address: networkContracts.USDC, symbol: 'USDC', decimals: 6 }, + { address: networkContracts.WETH, symbol: 'WETH', decimals: 18 }, + { address: networkContracts.STS, symbol: 'STS', decimals: 18 }, + { address: networkContracts.SCUSD, symbol: 'scUSD', decimals: 6 }, + ]; + } else { + tokensToCheck = [ + { address: networkContracts.WRAPPED_NATIVE_TOKEN, symbol: 'ETH', decimals: 18 }, + { address: networkContracts.WRAPPED_NATIVE_TOKEN, symbol: 'WETH', decimals: 18 }, + { address: networkContracts.CBBTC, symbol: 'CBBTC', decimals: 18 }, + { address: networkContracts.USDC, symbol: 'USDC', decimals: 6 }, + { address: networkContracts.VIRTUAL, symbol: 'VIRTUAL', decimals: 18 }, + ]; + } + + await notify(`Checking swap liquidity for ${tokensToCheck.length} tokens on ${networkName}...`); + + // Explicitly type the results array + const liquidityResults: SwapLiquidity[] = []; + + for (const { address, symbol, decimals } of tokensToCheck) { + // Skip if address is somehow undefined (e.g., missing in constants) + if (!address) { + continue; + } + + // Get raw liquidity data + const [poolAmount, reservedAmount, maxPrice] = await Promise.all([ + client.readContract({ + address: vaultAddress, + abi: Vault, + functionName: 'poolAmounts', + args: [address], + }) as Promise, + client.readContract({ + address: vaultAddress, + abi: Vault, + functionName: 'reservedAmounts', + args: [address], + }) as Promise, + client.readContract({ + address: vaultAddress, + abi: Vault, + functionName: 'getMaxPrice', + args: [address], + }) as Promise, + ]); + + // Add null/undefined checks + if (poolAmount === undefined || reservedAmount === undefined || maxPrice === undefined) { + continue; + } + + // Calculate available amount + const availableAmount = poolAmount - reservedAmount; + + // Format values as strings + const formattedPoolAmount = formatUnits(poolAmount, decimals); + const formattedReservedAmount = formatUnits(reservedAmount, decimals); + const formattedAvailableAmount = formatUnits(availableAmount, decimals); + const formattedPriceUsd = formatUnits(maxPrice, 30); + const availableUsdValue = Number(formattedAvailableAmount) * Number(formattedPriceUsd); + + const swapLiquidity: SwapLiquidity = { + token: address, + symbol, + poolAmount: formattedPoolAmount, + reservedAmount: formattedReservedAmount, + availableAmount: formattedAvailableAmount, + priceUsd: formattedPriceUsd, + availableUsd: availableUsdValue.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }), + }; + + liquidityResults.push(swapLiquidity); + } + + return toResult( + JSON.stringify({ + success: true, + liquidity: liquidityResults, + }), + ); + } catch (error) { + return toResult(`Failed to get swap liquidity on ${networkName}: ${error instanceof Error ? error.message : 'Unknown error'}`, true); + } +} diff --git a/projects/amped/src/functions/trading/swaps/index.ts b/projects/amped/src/functions/trading/swaps/index.ts new file mode 100644 index 00000000..3cbaf54e --- /dev/null +++ b/projects/amped/src/functions/trading/swaps/index.ts @@ -0,0 +1,2 @@ +export * from './getSwapsLiquidity.js'; +export * from './marketSwap.js'; diff --git a/projects/amped/src/functions/trading/swaps/marketSwap.ts b/projects/amped/src/functions/trading/swaps/marketSwap.ts new file mode 100644 index 00000000..da3a5d90 --- /dev/null +++ b/projects/amped/src/functions/trading/swaps/marketSwap.ts @@ -0,0 +1,312 @@ +import { Address, encodeFunctionData, formatUnits, parseUnits } from 'viem'; +import { FunctionReturn, FunctionOptions, toResult, EVM } from '@heyanon/sdk'; +import { CONTRACT_ADDRESSES, SupportedChain } from '../../../constants.js'; +import { Router } from '../../../abis/Router.js'; +import { VaultPriceFeed } from '../../../abis/VaultPriceFeed.js'; +import { getUserTokenBalances } from '../../liquidity/getUserTokenBalances.js'; +import { getSwapsLiquidity } from './getSwapsLiquidity.js'; +import { parseEventLogs } from 'viem'; +import { getTokenAddress, getTokenDecimals, getChainFromName, type TokenSymbol } from '../../../utils.js'; + +interface Props { + chainName: string; + account: Address; + tokenIn: TokenSymbol; + tokenOut: TokenSymbol; + amountIn: string; + slippageBps?: number; +} + +interface SwapResult { + success: boolean; + hash: string; + details: { + tokenIn: TokenSymbol; + tokenOut: TokenSymbol; + amountIn: string; + amountOut: string; + amountInUsd: string; + amountOutUsd: string; + priceImpact: string; + executionPrice: string; + minAmountOut: string; + }; +} + +/** + * Executes a market swap between two tokens on Amped Finance + * @param props - The function parameters + * @param props.chainName - The name of the chain (must be "sonic") + * @param props.account - The account address executing the swap + * @param props.tokenIn - Symbol of the token to swap from + * @param props.tokenOut - Symbol of the token to swap to + * @param props.amountIn - Amount of input token to swap (in token decimals) + * @param props.slippageBps - Optional slippage tolerance in basis points (1 bps = 0.01%). Defaults to 100 (1%) + * @param options - System tools for blockchain interactions + * @returns Transaction result with swap details + */ +export async function marketSwap( + { chainName, account, tokenIn, tokenOut, amountIn, slippageBps = 100 }: Props, + options: FunctionOptions, +): Promise { + const { notify, getProvider, evm } = options; + const sendTransactions = evm?.sendTransactions || options.sendTransactions; + + try { + // Validate chain + const chainId = getChainFromName(chainName); + if (!chainId) return toResult(`Unsupported chain name: ${chainName}`, true); + if (chainId !== SupportedChain.SONIC) { + return toResult('This function is only supported on Sonic chain', true); + } + + // Validate slippage + if (slippageBps < 0 || slippageBps > 10000) { + return toResult('Invalid slippage value. Must be between 0 and 10000 basis points', true); + } + + // Get token addresses from token symbols + const networkName = chainName.toLowerCase(); + const tokenInAddressResolved = getTokenAddress(tokenIn, networkName); + const tokenOutAddressResolved = getTokenAddress(tokenOut, networkName); + + if (!tokenInAddressResolved) { + return toResult(`Token ${tokenIn} not found on ${networkName}`, true); + } + if (!tokenOutAddressResolved) { + return toResult(`Token ${tokenOut} not found on ${networkName}`, true); + } + + // Check if tokens are the same + if (tokenInAddressResolved === tokenOutAddressResolved) { + return toResult('Cannot swap token for itself', true); + } + + // Get user's token balances + const balanceResult = await getUserTokenBalances({ chainName, account }, options); + if (!balanceResult.success || !balanceResult.data) { + return toResult('Failed to get token balances', true); + } + + const balanceData = JSON.parse(balanceResult.data); + const tokenInInfo = balanceData.tokens.find((t: any) => t.symbol === tokenIn); + if (!tokenInInfo) { + return toResult(`Token ${tokenIn} not found in user's balance`, true); + } + + // Get token decimals + const tokenInDecimals = getTokenDecimals(tokenIn, networkName); + const tokenOutDecimals = getTokenDecimals(tokenOut, networkName); + + // Parse amount with safe conversion + const amountInValue = parseFloat(amountIn); + if (isNaN(amountInValue) || amountInValue <= 0) { + return toResult('Invalid amount specified', true); + } + + // Convert amount to contract units + const amountInWei = parseUnits(amountIn, tokenInDecimals); + + // Check user's balance + const userBalanceWei = parseUnits(tokenInInfo.balance, tokenInDecimals); + + if (userBalanceWei < amountInWei) { + return toResult( + `Insufficient ${tokenIn} balance. Required: ${amountIn}, Available: ${tokenInInfo.balance}`, + true, + ); + } + + // Check available liquidity + const liquidityResult = await getSwapsLiquidity({ chainName, account }, options); + if (!liquidityResult.success || !liquidityResult.data) { + return toResult('Failed to get swap liquidity', true); + } + + const liquidityData = JSON.parse(liquidityResult.data); + const tokenOutLiquidity = liquidityData.liquidity.find((l: any) => l.symbol === tokenOut); + if (!tokenOutLiquidity) { + return toResult(`No liquidity available for ${tokenOut}`, true); + } + + const provider = getProvider(chainId); + + // Determine the correct addresses for price fetching + const tokenInPriceFeedAddress = tokenIn === 'S' + ? CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN + : tokenInAddressResolved; + const tokenOutPriceFeedAddress = tokenOut === 'S' + ? CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN + : tokenOutAddressResolved; + + // Get token prices + const [tokenInPrice, tokenOutPrice] = await Promise.all([ + provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [tokenInPriceFeedAddress, false, true, true], + }) as Promise, + provider.readContract({ + address: CONTRACT_ADDRESSES[chainId].VAULT_PRICE_FEED, + abi: VaultPriceFeed, + functionName: 'getPrice', + args: [tokenOutPriceFeedAddress, false, true, true], + }) as Promise, + ]); + + if (!tokenInPrice || !tokenOutPrice) { + return toResult('Failed to get token prices', true); + } + + // Calculate expected output with safe conversion + const amountInUsd = (amountInWei * tokenInPrice) / BigInt(10 ** tokenInDecimals); + const expectedAmountOut_normalized18 = (amountInUsd * BigInt(10 ** 18)) / tokenOutPrice; + const minAmountOut_normalized18 = (expectedAmountOut_normalized18 * BigInt(10000 - slippageBps)) / BigInt(10000); + + // Convert minAmountOut to tokenOut's actual decimals + const minAmountOut_actualDecimals = (minAmountOut_normalized18 * BigInt(10 ** tokenOutDecimals)) / BigInt(10 ** 18); + + // Calculate price impact + let priceImpactBps = BigInt(0); + const availableLiquidity_actualUnits = parseUnits(tokenOutLiquidity.availableAmount, tokenOutDecimals); + + if (availableLiquidity_actualUnits > BigInt(0)) { + const expectedAmountOut_actualUnits = (expectedAmountOut_normalized18 * BigInt(10 ** tokenOutDecimals)) / BigInt(10 ** 18); + priceImpactBps = (expectedAmountOut_actualUnits * BigInt(10000)) / availableLiquidity_actualUnits; + } + + // Warn if price impact is high + if (priceImpactBps > BigInt(100)) { // 100 bps = 1% + await notify(`Warning: High price impact (${formatUnits(priceImpactBps, 2)}%). Consider reducing the amount.`); + } + + // Prepare transactions + const { checkToApprove } = EVM.utils; + const transactions: EVM.types.TransactionParams[] = []; + + // Add approval transaction if needed + if (tokenIn !== 'S') { + await checkToApprove({ + args: { + account, + target: tokenInAddressResolved, + spender: CONTRACT_ADDRESSES[chainId].ROUTER, + amount: amountInWei, + }, + provider, + transactions, + }); + } + + // Add swap transaction + const path = tokenIn === 'S' + ? [CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN, tokenOutAddressResolved] + : tokenOut === 'S' + ? [tokenInAddressResolved, CONTRACT_ADDRESSES[chainId].WRAPPED_NATIVE_TOKEN] + : [tokenInAddressResolved, tokenOutAddressResolved]; + + const selectedFunctionName = tokenIn === 'S' + ? 'swapETHToTokens' + : tokenOut === 'S' + ? 'swapTokensToETH' + : 'swap'; + + let swapArgs: any[]; + if (selectedFunctionName === 'swapETHToTokens') { + swapArgs = [path, minAmountOut_actualDecimals, account]; // args: _path, _minOut, _receiver + } else { + // For swapTokensToETH and swap (token-to-token) + swapArgs = [path, amountInWei, minAmountOut_actualDecimals, account]; // args: _path, _amountIn, _minOut, _receiver + } + + const swapData = encodeFunctionData({ + abi: Router, + functionName: selectedFunctionName, + args: swapArgs, + }); + + transactions.push({ + target: CONTRACT_ADDRESSES[chainId].ROUTER, + data: swapData, + value: tokenIn === 'S' ? amountInWei.toString() : undefined, + }); + + // Send transactions + const result = await sendTransactions({ + chainId, + account, + transactions, + }); + + if (!result.data?.[0]?.hash) { + return toResult('Transaction failed: No transaction hash returned', true); + } + + // Get transaction receipt and parse Swap event + const receipt = await provider.getTransactionReceipt({ hash: result.data[0].hash }); + const swapLogs = parseEventLogs({ + abi: [{ + anonymous: false, + inputs: [ + { indexed: false, name: 'account', type: 'address' }, + { indexed: false, name: 'tokenIn', type: 'address' }, + { indexed: false, name: 'tokenOut', type: 'address' }, + { indexed: false, name: 'amountIn', type: 'uint256' }, + { indexed: false, name: 'amountOut', type: 'uint256' }, + { indexed: false, name: 'amountOutAfterFees', type: 'uint256' }, + { indexed: false, name: 'feeBasisPoints', type: 'uint256' } + ], + name: 'Swap', + type: 'event' + }], + eventName: 'Swap', + logs: receipt.logs, + }); + + if (swapLogs.length === 0) { + return toResult( + JSON.stringify({ + success: true, + hash: result.data[0].hash, + details: { + tokenIn, + tokenOut, + amountIn: formatUnits(amountInWei, tokenInDecimals), + amountOut: formatUnits(minAmountOut_actualDecimals, tokenOutDecimals), + amountInUsd: formatUnits(amountInUsd, 30), + amountOutUsd: formatUnits((minAmountOut_actualDecimals * tokenOutPrice) / BigInt(10 ** tokenOutDecimals), 30), + priceImpact: formatUnits(priceImpactBps, 2), + executionPrice: formatUnits((tokenInPrice * BigInt(1e18)) / tokenOutPrice, 18), + minAmountOut: formatUnits(minAmountOut_actualDecimals, tokenOutDecimals), + warning: 'Could not parse Swap event from transaction receipt', + }, + } as SwapResult), + ); + } + + // Get the swap event + const swapEvent = swapLogs[0]; + + // Return data with all numeric values as strings + return toResult( + JSON.stringify({ + success: true, + hash: result.data[0].hash, + details: { + tokenIn, + tokenOut, + amountIn: formatUnits(amountInWei, tokenInDecimals), + amountOut: formatUnits(swapEvent.args.amountOutAfterFees, tokenOutDecimals), + amountInUsd: formatUnits(amountInUsd, 30), + amountOutUsd: formatUnits((swapEvent.args.amountOutAfterFees * tokenOutPrice) / BigInt(10 ** tokenOutDecimals), 30), + priceImpact: formatUnits(priceImpactBps, 2), + executionPrice: formatUnits((tokenInPrice * BigInt(1e18)) / tokenOutPrice, 18), + minAmountOut: formatUnits(minAmountOut_actualDecimals, tokenOutDecimals), + }, + } as SwapResult), + ); + } catch (error) { + return toResult(`Failed to execute swap: ${error instanceof Error ? error.message : 'Unknown error'}`, true); + } +} diff --git a/projects/amped/src/index.ts b/projects/amped/src/index.ts new file mode 100644 index 00000000..93711159 --- /dev/null +++ b/projects/amped/src/index.ts @@ -0,0 +1,11 @@ +// Re-export all functions +export * from './functions/liquidity/index.js'; +export * from './functions/trading/leverage/index.js'; +export * from './functions/trading/swaps/index.js'; + +// Re-export tools +export { tools } from './tools.js'; + +// Re-export constants +export * from './constants.js'; +export * from './utils.js'; \ No newline at end of file diff --git a/projects/amped/src/tools.ts b/projects/amped/src/tools.ts new file mode 100644 index 00000000..91778193 --- /dev/null +++ b/projects/amped/src/tools.ts @@ -0,0 +1,471 @@ +import { AiTool, EVM } from '@heyanon/sdk'; +import { supportedChains } from './constants.js'; + +const { getChainName } = EVM.utils; +import { addLiquidity } from './functions/liquidity/addLiquidity.js'; +import { removeLiquidity } from './functions/liquidity/removeLiquidity.js'; +import { getPerpsLiquidity } from './functions/trading/leverage/getPerpsLiquidity.js'; +import { getPosition } from './functions/trading/leverage/getPosition.js'; +import { getALPAPR } from './functions/liquidity/getALPAPR.js'; +import { getUserTokenBalances } from './functions/liquidity/getUserTokenBalances.js'; +import { getUserLiquidity } from './functions/liquidity/getUserLiquidity.js'; +import { getPoolLiquidity } from './functions/liquidity/getPoolLiquidity.js'; +import { closePosition } from './functions/trading/leverage/closePosition.js'; +import { claimRewards } from './functions/liquidity/claimRewards.js'; +import { getEarnings } from './functions/liquidity/getEarnings.js'; +import { marketSwap } from './functions/trading/swaps/marketSwap.js'; +import { getSwapsLiquidity } from './functions/trading/swaps/getSwapsLiquidity.js'; +import { openPosition } from './functions/trading/leverage/openPosition.js'; +import { getAllOpenPositions } from './functions/trading/leverage/getAllOpenPositions.js'; + +// Helper to generate enum based on supported chains +const supportedChainNames = supportedChains.map(chainId => getChainName(chainId)); + +// Define token enums per chain +const sonicTokens = ['S', 'WS', 'WETH', 'Anon', 'USDC', 'scUSD', 'STS']; +const baseTokens = ['ETH', 'WETH', 'CBBTC', 'USDC', 'VIRTUAL']; +const allTokens = [...new Set([...sonicTokens, ...baseTokens])]; // Combined unique tokens + +// Tool definitions following SDK pattern + +export const tools: AiTool[] = [ + { + name: 'addLiquidity', + description: 'Add liquidity to the protocol by providing tokens in exchange for GLP. You must specify either amount or percentOfBalance.', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address that will execute the transaction', + }, + { + name: 'tokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token to provide as liquidity', + }, + { + name: 'amount', + type: ['string', 'null'], + description: 'Exact amount of tokens to provide as liquidity. Required if percentOfBalance is not provided.', + }, + { + name: 'percentOfBalance', + type: ['number', 'null'], + description: 'Percentage of your token balance to use (1-100). Required if amount is not provided.', + }, + { + name: 'minUsdg', + type: 'string', + description: 'Minimum USDG to receive (e.g., "1.5" for 1.5 USDG). Defaults to "0".', + optional: true + }, + { + name: 'minGlp', + type: 'string', + description: 'Minimum GLP to receive (e.g., "1.5" for 1.5 GLP). Defaults to "0".', + optional: true + }, + ], + required: ['chainName', 'account', 'tokenSymbol'], + }, + { + name: 'removeLiquidity', + description: + 'Remove liquidity from the protocol by redeeming GLP for tokens. For native token (Sonic: S, Base: ETH) redemption, use the NATIVE_TOKEN address from CONTRACT_ADDRESSES for the respective chain. The minimum output amount is calculated automatically based on current prices and slippage tolerance.', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address that will receive the redeemed tokens', + }, + { + name: 'tokenOutSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token to receive when removing liquidity', + }, + { + name: 'amount', + type: 'string', + description: 'Amount of GLP to redeem', + }, + { + name: 'slippageTolerance', + type: 'number', + description: 'Maximum acceptable slippage as a percentage (e.g., 0.5 for 0.5%). Defaults to 0.5%.', + }, + { + name: 'skipSafetyChecks', + type: 'boolean', + description: 'Skip balance and liquidity verification checks', + optional: true, + }, + ], + required: ['chainName', 'account', 'tokenOutSymbol', 'amount', 'slippageTolerance'], + }, + { + name: 'getPerpsLiquidity', + description: 'Get perpetual trading liquidity information for a token, including max leverage, position sizes, and funding rates', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check liquidity for', + }, + { + name: 'tokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token to trade', + }, + { + name: 'isLong', + type: 'boolean', + description: 'Whether to check long or short position liquidity', + }, + ], + required: ['chainName', 'account', 'tokenSymbol', 'isLong'], + }, + { + name: 'getALPAPR', + description: 'Get APR information for ALP (Amped Liquidity Provider) tokens, including base APR and reward rates', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (currently likely Sonic only)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check APR for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'getUserTokenBalances', + description: 'Get balances and USD values of all supported tokens for a specific user', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check token balances for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'getUserLiquidity', + description: "Get user's ALP (Amped Liquidity Provider) information including balance, USD value, and unclaimed rewards", + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (currently likely Sonic only)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check liquidity for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'getPoolLiquidity', + description: 'Get total pool liquidity information including GLP supply and Assets Under Management (AUM)', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + ], + required: ['chainName'], + }, + { + name: 'getPosition', + description: "Get details of a user's perpetual trading position including size, collateral, PnL, and other metrics", + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check position for', + }, + { + name: 'tokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token being traded', + }, + { + name: 'collateralTokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token used as collateral', + }, + { + name: 'isLong', + type: 'boolean', + description: 'Whether this is a long position (true) or short position (false)', + }, + ], + required: ['chainName', 'account', 'tokenSymbol', 'collateralTokenSymbol', 'isLong'], + }, + { + name: 'closePosition', + description: 'Close one or more leveraged positions on Amped Finance. Can close specific positions or all matching positions.', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address that owns the position(s)', + }, + { + name: 'indexToken', + type: 'string', + description: 'Optional address of the token being traded. If not provided, closes positions for all tokens.', + optional: true, + }, + { + name: 'collateralToken', + type: 'string', + description: 'Optional address of the token used as collateral. If not provided, closes positions with any collateral.', + optional: true, + }, + { + name: 'isLong', + type: 'boolean', + description: 'Optional position type. If not provided, closes both long and short positions.', + optional: true, + }, + { + name: 'sizeDelta', + type: 'string', + description: 'Optional amount to close in USD (e.g., "100" for $100). If not provided, closes entire position.', + optional: true, + }, + { + name: 'slippageBps', + type: 'number', + description: 'Slippage tolerance in basis points (1 bps = 0.01%). Defaults to 30.', + }, + { + name: 'withdrawETH', + type: 'boolean', + description: 'Whether to withdraw in native token (S/ETH) instead of wrapped token. Defaults to false.', + optional: true, + }, + ], + required: ['chainName', 'account', 'slippageBps'], + }, + { + name: 'claimRewards', + description: 'Claim earned rewards from providing liquidity to the protocol', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (currently likely Sonic only)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to claim rewards for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'getEarnings', + description: 'Get information about earnings from providing liquidity, including rewards and fees', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (currently likely Sonic only)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check earnings for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'marketSwap', + description: 'Execute a market swap between two tokens', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address executing the swap', + }, + { + name: 'tokenIn', + type: 'string', + enum: allTokens, + description: 'Token symbol to swap from', + }, + { + name: 'tokenOut', + type: 'string', + enum: allTokens, + description: 'Token symbol to swap to', + }, + { + name: 'amountIn', + type: 'string', + description: 'Amount of input token to swap', + }, + { + name: 'slippageBps', + type: 'number', + description: 'Slippage tolerance in basis points (1 bps = 0.01%). Defaults to 100.', + }, + ], + required: ['chainName', 'account', 'tokenIn', 'tokenOut', 'amountIn', 'slippageBps'], + }, + { + name: 'getSwapsLiquidity', + description: 'Get information about available liquidity for token swaps', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check liquidity for', + }, + ], + required: ['chainName', 'account'], + }, + { + name: 'openPosition', + description: 'Open a new perpetuals position with specified parameters. Requires collateral approval if not using native token.', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address initiating the position', + }, + { + name: 'tokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token for the position market', + }, + { + name: 'collateralTokenSymbol', + type: 'string', + enum: allTokens, + description: 'Symbol of the token to use as collateral', + }, + { + name: 'isLong', + type: 'boolean', + description: 'Whether to open a long position (true) or short position (false)', + }, + { + name: 'sizeUsd', + type: 'string', + description: 'Size of the position in USD (minimum $11)', + }, + { + name: 'collateralUsd', + type: 'string', + description: 'Amount of collateral in USD (minimum $10)', + }, + { + name: 'slippageBps', + type: 'number', + description: 'Slippage tolerance in basis points (1 bps = 0.01%). Defaults to 30.', + }, + { + name: 'referralCode', + type: 'string', + description: 'Optional referral code', + optional: true, + }, + ], + required: ['chainName', 'account', 'tokenSymbol', 'collateralTokenSymbol', 'isLong', 'sizeUsd', 'collateralUsd', 'slippageBps'], + }, + { + name: 'getAllOpenPositions', + description: 'Gets all open perpetual trading positions (long and short) for an account', + props: [ + { + name: 'chainName', + type: 'string', + enum: supportedChainNames, + description: 'Name of the blockchain network (sonic or base)', + }, + { + name: 'account', + type: 'string', + description: 'Account address to check positions for', + }, + ], + required: ['chainName', 'account'], + }, +]; diff --git a/projects/amped/src/utils.ts b/projects/amped/src/utils.ts new file mode 100644 index 00000000..7926b5a2 --- /dev/null +++ b/projects/amped/src/utils.ts @@ -0,0 +1,150 @@ +import { CONTRACT_ADDRESSES, SupportedNetwork, SupportedChain } from './constants.js'; +import { type Address } from 'viem'; +import { EVM, type EvmChain } from '@heyanon/sdk'; + +const { getChainFromName: sdkGetChainFromName } = EVM.utils; +// Re-export token utilities from the new tokenList.ts implementation +export { + getTokenAddress, + getTokenDecimals, + getTokenSymbol, + getSupportedTokens, + isTokenSupported, + type TokenSymbol +} from './utils/tokenList.js'; + +// Define supported token symbols across all networks (legacy, use TokenSymbol instead) +export type SupportedToken = + // Sonic + | 'S' + | 'WS' + | 'WETH' // Note: WETH exists on both, but might have different addresses + | 'ANON' + | 'Anon' // Added to match tokenList + | 'USDC' // Note: USDC exists on both, but might have different addresses + | 'STS' // Added STS token + | 'scUSD' // Added scUSD token + // Removed EURC + // Base + | 'ETH' // Base native token + // WETH already included + // USDC already included + | 'CBBTC' + | 'VIRTUAL'; + +// Legacy function - use imported getTokenAddress from utils/tokens.js instead +export function getTokenAddress_legacy(symbol: SupportedToken, network: SupportedNetwork): Address { + const chainId = getChainFromName(network); + if (!chainId) { + throw new Error(`Unsupported network: ${network}`); + } + const networkAddresses = CONTRACT_ADDRESSES[chainId]; + if (!networkAddresses) { + throw new Error(`Unsupported network: ${network}`); + } + + let address: Address | undefined; + + // Handle native token symbols explicitly + if ((network === 'sonic' && symbol === 'S') || (network === 'base' && symbol === 'ETH')) { + address = networkAddresses.NATIVE_TOKEN; + } else { + // Map symbols to contract keys (case-insensitive matching for flexibility) + const upperSymbol = symbol.toUpperCase(); + switch (upperSymbol) { + case 'WS': + address = networkAddresses.WRAPPED_NATIVE_TOKEN; // Sonic specific + break; + case 'WETH': + // Use WRAPPED_NATIVE_TOKEN on Base, WETH on Sonic (based on constants setup) + address = network === 'base' ? networkAddresses.WRAPPED_NATIVE_TOKEN : networkAddresses.WETH; + break; + case 'ANON': + address = networkAddresses.ANON; // Sonic specific + break; + case 'USDC': + address = networkAddresses.USDC; + break; + // Removed EURC case + case 'CBBTC': + address = networkAddresses.CBBTC; // Base specific + break; + case 'VIRTUAL': + address = networkAddresses.VIRTUAL; // Base specific + break; + case 'STS': + address = networkAddresses.STS; // Sonic specific + break; + case 'SCUSD': // For the uppercase conversion of 'scUSD' + address = networkAddresses.SCUSD; // Sonic specific + break; + } + } + + if (!address) { + throw new Error(`Unsupported token symbol "${symbol}" for network "${network}"`); + } + return address; +} + +// Helper function to get native token address for a specific network +export function getNativeTokenAddress(network: SupportedNetwork): Address { + const chainId = getChainFromName(network); + if (!chainId) { + throw new Error(`Unsupported network: ${network}`); + } + const networkAddresses = CONTRACT_ADDRESSES[chainId]; + if (!networkAddresses || !networkAddresses.NATIVE_TOKEN) { + throw new Error(`Native token address not found for network: ${network}`); + } + return networkAddresses.NATIVE_TOKEN; +} + +// Safe type conversion helpers +export function safeToString(value: unknown): string { + if (value === undefined || value === null) return ''; + if (typeof value === 'string') return value; + if (typeof value === 'number' || typeof value === 'bigint' || typeof value === 'boolean') { + return value.toString(); + } + return ''; +} + +export function safeToNumber(value: unknown): number { + if (value === undefined || value === null) return 0; + if (typeof value === 'number') return value; + if (typeof value === 'string') { + const parsed = parseFloat(value); + return isNaN(parsed) ? 0 : parsed; + } + if (typeof value === 'bigint') { + // Safely convert bigint to number, return 0 if too large + try { + return Number(value); + } catch { + return 0; + } + } + return 0; +} + +// Helper function to get chain ID from network name +// Re-export getChainFromName from SDK for backward compatibility +export function getChainFromName(name: string): number | undefined { + try { + return sdkGetChainFromName(name as EvmChain); + } catch { + return undefined; + } +} + +// Helper function to get network name from chain ID +export function getNetworkNameFromChainId(chainId: number): SupportedNetwork | undefined { + if (chainId === SupportedChain.SONIC) { + return 'sonic'; + } + if (chainId === SupportedChain.BASE) { + return 'base'; + } + return undefined; +} \ No newline at end of file diff --git a/projects/amped/src/utils/sdkTokens.ts b/projects/amped/src/utils/sdkTokens.ts new file mode 100644 index 00000000..181e27e2 --- /dev/null +++ b/projects/amped/src/utils/sdkTokens.ts @@ -0,0 +1,102 @@ +/** + * Token utilities using the SDK's token lists + */ + +import { type Address, getAddress } from 'viem'; +import { sonicTokens, baseTokens, Token } from '@real-wagmi/sdk'; +import { EVM } from '@heyanon/sdk'; + +const { NATIVE_ADDRESS } = EVM.constants; + +// Map our token symbols to SDK token keys +const SONIC_TOKEN_MAP: Record = { + 'S': 'native', // Native Sonic + 'WS': 'ws', // Wrapped Sonic + 'WETH': 'weth', // Wrapped ETH on Sonic + 'USDC': 'usdce', // USDC.e on Sonic (SDK key) + 'Anon': 'custom', // Not in SDK, use custom + 'scUSD': 'custom', // Not in SDK, use custom + 'STS': 'custom', // Not in SDK, use custom +}; + +const BASE_TOKEN_MAP: Record = { + 'ETH': 'native', // Native ETH + 'WETH': 'weth', // Wrapped ETH on Base + 'USDC': 'usdc', // USDC on Base + 'CBBTC': 'cbbtc', // If available in SDK + 'VIRTUAL': 'virtual', // If available in SDK +}; + +// Custom tokens not in SDK (fallback) - all addresses are checksummed +const CUSTOM_TOKENS: Record> = { + sonic: { + 'Anon': { address: getAddress('0x79bbF4508B1391af3A0F4B30bb5FC4aa9ab0E07C'), decimals: 18 }, + 'scUSD': { address: getAddress('0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE'), decimals: 6 }, + 'STS': { address: getAddress('0xe5da20f15420ad15de0fa650600afc998bbe3955'), decimals: 18 }, // Beets Staked Sonic + }, + base: { + 'CBBTC': { address: getAddress('0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf'), decimals: 8 }, + 'VIRTUAL': { address: getAddress('0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b'), decimals: 18 }, + } +}; + +/** + * Get token info from SDK or fallback + */ +export function getTokenFromSDK(symbol: string, chainName: string): { address: Address; decimals: number; symbol: string } | null { + const network = chainName.toLowerCase(); + + // Handle native tokens + if ((network === 'sonic' && symbol === 'S') || (network === 'base' && symbol === 'ETH')) { + return { + address: NATIVE_ADDRESS as Address, + decimals: 18, + symbol + }; + } + + // Get SDK token map for the chain + const tokenMap = network === 'sonic' ? SONIC_TOKEN_MAP : BASE_TOKEN_MAP; + const sdkTokens = network === 'sonic' ? sonicTokens : baseTokens; + const sdkKey = tokenMap[symbol]; + + if (sdkKey && sdkKey !== 'native' && sdkTokens[sdkKey]) { + const token = sdkTokens[sdkKey] as Token; + return { + address: token.address as Address, + decimals: token.decimals, + symbol: token.symbol + }; + } + + // Fallback to custom tokens + const customToken = CUSTOM_TOKENS[network]?.[symbol]; + if (customToken) { + return { + ...customToken, + symbol + }; + } + + return null; +} + +/** + * Get all supported tokens for a chain + */ +export function getChainTokens(chainName: string): string[] { + const network = chainName.toLowerCase(); + if (network === 'sonic') { + return Object.keys(SONIC_TOKEN_MAP); + } else if (network === 'base') { + return Object.keys(BASE_TOKEN_MAP); + } + return []; +} + +/** + * Check if a token is supported on a chain + */ +export function isTokenSupportedOnChain(symbol: string, chainName: string): boolean { + return getTokenFromSDK(symbol, chainName) !== null; +} \ No newline at end of file diff --git a/projects/amped/src/utils/tokenList.ts b/projects/amped/src/utils/tokenList.ts new file mode 100644 index 00000000..0bbf15de --- /dev/null +++ b/projects/amped/src/utils/tokenList.ts @@ -0,0 +1,91 @@ +import { type Address } from 'viem'; +import { getTokenFromSDK, getChainTokens, isTokenSupportedOnChain } from './sdkTokens.js'; + +/** + * Supported token symbols across all supported chains + * This is based on the tokens available in the SDK and custom additions + */ +export type TokenSymbol = + // Sonic chain + | 'S' // Sonic native token + | 'WS' // Wrapped Sonic + | 'WETH' // Wrapped Ether on Sonic + | 'Anon' // Anon token + | 'USDC' // USDC on Sonic + | 'scUSD' // Savings-compatible USD + | 'STS' // Beets Staked Sonic + // Base chain + | 'ETH' // ETH native token + | 'CBBTC' // Coinbase Wrapped BTC + | 'VIRTUAL'; // Virtual Protocol token + +/** + * Gets the contract address for a token symbol on a specific chain + * @param symbol - Token symbol to look up + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns The token's contract address + */ +export function getTokenAddress(symbol: TokenSymbol, chainName: string): Address { + const tokenInfo = getTokenFromSDK(symbol, chainName); + + if (!tokenInfo) { + throw new Error(`Token ${symbol} not supported on ${chainName}`); + } + + return tokenInfo.address; +} + +/** + * Gets the token decimals for a token symbol on a specific chain + * @param symbol - Token symbol to look up + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns The number of decimals for the token + */ +export function getTokenDecimals(symbol: TokenSymbol, chainName: string): number { + const tokenInfo = getTokenFromSDK(symbol, chainName); + + if (!tokenInfo) { + // Default decimals if token not found + return symbol === 'USDC' || symbol === 'scUSD' ? 6 : 18; + } + + return tokenInfo.decimals; +} + +/** + * Gets the token symbol from an address on a specific chain + * @param address - Token contract address + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns The token symbol or null if not found + */ +export function getTokenSymbol(address: Address, chainName: string): TokenSymbol | null { + const tokens = getChainTokens(chainName); + + for (const symbol of tokens) { + const tokenInfo = getTokenFromSDK(symbol, chainName); + if (tokenInfo && tokenInfo.address.toLowerCase() === address.toLowerCase()) { + return symbol as TokenSymbol; + } + } + + return null; +} + +/** + * Gets all supported tokens for a specific chain + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns Array of supported token symbols + */ +export function getSupportedTokens(chainName: string): TokenSymbol[] { + return getChainTokens(chainName) as TokenSymbol[]; +} + +/** + * Checks if a token is supported on a specific chain + * @param symbol - Token symbol to check + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns Whether the token is supported + */ +export function isTokenSupported(symbol: string, chainName: string): boolean { + return isTokenSupportedOnChain(symbol, chainName); +} \ No newline at end of file diff --git a/projects/amped/src/utils/tokens.ts b/projects/amped/src/utils/tokens.ts new file mode 100644 index 00000000..02196122 --- /dev/null +++ b/projects/amped/src/utils/tokens.ts @@ -0,0 +1,125 @@ +import { type Address } from 'viem'; +import { CONTRACT_ADDRESSES } from '../constants.js'; +import { getChainFromName } from '../utils.js'; +import { getTokenFromSDK } from './sdkTokens.js'; + +/** + * Supported token symbols across all supported chains + */ +export type TokenSymbol = + | 'S' // Sonic native token + | 'WS' // Wrapped Sonic + | 'WETH' // Wrapped Ethereum + | 'ANON' // Anon token + | 'USDC' // USD Coin + | 'STS' // Sonic Test Stablecoin + | 'scUSD' // Sonic USD + | 'ETH' // Ethereum (Base) + | 'CBBTC' // Coinbase BTC + | 'VIRTUAL'; // Virtual USD + +/** + * Gets the contract address for a token symbol on a specific chain + * @param symbol - Token symbol to look up + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns The token's contract address + */ +export function getTokenAddress(symbol: TokenSymbol, chainName: string): Address { + const networkName = chainName.toLowerCase(); + const chainId = getChainFromName(networkName); + if (!chainId) { + throw new Error(`Unsupported network: ${networkName}`); + } + const contracts = CONTRACT_ADDRESSES[chainId]; + + if (!contracts) { + throw new Error(`Contract addresses not found for network: ${networkName}`); + } + + // Special handling for native and wrapped native tokens + if (symbol === 'S' || (symbol === 'ETH' && networkName === 'base')) { + return contracts.NATIVE_TOKEN; + } + if (symbol === 'WS' || (symbol === 'WETH' && networkName === 'base')) { + return contracts.WRAPPED_NATIVE_TOKEN; + } + + // For other tokens, use SDK + const tokenInfo = getTokenFromSDK(symbol, chainName); + if (tokenInfo) { + return tokenInfo.address; + } + + throw new Error(`Unsupported token symbol: ${symbol} on ${chainName}`); +} + +/** + * Gets the token decimals for a token symbol + * @param symbol - Token symbol to look up + * @returns The number of decimals for the token + */ +export function getTokenDecimals(symbol: TokenSymbol): number { + switch (symbol) { + case 'USDC': + case 'scUSD': + return 6; + case 'CBBTC': + return 8; + case 'S': + case 'WS': + case 'WETH': + case 'ANON': + case 'STS': + case 'ETH': + case 'VIRTUAL': + return 18; + default: + return 18; + } +} + +/** + * Gets the token symbol for an address (reverse lookup) + * @param address - Token address to look up + * @param chainName - The chain name (e.g., "sonic", "base") + * @returns The token symbol or undefined if not found + */ +export function getTokenSymbol(address: Address, chainName: string): TokenSymbol | undefined { + const networkName = chainName.toLowerCase(); + const chainId = getChainFromName(networkName); + if (!chainId) { + return undefined; + } + const contracts = CONTRACT_ADDRESSES[chainId]; + + if (!contracts) { + return undefined; + } + + // Normalize addresses for comparison + const normalizedAddress = address.toLowerCase(); + + // Check native and wrapped native tokens first + if (normalizedAddress === contracts.NATIVE_TOKEN.toLowerCase()) { + return networkName === 'sonic' ? 'S' : 'ETH'; + } + if (normalizedAddress === contracts.WRAPPED_NATIVE_TOKEN.toLowerCase()) { + return networkName === 'sonic' ? 'WS' : 'WETH'; + } + + // Try all supported tokens using SDK + const supportedTokens: TokenSymbol[] = ['WETH', 'ANON', 'USDC', 'STS', 'scUSD', 'CBBTC', 'VIRTUAL']; + for (const symbol of supportedTokens) { + try { + const tokenInfo = getTokenFromSDK(symbol, chainName); + if (tokenInfo && normalizedAddress === tokenInfo.address.toLowerCase()) { + return symbol; + } + } catch { + // Skip tokens not available on this chain + continue; + } + } + + return undefined; +} \ No newline at end of file diff --git a/projects/amped/tools-instructions.md b/projects/amped/tools-instructions.md new file mode 100644 index 00000000..52ec6117 --- /dev/null +++ b/projects/amped/tools-instructions.md @@ -0,0 +1,96 @@ +# Tools Implementation Guide + +Each module must include a `tools.ts` file that defines functions for LLM integration. + +## Guidelines + +1. **Function Definitions** + + - Provide clear and concise descriptions. + - Use accurate parameter types and descriptions. + - Follow the OpenAI function calling specification. + +2. **Formatting** + + - Use the required format for LLM function definitions. + - Include `name`, `description`, `parameters`, and `required` fields. + +3. **Chain Support** + + - Import required chain utilities: + ```typescript + import { getChainName } from "@heyanon/sdk"; + import { supportedChains } from "./constants"; + ``` + - Use chain enumeration for network parameters: + ```typescript + chainName: { + type: 'string', + enum: supportedChains.map(getChainName), + description: 'Name of the blockchain network' + } + ``` + - Define supported chains in your module's `constants.ts`: + + ```typescript + import { ChainId } from "@heyanon/sdk"; + + export const supportedChains = [ChainId.ETHEREUM]; + ``` + + - Use `getChainName` utility to ensure consistent chain naming + +4. **Clarity** + + - Ensure descriptions are understandable and not overly verbose. + - Avoid unnecessary complexity in parameter descriptions. + +## Example Implementation + +```typescript +import { getChainName } from "@heyanon/sdk"; +import { supportedChains } from "./constants"; + +export const functions = [ + { + name: "depositExample", + description: "Deposits a specified amount of tokens into the protocol.", + parameters: { + type: "object", + properties: { + chainName: { + type: "string", + enum: supportedChains.map(getChainName), + description: "Name of the blockchain network", + }, + userAddress: { type: "string", description: "User's wallet address" }, + assetAddress: { type: "string", description: "Token contract address" }, + amount: { type: "string", description: "Amount to deposit" }, + }, + required: ["chainName", "userAddress", "assetAddress", "amount"], + }, + }, + { + name: "getRewardsExample", + description: "Retrieves the rewards earned by a user.", + parameters: { + type: "object", + properties: { + chainName: { + type: "string", + enum: supportedChains.map(getChainName), + description: "Name of the blockchain network", + }, + userAddress: { type: "string", description: "User's wallet address" }, + }, + required: ["chainName", "userAddress"], + }, + }, +]; +``` + +### OpenAI Function Calling Specification + +Refer to the OpenAI documentation for function calling: + +[Function Calling - OpenAI API](https://platform.openai.com/docs/guides/gpt/function-calling) \ No newline at end of file diff --git a/projects/amped/tsup.config.ts b/projects/amped/tsup.config.ts new file mode 100644 index 00000000..88d8167f --- /dev/null +++ b/projects/amped/tsup.config.ts @@ -0,0 +1,23 @@ +import { exec } from 'child_process'; +import { defineConfig } from 'tsup'; + +export default defineConfig((options) => ({ + entry: { + index: './src/index.ts', + }, + format: ['esm', 'cjs'], + dts: false, + treeshake: true, + splitting: true, + clean: !options.watch, + onSuccess: async () => { + exec('tsc --emitDeclarationOnly --declaration', (err) => { + if (err) { + console.error(err); + if (!options.watch) { + process.exit(1); + } + } + }); + }, +})); \ No newline at end of file