UNPKG

yamaswap-sdk

Version:
785 lines (781 loc) 1.16 MB
var __defProp = Object.defineProperty; var __getOwnPropNames = Object.getOwnPropertyNames; var __typeError = (msg) => { throw TypeError(msg); }; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); var __privateWrapper = (obj, member, setter, getter) => ({ set _(value) { __privateSet(obj, member, value, setter); }, get _() { return __privateGet(obj, member, getter); } }); // src/utils/getAddress.ts import * as anchor from "@coral-xyz/anchor"; import { PublicKey } from "@solana/web3.js"; function deriveEtfTokenMintAccount(program, seeds) { const buffers = seeds.map((part) => { if (typeof part === "string") { return Buffer.from(part); } else if (part instanceof PublicKey) { return part.toBuffer(); } else { throw new Error(`Unsupported type in symbolParts: ${typeof part}`); } }); return anchor.web3.PublicKey.findProgramAddressSync( [ ...buffers ], program.programId ); } function getSavedContractAddresses() { let json = { "hardhat": { "TWAP": "0xDb731EaaFA0FFA7854A24C2379585a85D768Ed5C", "CETO": "0x335796f7A0F72368D1588839e38f163d90C92C80", "ETFROUTER": "0xa86582Ad5E80abc19F95f8A9Fb3905Cda0dAbd59", "ETFFACTORY": "0x97915c43511f8cB4Fbe7Ea03B96EEe940eC4AF12" }, "localhost": { "TWAP": "0xDb731EaaFA0FFA7854A24C2379585a85D768Ed5C", "CETO": "0x335796f7A0F72368D1588839e38f163d90C92C80", "ETFROUTER": "0xa86582Ad5E80abc19F95f8A9Fb3905Cda0dAbd59", "ETFFACTORY": "0x97915c43511f8cB4Fbe7Ea03B96EEe940eC4AF12", "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" }, "arbitrumSepolia": { "TWAP": "0x5571Af8f9277E5b00DDF5fdA7738eA01d9fc5dFe", "CETO": "0x197D6Fe658Eb2D9fa3eEE5d6F079ce1E1619Ad9b", "ETFROUTER": "0xE2B2efFC24c7e3Fe1ABb1c3eDD33481d9a7d9346", "ETFFACTORY": "0xD324c3B60B94b9Fe8aaA66F4A44a5b3a3Dbcb811", "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" }, "sepolia": { "TWAP": "0x5617E6B8d33E4bE32c1c8eA140998bf6c1280E2D", "CETO": "0xC0Fc8583c7c308ea92471d3897cA04514615C84D", "ETFROUTER": "0x84E8120aC983b3125737DAebED2C579e9a9967F1", "ETFFACTORY": "0x21cFE67901E071fc178a1D766414Dfa20E285209", "WETH": "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14" } }; return json; } var init_getAddress = __esm({ "src/utils/getAddress.ts"() { "use strict"; } }); // src/utils/error.ts var DexSDKError, ETFNotExistsError, ETFExistsError, ETFInsufficientBalanceError, ETFInvalidParamsError; var init_error = __esm({ "src/utils/error.ts"() { "use strict"; DexSDKError = class _DexSDKError extends Error { constructor(message) { super(message); this.name = "DexSDKError"; Object.setPrototypeOf(this, _DexSDKError.prototype); } }; ETFNotExistsError = class _ETFNotExistsError extends DexSDKError { constructor(message) { super(message); this.name = "ETFNotExistsError"; Object.setPrototypeOf(this, _ETFNotExistsError.prototype); } }; ETFExistsError = class _ETFExistsError extends DexSDKError { constructor(message) { super(message); this.name = "ETFExistsError"; Object.setPrototypeOf(this, _ETFExistsError.prototype); } }; ETFInsufficientBalanceError = class _ETFInsufficientBalanceError extends DexSDKError { constructor(message) { super(message); this.name = "ETFInsufficientBalanceError"; Object.setPrototypeOf(this, _ETFInsufficientBalanceError.prototype); } }; ETFInvalidParamsError = class _ETFInvalidParamsError extends DexSDKError { constructor(message) { super(message); this.name = "ETFInvalidParamsError"; Object.setPrototypeOf(this, _ETFInvalidParamsError.prototype); } }; } }); // src/utils/checks.ts import { PublicKey as PublicKey2 } from "@solana/web3.js"; import { getAccount, getAssociatedTokenAddressSync, TokenAccountNotFoundError } from "@solana/spl-token"; async function checkATAExists(client, tokens, owner, isContract = false) { for (const token of tokens) { const tokenAccountAddress = getAssociatedTokenAddressSync(token, owner, isContract); try { return await getAccount(client.connection, tokenAccountAddress); } catch (e) { if (e instanceof TokenAccountNotFoundError) { throw new TokenAccountNotFoundError(`\u8D26\u6237 ${tokenAccountAddress.toBase58()} \u4E0D\u5B58\u5728`); } throw e; } } return void 0; } async function checkBalance(client, etfAddress, owner, requiredAmount) { const balance = await client.queries.getETFBalance(etfAddress, owner); if (balance < requiredAmount) { throw new ETFInsufficientBalanceError(`\u7528\u6237\u4EE3\u5E01\u8D26\u6237\u4F59\u989D\u4E0D\u8DB3\uFF0C\u6240\u9700: ${requiredAmount}, \u5F53\u524D: ${balance}`); } } async function checkETFExists(client, etfAddress) { const etfInfo = await client.queries.getETFInfo(etfAddress); if (typeof etfInfo === "string") { throw new ETFNotExistsError(etfInfo); } return etfInfo; } function validateETFCreateParams(params) { const { assets } = params; if (!assets?.length) { throw new ETFInvalidParamsError("ETF\u7EC4\u6210\u90E8\u5206\u4E0D\u80FD\u4E3A\u7A7A"); } const totalWeight = assets.reduce((sum, item) => sum + item.weight, 0); if (totalWeight !== 100) { throw new ETFInvalidParamsError(`ETF\u7EC4\u6210\u90E8\u5206\u6743\u91CD\u4E4B\u548C\u5FC5\u987B\u4E3A100\uFF0C\u5F53\u524D\u4E3A: ${totalWeight}`); } const tokenSet = /* @__PURE__ */ new Set(); for (const item of assets) { let tokenKey; try { tokenKey = new PublicKey2(item.token); } catch (e) { throw new ETFInvalidParamsError(`\u65E0\u6548\u7684\u4EE3\u5E01\u5730\u5740: ${item.token}`); } if (tokenSet.has(tokenKey.toBase58())) { throw new ETFInvalidParamsError(`\u5B58\u5728\u91CD\u590D\u7684\u4EE3\u5E01\u5730\u5740: ${item.token}`); } tokenSet.add(tokenKey.toBase58()); if (item.weight <= 0) { throw new ETFInvalidParamsError(`\u4EE3\u5E01\u6743\u91CD\u5FC5\u987B\u5927\u4E8E0: ${item.token}`); } } } function validateMintETFParams(params) { if (params.lamports <= 0) { throw new ETFInvalidParamsError("\u8D2D\u4E70\u4EFD\u989D\u5FC5\u987B\u5927\u4E8E0"); } if (params.lamports > 1e15) { throw new ETFInvalidParamsError("\u8D2D\u4E70\u4EFD\u989D\u8D85\u8FC7\u6700\u5927\u9650\u5236\uFF081000000 SOL\uFF09"); } } var init_checks = __esm({ "src/utils/checks.ts"() { "use strict"; init_error(); } }); // src/abis/CryptoETFToken.json var CryptoETFToken_default; var init_CryptoETFToken = __esm({ "src/abis/CryptoETFToken.json"() { CryptoETFToken_default = { _format: "hh-sol-artifact-1", contractName: "CryptoETFToken", sourceName: "contracts/CryptoETFToken.sol", abi: [ { inputs: [ { internalType: "string", name: "name", type: "string" }, { internalType: "string", name: "symbol", type: "string" }, { internalType: "string", name: "_tokenUri", type: "string" }, { components: [ { internalType: "address", name: "tokenAddress", type: "address" }, { internalType: "uint24", name: "distribution", type: "uint24" } ], internalType: "struct ICryptoETFToken.Constitunent[]", name: "constitunents_", type: "tuple[]" }, { internalType: "address", name: "router_", type: "address" }, { internalType: "address", name: "rebalancer_", type: "address" } ], stateMutability: "nonpayable", type: "constructor" }, { inputs: [ { internalType: "address", name: "spender", type: "address" }, { internalType: "uint256", name: "allowance", type: "uint256" }, { internalType: "uint256", name: "needed", type: "uint256" } ], name: "ERC20InsufficientAllowance", type: "error" }, { inputs: [ { internalType: "address", name: "sender", type: "address" }, { internalType: "uint256", name: "balance", type: "uint256" }, { internalType: "uint256", name: "needed", type: "uint256" } ], name: "ERC20InsufficientBalance", type: "error" }, { inputs: [ { internalType: "address", name: "approver", type: "address" } ], name: "ERC20InvalidApprover", type: "error" }, { inputs: [ { internalType: "address", name: "receiver", type: "address" } ], name: "ERC20InvalidReceiver", type: "error" }, { inputs: [ { internalType: "address", name: "sender", type: "address" } ], name: "ERC20InvalidSender", type: "error" }, { inputs: [ { internalType: "address", name: "spender", type: "address" } ], name: "ERC20InvalidSpender", type: "error" }, { inputs: [ { internalType: "address", name: "token", type: "address" } ], name: "SafeERC20FailedOperation", type: "error" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "owner", type: "address" }, { indexed: true, internalType: "address", name: "spender", type: "address" }, { indexed: false, internalType: "uint256", name: "value", type: "uint256" } ], name: "Approval", type: "event" }, { anonymous: false, inputs: [ { indexed: true, internalType: "address", name: "from", type: "address" }, { indexed: true, internalType: "address", name: "to", type: "address" }, { indexed: false, internalType: "uint256", name: "value", type: "uint256" } ], name: "Transfer", type: "event" }, { 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: "value", type: "uint256" } ], name: "approve", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "account", type: "address" } ], name: "balanceOf", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "uint256", name: "etfAmount", type: "uint256" }, { internalType: "address", name: "from", type: "address" } ], name: "burn", outputs: [ { internalType: "address[]", name: "constitunentTokens", type: "address[]" }, { internalType: "uint256[]", name: "constitunentAmounts", type: "uint256[]" } ], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "uint256", name: "", type: "uint256" } ], name: "constitunents", outputs: [ { internalType: "address", name: "tokenAddress", type: "address" }, { internalType: "uint24", name: "distribution", type: "uint24" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "", type: "address" } ], name: "constitunentsReserves", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "decimals", outputs: [ { internalType: "uint8", name: "", type: "uint8" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "getConstitunents", outputs: [ { components: [ { internalType: "address", name: "tokenAddress", type: "address" }, { internalType: "uint24", name: "distribution", type: "uint24" } ], internalType: "struct ICryptoETFToken.Constitunent[]", name: "", type: "tuple[]" }, { internalType: "uint24", name: "", type: "uint24" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "hasMint", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "uint256", name: "etfAmount", type: "uint256" }, { internalType: "address", name: "to", type: "address" }, { internalType: "address[]", name: "tokens", type: "address[]" }, { internalType: "uint256[]", name: "amounts", type: "uint256[]" } ], name: "mint", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [ { components: [ { internalType: "address", name: "tokenAddress", type: "address" }, { internalType: "uint24", name: "distribution", type: "uint24" } ], internalType: "struct ICryptoETFToken.Constitunent[]", name: "constitunents_", type: "tuple[]" } ], name: "modifyConsitunent", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "name", outputs: [ { internalType: "string", name: "", type: "string" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "rebalancer", outputs: [ { internalType: "address", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "router", outputs: [ { internalType: "address", name: "", type: "address" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "symbol", outputs: [ { internalType: "string", name: "", type: "string" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "tokenUri", outputs: [ { internalType: "string", name: "", type: "string" } ], stateMutability: "view", type: "function" }, { inputs: [], name: "totalSupply", outputs: [ { internalType: "uint256", name: "", type: "uint256" } ], stateMutability: "view", type: "function" }, { inputs: [ { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "value", type: "uint256" } ], name: "transfer", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "nonpayable", type: "function" }, { inputs: [ { internalType: "address", name: "from", type: "address" }, { internalType: "address", name: "to", type: "address" }, { internalType: "uint256", name: "value", type: "uint256" } ], name: "transferFrom", outputs: [ { internalType: "bool", name: "", type: "bool" } ], stateMutability: "nonpayable", type: "function" } ], bytecode: "0x608060405234801561001057600080fd5b506040516138ca3803806138ca83398181016040528101906100329190610643565b858581600390816100439190610961565b5080600490816100539190610961565b50505083600590816100659190610961565b506100758361010260201b60201c565b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050505050610c69565b6000815111610146576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013d90610a90565b60405180910390fd5b60005b815181101561031457600082828151811061016757610166610ab0565b5b60200260200101519050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16036101e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101db90610b51565b60405180910390fd5b6000816020015162ffffff1611610230576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022790610be3565b60405180910390fd5b8060200151600a60008282829054906101000a900462ffffff166102549190610c32565b92506101000a81548162ffffff021916908362ffffff1602179055506006819080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548162ffffff021916908362ffffff1602179055505050508080600101915050610149565b5050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61037f82610336565b810181811067ffffffffffffffff8211171561039e5761039d610347565b5b80604052505050565b60006103b1610318565b90506103bd8282610376565b919050565b600067ffffffffffffffff8211156103dd576103dc610347565b5b6103e682610336565b9050602081019050919050565b60005b838110156104115780820151818401526020810190506103f6565b60008484015250505050565b600061043061042b846103c2565b6103a7565b90508281526020810184848401111561044c5761044b610331565b5b6104578482856103f3565b509392505050565b600082601f8301126104745761047361032c565b5b815161048484826020860161041d565b91505092915050565b600067ffffffffffffffff8211156104a8576104a7610347565b5b602082029050602081019050919050565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006104ee826104c3565b9050919050565b6104fe816104e3565b811461050957600080fd5b50565b60008151905061051b816104f5565b92915050565b600062ffffff82169050919050565b61053981610521565b811461054457600080fd5b50565b60008151905061055681610530565b92915050565b600060408284031215610572576105716104be565b5b61057c60406103a7565b9050600061058c8482850161050c565b60008301525060206105a084828501610547565b60208301525092915050565b60006105bf6105ba8461048d565b6103a7565b905080838252602082019050604084028301858111156105e2576105e16104b9565b5b835b8181101561060b57806105f7888261055c565b8452602084019350506040810190506105e4565b5050509392505050565b600082601f83011261062a5761062961032c565b5b815161063a8482602086016105ac565b91505092915050565b60008060008060008060c087890312156106605761065f610322565b5b600087015167ffffffffffffffff81111561067e5761067d610327565b5b61068a89828a0161045f565b965050602087015167ffffffffffffffff8111156106ab576106aa610327565b5b6106b789828a0161045f565b955050604087015167ffffffffffffffff8111156106d8576106d7610327565b5b6106e489828a0161045f565b945050606087015167ffffffffffffffff81111561070557610704610327565b5b61071189828a01610615565b935050608061072289828a0161050c565b92505060a061073389828a0161050c565b9150509295509295509295565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061079257607f821691505b6020821081036107a5576107a461074b565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261080d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826107d0565b61081786836107d0565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b600061085e6108596108548461082f565b610839565b61082f565b9050919050565b6000819050919050565b61087883610843565b61088c61088482610865565b8484546107dd565b825550505050565b600090565b6108a1610894565b6108ac81848461086f565b505050565b5b818110156108d0576108c5600082610899565b6001810190506108b2565b5050565b601f821115610915576108e6816107ab565b6108ef846107c0565b810160208510156108fe578190505b61091261090a856107c0565b8301826108b1565b50505b505050565b600082821c905092915050565b60006109386000198460080261091a565b1980831691505092915050565b60006109518383610927565b9150826002028217905092915050565b61096a82610740565b67ffffffffffffffff81111561098357610982610347565b5b61098d825461077a565b6109988282856108d4565b600060209050601f8311600181146109cb57600084156109b9578287015190505b6109c38582610945565b865550610a2b565b601f1984166109d9866107ab565b60005b82811015610a01578489015182556001820191506020850194506020810190506109dc565b86831015610a1e5784890151610a1a601f891682610927565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f636f6e73746974756e656e74732063616e206e6f7420626520656d7074790000600082015250565b6000610a7a601e83610a33565b9150610a8582610a44565b602082019050919050565b60006020820190508181036000830152610aa981610a6d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f636f6e73746974756e656e7420746f6b656e20616464726573732063616e206e60008201527f6f74206265207a65726f00000000000000000000000000000000000000000000602082015250565b6000610b3b602a83610a33565b9150610b4682610adf565b604082019050919050565b60006020820190508181036000830152610b6a81610b2e565b9050919050565b7f636f6e73746974756e656e7420746f6b656e20646973747269627574696f6e2060008201527f6d7573742067726561746572207468616e207a65726f00000000000000000000602082015250565b6000610bcd603683610a33565b9150610bd882610b71565b604082019050919050565b60006020820190508181036000830152610bfc81610bc0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610c3d82610521565b9150610c4883610521565b9250828201905062ffffff811115610c6357610c62610c03565b5b92915050565b612c5280610c786000396000f3fe608060405234801561001057600080fd5b50600436106101215760003560e01c80635b15f15e116100ad578063a9059cbb11610071578063a9059cbb14610321578063dd62ed3e14610351578063f7da711114610381578063f887ea40146103a0578063fcd3533c146103be57610121565b80635b15f15e14610254578063651b52c01461027257806370a08231146102a257806395d89b41146102d257806396522fd0146102f057610121565b806323b872dd116100f457806323b872dd146101b0578063313ce567146101e057806331feab29146101fe578063355e0c5d1461021a57806358cef0431461023857610121565b806301d22ccd1461012657806306fdde0314610144578063095ea7b31461016257806318160ddd14610192575b600080fd5b61012e6103ef565b60405161013b9190611af5565b60405180910390f35b61014c610415565b6040516101599190611ba0565b60405180910390f35b61017c60048036038101906101779190611c38565b6104a7565b6040516101899190611c93565b60405180910390f35b61019a6104ca565b6040516101a79190611cbd565b60405180910390f35b6101ca60048036038101906101c59190611cd8565b6104d4565b6040516101d79190611c93565b60405180910390f35b6101e8610503565b6040516101f59190611d47565b60405180910390f35b61021860048036038101906102139190611e1d565b61050c565b005b6102226107c1565b60405161022f9190611ba0565b60405180910390f35b610252600480360381019061024d9190611f1a565b61084f565b005b61025c610952565b6040516102699190611c93565b60405180910390f35b61028c60048036038101906102879190611f67565b610965565b6040516102999190611cbd565b60405180910390f35b6102bc60048036038101906102b79190611f67565b61097d565b6040516102c99190611cbd565b60405180910390f35b6102da6109c5565b6040516102e79190611ba0565b60405180910390f35b61030a60048036038101906103059190611f94565b610a57565b604051610318929190611fdf565b60405180910390f35b61033b60048036038101906103369190611c38565b610ab6565b6040516103489190611c93565b60405180910390f35b61036b60048036038101906103669190612008565b610ad9565b6040516103789190611cbd565b60405180910390f35b610389610b60565b604051610397929190612144565b60405180910390f35b6103a8610c4e565b6040516103b59190611af5565b60405180910390f35b6103d860048036038101906103d39190612174565b610c74565b6040516103e6929190612321565b60405180910390f35b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606003805461042490612387565b80601f016020809104026020016040519081016040528092919081815260200182805461045090612387565b801561049d5780601f106104725761010080835404028352916020019161049d565b820191906000526020600020905b81548152906001019060200180831161048057829003601f168201915b5050505050905090565b6000806104b26110da565b90506104bf8185856110e2565b600191505092915050565b6000600254905090565b6000806104df6110da565b90506104ec8582856110f4565b6104f7858585611189565b60019150509392505050565b60006012905090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461059c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059390612404565b60405180910390fd5b600086116105df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612470565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361064e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610645906124dc565b60405180910390fd5b6006805490508484905014610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068f9061256e565b60405180910390fd5b60068054905082829050146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d990612600565b60405180910390fd5b60005b848490508110156107935782828281811061070357610702612620565b5b905060200201356009600087878581811061072157610720612620565b5b90506020020160208101906107369190611f67565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461077f919061267e565b9250508190555080806001019150506106e5565b5061079e858761127d565b6001600a60036101000a81548160ff021916908315150217905550505050505050565b600580546107ce90612387565b80601f01602080910402602001604051908101604052809291908181526020018280546107fa90612387565b80156108475780601f1061081c57610100808354040283529160200191610847565b820191906000526020600020905b81548152906001019060200180831161082a57829003601f168201915b505050505081565b60006108596104ca565b146108ef57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e5906126fe565b60405180910390fd5b5b61094e8282808060200260200160405190810160405280939291908181526020016000905b8282101561094457848483905060400201803603810190610935919061281a565b81526020019060010190610914565b50505050506112ff565b5050565b600a60039054906101000a900460ff1681565b60096020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546109d490612387565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0090612387565b8015610a4d5780601f10610a2257610100808354040283529160200191610a4d565b820191906000526020600020905b815481529060010190602001808311610a3057829003601f168201915b5050505050905090565b60068181548110610a6757600080fd5b906000526020600020016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900462ffffff16905082565b600080610ac16110da565b9050610ace818585611189565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b606060006006600a60009054906101000a900462ffffff1681805480602002602001604051908101604052809291908181526020016000905b82821015610c40578382906000526020600020016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900462ffffff1662ffffff1662ffffff168152505081526020019060010190610b99565b505050509150915091509091565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606080600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cfe90612404565b60405180910390fd5b60008411610d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4190612470565b60405180910390fd5b610d526104ca565b841115610d94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8b90612893565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610e03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfa906128ff565b60405180910390fd5b60068054905067ffffffffffffffff811115610e2257610e21612723565b5b604051908082528060200260200182016040528015610e505781602001602082028036833780820191505090505b50915060068054905067ffffffffffffffff811115610e7257610e71612723565b5b604051908082528060200260200182016040528015610ea05781602001602082028036833780820191505090505b50905060005b6006805490508110156110c857600060068281548110610ec957610ec8612620565b5b906000526020600020016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900462ffffff1662ffffff1662ffffff168152505090506000610f636104ca565b8760096000856000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb2919061291f565b610fbc9190612990565b90508060096000846000015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461101191906129c1565b9250508190555081600001518584815181106110305761102f612620565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508084848151811061107e5761107d612620565b5b6020026020010181815250506110b93382846000015173ffffffffffffffffffffffffffffffffffffffff166115159092919063ffffffff16565b50508080600101915050610ea6565b506110d38385611594565b9250929050565b600033905090565b6110ef8383836001611616565b505050565b60006111008484610ad9565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156111835781811015611173578281836040517ffb8f41b200000000000000000000000000000000000000000000000000000000815260040161116a939291906129f5565b60405180910390fd5b61118284848484036000611616565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036111fb5760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016111f29190611af5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361126d5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016112649190611af5565b60405180910390fd5b6112788383836117ed565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036112ef5760006040517fec442f050000000000000000000000000000000000000000000000000000000081526004016112e69190611af5565b60405180910390fd5b6112fb600083836117ed565b5050565b6000815111611343576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133a90612a78565b60405180910390fd5b60005b815181101561151157600082828151811061136457611363612620565b5b60200260200101519050600073ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff16036113e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d890612b0a565b60405180910390fd5b6000816020015162ffffff161161142d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161142490612b9c565b60405180910390fd5b8060200151600a60008282829054906101000a900462ffffff166114519190612bbc565b92506101000a81548162ffffff021916908362ffffff1602179055506006819080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548162ffffff021916908362ffffff1602179055505050508080600101915050611346565b5050565b61158f838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401611548929190612bf3565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611a12565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116065760006040517f96c6fd1e0000000000000000000000000000000000000000000000000000000081526004016115fd9190611af5565b60405180910390fd5b611612826000836117ed565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036116885760006040517fe602df0500000000000000000000000000000000000000000000000000000000815260040161167f9190611af5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116fa5760006040517f94280d620000000000000000000000000000000000000000000000000000000081526004016116f19190611af5565b60405180910390fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080156117e7578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516117de9190611cbd565b60405180910390a35b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361183f578060026000828254611833919061267e565b92505081905550611912565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156118cb578381836040517fe450d38c0000000000000000000000000000000000000000000000000000000081526004016118c2939291906129f5565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361195b57806002600082825403925050819055506119a8565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611a059190611cbd565b60405180910390a3505050565b600080602060008451602086016000885af180611a35576040513d6000823e3d81fd5b3d925060005191505060008214611a50576001811415611a6c565b60008473ffffffffffffffffffffffffffffffffffffffff163b145b15611aae57836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401611aa59190611af5565b60405180910390fd5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611adf82611ab4565b9050919050565b611aef81611ad4565b82525050565b6000602082019050611b0a6000830184611ae6565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611b4a578082015181840152602081019050611b2f565b60008484015250505050565b6000601f19601f8301169050919050565b6000611b7282611b10565b611b7c8185611b1b565b9350611b8c818560208601611b2c565b611b9581611b56565b840191505092915050565b60006020820190508181036000830152611bba8184611b67565b905092915050565b6000604051905090565b600080fd5b600080fd5b611bdf81611ad4565b8114611bea57600080fd5b50565b600081359050611bfc81611bd6565b92915050565b6000819050919050565b611c1581611c02565b8114611c2057600080fd5b50565b600081359050611c3281611c0c565b92915050565b60008060408385031215611c4f57611c4e611bcc565b5b6000611c5d85828601611bed565b9250506020611c6e85828601611c23565b9150509250929050565b60008115159050919050565b611c8d81611c78565b82525050565b6000602082019050611ca86000830184611c84565b92915050565b611cb781611c02565b82525050565b6000602082019050611cd26000830184611cae565b92915050565b600080600060608486031215611cf157611cf0611bcc565b5b6000611cff86828701611bed565b9350506020611d1086828701611bed565b9250506040611d2186828701611c23565b9150509250925092565b600060ff82169050919050565b611d4181611d2b565b82525050565b6000602082019050611d5c6000830184611d38565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611d8757611d86611d62565b5b8235905067ffffffffffffffff811115611da457611da3611d67565b5b602083019150836020820283011115611dc057611dbf611d6c565b5b9250929050565b60008083601f840112611ddd57611ddc611d62565b5b8235905067ffffffffffffffff811115611dfa57611df9611d67565b5b602083019150836020820283011115611e1657611e15611d6c565b5b9250929050565b60008060008060008060808789031215611e3a57611e39611bcc565b5b6000611e4889828a01611c23565b9650506020611e5989828a01611bed565b955050604087013567ffffffffffffffff811115611e7a57611e79611bd1565b5b611e8689828a01611d71565b9450945050606087013567ffffffffffffffff811115611ea957611ea8611bd1565b5b611eb589828a01611dc7565b92509250509295509295509295565b60008083601f840112611eda57611ed9611d62565b5b8235905067ffffffffffffffff811115611ef757611ef6611d67565b5b602083019150836040820283011115611f1357611f12611d6c565b5b9250929050565b60008060208385031215611f3157611f30611bcc565b5b600083013567ffffffffffffffff811115611f4f57611f4e611bd1565b5b611f5b85828601611ec4565b92509250509250929050565b600060208284031215611f7d57611f7c611bcc565b5b6000611f8b84828501611bed565b91505092915050565b600060208284031215611faa57611fa9611bcc565b5b6000611fb884828501611c23565b91505092915050565b600062ffffff82169050919050565b611fd981611fc1565b82525050565b6000604082019050611ff46000830185611ae6565b6120016020830184611fd0565b9392505050565b6000806040838503121561201f5761201e611bcc565b5b600061202d85828601611bed565b925050602061203e85828601611bed565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61207d81611ad4565b82525050565b61208c81611fc1565b82525050565b6040820160008201516120a86000850182612074565b5060208201516120bb6020850182612083565b50505050565b60006120cd8383612092565b60408301905092915050565b6000602082019050919050565b60006120f182612048565b6120fb8185612053565b935061210683612064565b8060005b8381101561213757815161211e88826120c1565b9750612129836120d9565b92505060018101905061210a565b5085935050505092915050565b6000604082019050818103600083015261215e81856120e6565b905061216d6020830184611fd0565b9392505050565b6000806040838503121561218b5761218a611bcc565b5b600061219985828601611c23565b92505060206121aa85828601611bed565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60006121ec8383612074565b60208301905092915050565b6000602082019050919050565b6000612210826121b4565b61221a81856121bf565b9350612225836121d0565b8060005b8381101561225657815161223d88826121e0565b9750612248836121f8565b925050600181019050612229565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61229881611c02565b82525050565b60006122aa838361228f565b60208301905092915050565b6000602082019050919050565b60006122ce82612263565b6122d8818561226e565b93506122e38361227f565b8060005b838110156123145781516122fb888261229e565b9750612306836122b6565b9250506001810190506122e7565b5085935050505092915050565b6000604082019050818103600083015261233b8185612205565b9050818103602083015261234f81846122c3565b90509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061239f57607f821691505b6020821081036123b2576123b1612358565b5b50919050565b7f6f6e6c7920726f757465722063616e2065786563757465000000000000000000600082015250565b60006123ee601783611b1b565b91506123f9826123b8565b602082019050919050565b6000602082019050818103600083015261241d816123e1565b9050919050565b7f65667420616d6f7574206e6565642067726561746572207468616e207a65726f600082015250565b600061245a602083611b1b565b915061246582612424565b602082019050919050565b600060208201905081810360008301526124898161244d565b9050919050565b7f6d696e7420746f2063616e206e6f74206265207a65726f000000000000000000600082015250565b60006124c6601783611b1b565b91506124d182612490565b602082019050919050565b600060208201905081810360008301526124f5816124b9565b9050919050565b7f746f6b656e73206c69737420746f6b656e206e656564206d6174636820636f6e60008201527f7369747574656e74730000000000000000000000000000000000000000000000602082015250565b6000612558602983611b1b565b9150612563826124fc565b604082019050919050565b600060208201905081810360008301526125878161254b565b9050919050565b7f746f6b656e73206c69737420616d6f756e7473206e656564206d61746368206360008201527f6f6e7369747574656e7473000000000000000000000000000000000000000000602082015250565b60006125ea602b83611b1b565b91506125f58261258e565b604082019050919050565b60006020820190508181036000830152612619816125dd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061268982611c02565b915061269483611c02565b92508282019050808211156126ac576126ab61264f565b5b92915050565b7f6f6e6c79207265626c616e6365722063616e2065786563757465000000000000600082015250565b60006126e8601a83611b1b565b91506126f3826126b2565b602082019050919050565b60006020820190508181036000830152612717816126db565b9050919050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61275b82611b56565b810181811067ffffffffffffffff8211171561277a57612779612723565b5b80604052505050565b600061278d611bc2565b90506127998282612752565b919050565b6127a781611fc1565b81146127b257600080fd5b50565b6000813590506127c48161279e565b92915050565b6000604082840312156127e0576127df61271e565b5b6127ea6040612783565b905060006127fa84828501611bed565b600083015250602061280e848285016127b5565b60208301525092915050565b6000604082840312156128305761282f611bcc565b5b600061283e848285016127ca565b91505092915050565b7f657466206e6f7420656e6f756768000000000000000000000000000000000000600082015250565b600061287d600e83611b1b565b915061288882612847565b602082019050919050565b600060208201905081810360008301526128ac81612870565b9050919050565b7f6275726e20616464726573732063616e206e6f74206265207a65726f00000000600082015250565b60006128e9601c83611b1b565b91506128f4826128b3565b602082019050919050565b60006020820190508181036000830152612918816128dc565b9050919050565b600061292a82611c02565b915061293583611c02565b925082820261294381611c02565b9150828204841483151761295a5761295961264f565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061299b82611c02565b91506129a683611c02565b9250826129b6576129b5612961565b5b828204905092915050565b60006129cc82611c02565b91506129d783611c02565b92508282039050818111156129ef576129ee61264f565b5b92915050565b6000606082019050612a0a6000830186611ae6565b612a176020830185611cae565b612a246040830184611cae565b949350505050565b7f636f6e73746974756e656e74732063616e206e6f7420626520656d7074790000600082015250565b6000612a62601e83611b1b565b9150612a6d82612a2c565b602082019050919050565b6000602082019050818103600083015261