{"matchId":"43231337","creationMatch":"match","runtimeMatch":"match","verifiedAt":"2026-08-03T05:30:46Z","creationBytecode":{"onchainBytecode":"0x608060405260008054600160a01b600160e01b031916600160a01b1790553480156200002a57600080fd5b50604051620034ee380380620034ee8339810160408190526200004d91620000a2565b806001600160a01b038116620000765760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055506001600255620000d4565b600060208284031215620000b557600080fd5b81516001600160a01b0381168114620000cd57600080fd5b9392505050565b61340a80620000e46000396000f3fe6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b815290915073057d1e699296cced17696c442e637dca69b34e1a9063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b815290915073bf0824d673a73c67287059fd351794284646b8d79063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec90629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073408fab3aafc590d99b09e6ad13ad5df73b06652690630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b815290915073610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b0319815290915073610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec90629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b815290915073057d1e699296cced17696c442e637dca69b34e1a9063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b815290915073bf0824d673a73c67287059fd351794284646b8d79063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec9063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073408fab3aafc590d99b09e6ad13ad5df73b06652690630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b815273610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea264697066735822122037dd5e1ad0c3bcf0764c3605f7cf3d7c93f2b529638f61386f1c79adce923a3664736f6c63430008110033000000000000000000000000ace2b3e7c752d5debca72210141d464371b3b9b1","recompiledBytecode":"0x608060405260008054600160a01b600160e01b031916600160a01b1790553480156200002a57600080fd5b50604051620034ee380380620034ee8339810160408190526200004d91620000a2565b806001600160a01b038116620000765760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055506001600255620000d4565b600060208284031215620000b557600080fd5b81516001600160a01b0381168114620000cd57600080fd5b9392505050565b61340a80620000e46000396000f3fe6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b81529091507300000000000000000000000000000000000000009063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b81529091507300000000000000000000000000000000000000009063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b031981529091507300000000000000000000000000000000000000009063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b81529091507300000000000000000000000000000000000000009063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507300000000000000000000000000000000000000009063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b81527300000000000000000000000000000000000000009063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","sourceMap":"550:15160:0:-:0;;;1427:37:24;;;-1:-1:-1;;;;;;;;1427:37:24;-1:-1:-1;;;1427:37:24;;;730:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;775:6;-1:-1:-1;;;;;3943:22:24;;3939:48;;3974:13;;-1:-1:-1;;;3974:13:24;;;;;;;;;;;3939:48;3997:5;:14;;-1:-1:-1;;;;;;3997:14:24;-1:-1:-1;;;;;3997:14:24;;;;;;;;;;-1:-1:-1;;1821:7:36;:22;550:15160:0;;14:290:37;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:37;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:37:o;:::-;550:15160:0;;;;;;","linkReferences":{"contracts/8/router/DagRouter.sol":{"DagRouter":[{"start":2308,"length":20},{"start":4726,"length":20}]},"contracts/8/router/UnxswapRouter.sol":{"UnxswapRouter":[{"start":2021,"length":20},{"start":3326,"length":20},{"start":4074,"length":20}]},"contracts/8/router/SwapWrapRouter.sol":{"SwapWrapRouter":[{"start":1464,"length":20},{"start":3518,"length":20}]},"contracts/8/router/SmartSwapRouter.sol":{"SmartSwapRouter":[{"start":1727,"length":20},{"start":3782,"length":20}]},"contracts/8/router/UnxswapV3Router.sol":{"UnxswapV3Router":[{"start":2593,"length":20},{"start":2953,"length":20},{"start":5206,"length":20}]}},"cborAuxdata":{"1":{"value":"0xa2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","offset":13497}},"transformations":[{"id":"contracts/8/router/DagRouter.sol:DagRouter","type":"replace","offset":2308,"reason":"library"},{"id":"contracts/8/router/DagRouter.sol:DagRouter","type":"replace","offset":4726,"reason":"library"},{"id":"contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter","type":"replace","offset":1727,"reason":"library"},{"id":"contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter","type":"replace","offset":3782,"reason":"library"},{"id":"contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter","type":"replace","offset":1464,"reason":"library"},{"id":"contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter","type":"replace","offset":3518,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":2021,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":3326,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":4074,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":2593,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":2953,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":5206,"reason":"library"},{"id":"1","type":"replace","offset":13497,"reason":"cborAuxdata"},{"type":"insert","offset":13550,"reason":"constructorArguments"}],"transformationValues":{"libraries":{"contracts/8/router/DagRouter.sol:DagRouter":"0x408fab3aafc590d99b09e6ad13ad5df73b066526","contracts/8/router/UnxswapRouter.sol:UnxswapRouter":"0x14d28f43301a5a6277afad65e9817e0a12ea0fec","contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter":"0x057d1e699296cced17696c442e637dca69b34e1a","contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter":"0xbf0824d673a73c67287059fd351794284646b8d7","contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router":"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f"},"cborAuxdata":{"1":"0xa264697066735822122037dd5e1ad0c3bcf0764c3605f7cf3d7c93f2b529638f61386f1c79adce923a3664736f6c63430008110033"},"constructorArguments":"0x000000000000000000000000ace2b3e7c752d5debca72210141d464371b3b9b1"}},"runtimeBytecode":{"onchainBytecode":"0x6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b815290915073057d1e699296cced17696c442e637dca69b34e1a9063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b815290915073bf0824d673a73c67287059fd351794284646b8d79063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec90629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073408fab3aafc590d99b09e6ad13ad5df73b06652690630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b815290915073610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b0319815290915073610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec90629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b815290915073057d1e699296cced17696c442e637dca69b34e1a9063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b815290915073bf0824d673a73c67287059fd351794284646b8d79063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507314d28f43301a5a6277afad65e9817e0a12ea0fec9063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073408fab3aafc590d99b09e6ad13ad5df73b06652690630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b815273610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f9063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea264697066735822122037dd5e1ad0c3bcf0764c3605f7cf3d7c93f2b529638f61386f1c79adce923a3664736f6c63430008110033","recompiledBytecode":"0x6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b81529091507300000000000000000000000000000000000000009063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b81529091507300000000000000000000000000000000000000009063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b031981529091507300000000000000000000000000000000000000009063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b81529091507300000000000000000000000000000000000000009063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507300000000000000000000000000000000000000009063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b81527300000000000000000000000000000000000000009063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","sourceMap":"550:15160:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;248:9:20;234:10;:23;226:56;;;;-1:-1:-1;;;226:56:20;;216:2:37;226:56:20;;;198:21:37;255:2;235:18;;;228:30;-1:-1:-1;;;274:18:37;;;267:50;334:18;;226:56:20;;;;;;;;;550:15160:0;;;;;13381:344;;;;;;:::i;:::-;;:::i;3139:717::-;;;;;;:::i;:::-;;:::i;:::-;;;2939:25:37;;;2927:2;2912:18;3139:717:0;;;;;;;;10779:541;;;;;;:::i;:::-;;:::i;5571:560::-;;;;;;:::i;:::-;;:::i;6790:509::-;;;;;;:::i;:::-;;:::i;1517:41:24:-;;;;;;;;;;-1:-1:-1;1517:41:24;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;5544:14:37;;5537:22;5519:41;;5507:2;5492:18;1517:41:24;5379:187:37;5878:153:24;;;;;;;;;;;;;:::i;8047:605:0:-;;;;;;:::i;:::-;;:::i;662:61::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;1427:37:24:-;;;;;;;;;;-1:-1:-1;1427:37:24;;;;-1:-1:-1;;;1427:37:24;;-1:-1:-1;;;;;1427:37:24;;;;;;-1:-1:-1;;;;;7105:31:37;;;7087:50;;7075:2;7060:18;1427:37:24;6943:200:37;5383:177:24;;;;;;;;;;;;;:::i;1203:20::-;;;;;;;;;;-1:-1:-1;1203:20:24;;;;-1:-1:-1;;;;;1203:20:24;;;;;;-1:-1:-1;;;;;7421:32:37;;;7403:51;;7391:2;7376:18;1203:20:24;7257:203:37;9464:514:0;;;;;;:::i;:::-;;:::i;14459:507::-;;;;;;:::i;:::-;;:::i;6703:99:24:-;;;;;;;;;;-1:-1:-1;6744:4:24;6785:10;-1:-1:-1;;;6785:10:24;;-1:-1:-1;;;;;6785:10:24;6767:15;:28;6703:99;;1634:690:0;;;;;;:::i;:::-;;:::i;12136:591::-;;;;;;:::i;:::-;;:::i;6289:195:24:-;;;;;;;;;;;;;:::i;4745:284::-;;;;;;;;;;-1:-1:-1;4745:284:24;;;;;:::i;:::-;;:::i;4477:489:0:-;;;;;;:::i;:::-;;:::i;4302:248:24:-;;;;;;;;;;-1:-1:-1;4302:248:24;;;;;:::i;:::-;;:::i;15232:476:0:-;;;;;;;;;;-1:-1:-1;15232:476:0;;;;;:::i;:::-;;:::i;13381:344::-;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;13516:28:0::2;::::0;;::::2;::::0;::::2;12614:25:37::0;;;12655:18;;;12648:34;;;13487:22:0::2;::::0;12587:18:37;;13516:28:0::2;;;;;;;;;;;;:35;13512:1;:39;;;;:::i;:::-;13487:64;;13561:37;13601:48;13634:14;13601:32;:48::i;:::-;13666:52;::::0;-1:-1:-1;;;13666:52:0;;13561:88;;-1:-1:-1;13666:14:0::2;::::0;:23:::2;::::0;:52:::2;::::0;13690:7;;13699;;13561:88;;13666:52:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;13659:59;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;13381:344:0;;:::o;3139:717::-;3489:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;3525:22:0::2;3565:7;3574:8;3584:11;3597:13;;3612:7;;3621:11;;3554:79;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:86;3550:1;:90;;;;:::i;:::-;3525:115;;3650:37;3690:48;3723:14;3690:32;:48::i;:::-;3755:94;::::0;-1:-1:-1;;;3755:94:0;;3650:88;;-1:-1:-1;3755:15:0::2;::::0;:27:::2;::::0;:94:::2;::::0;3783:7;;3792:8;;3802:11;;3815:13;;;;3830:7;;;;3650:88;;3755:94:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3748:101;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;3139:717:0;;;;;;;;;;;:::o;10779:541::-;10994:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;11026:22:0::2;11066:8;11076:6;11084:9;11095:8;11105:5;;11055:56;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:63;11051:1;:67;;;;:::i;:::-;11026:92;;11128:37;11168:48;11201:14;11168:32;:48::i;:::-;11233:80;::::0;-1:-1:-1;;;11233:80:0;;11128:88;;-1:-1:-1;11233:13:0::2;::::0;:23:::2;::::0;:80:::2;::::0;11257:8;;11267:6;;11275:9;;11286:8;;11296:5;;;;11128:88;;11233:80:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;11226:87;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;10779:541:0;;;;;;;;:::o;5571:560::-;5819:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;5855:22:0::2;5895:7;5904:8;5914:11;5927:5;;5884:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;5880:1;:60;;;;:::i;:::-;5855:85;;5950:37;5990:48;6023:14;5990:32;:48::i;:::-;6055:69;::::0;-1:-1:-1;;;6055:69:0;;5950:88;;-1:-1:-1;6055:9:0::2;::::0;:19:::2;::::0;:69:::2;::::0;6075:7;;6084:8;;6094:11;;6107:5;;;;5950:88;;6055:69:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;6048:76;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;5571:560:0;;;;;;;:::o;6790:509::-;6985:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;7017:22:0::2;7057:8;7067:6;7075:9;7086:5;;7046:46;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:53;7042:1;:57;;;;:::i;:::-;7017:82;;7109:37;7149:48;7182:14;7149:32;:48::i;:::-;7214:78;::::0;-1:-1:-1;;;7214:78:0;;7109:88;;-1:-1:-1;7214:15:0::2;::::0;:31:::2;::::0;:78:::2;::::0;7246:8;;7256:6;;7264:9;;7275:5;;;;7109:88;;7214:78:::2;;;:::i;5878:153:24:-:0;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;6744:4;6785:10;-1:-1:-1;;;6785:10:24;;-1:-1:-1;;;;;6785:10:24;6767:15;:28;5926:34:::1;;5949:11;;-1:-1:-1::0;;;5949:11:24::1;;;;;;;;;;;5926:34;5971:10;:23:::0;;-1:-1:-1;;;;5971:23:24::1;-1:-1:-1::0;;;5971:23:24::1;::::0;;6009:15:::1;::::0;::::1;::::0;5971:10;6009:15:::1;5878:153::o:0;8047:605:0:-;8313:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;8349:22:0::2;8389:7;8398:8;8408:11;8421:5;;8378:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;8374:1;:60;;;;:::i;:::-;8349:85;;8444:37;8484:48;8517:14;8484:32;:48::i;:::-;8549:96;::::0;-1:-1:-1;;;;;;8549:96:0;;8444:88;;-1:-1:-1;8549:15:0::2;::::0;:46:::2;::::0;:96:::2;::::0;8596:7;;8605:8;;8615:11;;8628:5;;;;8444:88;;8549:96:::2;;;:::i;5383:177:24:-:0;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;5432:10:::1;::::0;-1:-1:-1;;;;;5432:10:24;;::::1;-1:-1:-1::0;;;;;5432:10:24::1;:26:::0;5429:60:::1;;5467:22;;-1:-1:-1::0;;;5467:22:24::1;;;;;;;;;;;5429:60;5500:10;:25:::0;;-1:-1:-1;;;;5500:25:24::1;-1:-1:-1::0;;;5500:25:24::1;::::0;;5540:13:::1;::::0;::::1;::::0;5500:10;5540:13:::1;5383:177::o:0;9464:514:0:-;9660:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;9692:22:0::2;9732:8;9742:6;9750:9;9761:5;;9721:46;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:53;9717:1;:57;;;;:::i;:::-;9692:82;;9784:37;9824:48;9857:14;9824:32;:48::i;:::-;9889:82;::::0;-1:-1:-1;;;9889:82:0;;9784:88;;-1:-1:-1;9889:13:0::2;::::0;:23:::2;::::0;:82:::2;::::0;9913:8;;9923:6;;9931:9;;9942:10:::2;::::0;9954:5;;;;9784:88;;9889:82:::2;;;:::i;14459:507::-:0;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;14683:22:0::2;14723:7;14732:8;14742:11;14712:42;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:49;14708:1;:53;;;;:::i;:::-;14683:78;;14771:37;14811:48;14844:14;14811:32;:48::i;:::-;14876:83;::::0;-1:-1:-1;;;14876:83:0;;14771:88;;-1:-1:-1;14876:14:0::2;::::0;:40:::2;::::0;:83:::2;::::0;14917:7;;14926:8;;14936:11;;14771:88;;14876:83:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;14869:90;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;14459:507:0;;;:::o;1634:690::-;1965:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;2001:22:0::2;2041:7;2050:11;2063:13;;2078:7;;2087:11;;2030:69;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:76;2026:1;:80;;;;:::i;:::-;2001:105;;2116:37;2156:48;2189:14;2156:32;:48::i;:::-;2221:96;::::0;-1:-1:-1;;;2221:96:0;;2116:88;;-1:-1:-1;2221:15:0::2;::::0;:27:::2;::::0;:96:::2;::::0;2249:7;;2258:10:::2;::::0;2270:11;;2283:13;;;;2298:7;;;;2116:88;;2221:96:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2214:103;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;1634:690:0;;;;;;;;;;:::o;12136:591::-;12396:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;12432:22:0::2;12472:7;12481:8;12491:11;12504:5;;12461:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;12457:1;:60;;;;:::i;:::-;12432:85;;12527:37;12567:48;12600:14;12567:32;:48::i;:::-;12632:88;::::0;-1:-1:-1;;;12632:88:0;;12527;;-1:-1:-1;12632:13:0::2;::::0;:38:::2;::::0;:88:::2;::::0;12671:7;;12680:8;;12690:11;;12703:5;;;;12527:88;;12632::::2;;;:::i;6289:195:24:-:0;3685:10;3675:21;;;;:9;:21;;;;;;;;3670:48;;3705:13;;-1:-1:-1;;;3705:13:24;;;;;;;;;;;3670:48;3361:10:::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;6382:41:::2;1030:8;6382:15;:41;:::i;:::-;6362:10;:62:::0;;-1:-1:-1;;;;6362:62:24::2;-1:-1:-1::0;;;;;;;;6362:62:24;;::::2;::::0;::::2;::::0;;;::::2;::::0;;;;6439:38:::2;::::0;6466:10;::::2;::::0;;::::2;7087:50:37::0;;6454:10:24::2;::::0;6439:38:::2;::::0;7075:2:37;7060:18;6439:38:24::2;;;;;;;6289:195::o:0;4745:284::-;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;-1:-1:-1;;;;;4829:24:24;::::1;4825:50;;4862:13;;-1:-1:-1::0;;;4862:13:24::1;;;;;;;;;;;4825:50;-1:-1:-1::0;;;;;4889:19:24;::::1;;::::0;;;:9:::1;:19;::::0;;;;;:28;::::1;;:19;::::0;;::::1;:28;;::::0;4885:53:::1;;4926:12;;-1:-1:-1::0;;;4926:12:24::1;;;;;;;;;;;4885:53;-1:-1:-1::0;;;;;4948:19:24;::::1;;::::0;;;:9:::1;:19;::::0;;;;;;;;:27;;-1:-1:-1;;4948:27:24::1;::::0;::::1;;::::0;;::::1;::::0;;;4990:32;;5519:41:37;;;4990:32:24::1;::::0;5492:18:37;4990:32:24::1;;;;;;;4745:284:::0;;:::o;4477:489:0:-;4666:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;4698:22:0::2;4738:7;4747:11;4760:5;;4727:39;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:46;4723:1;:50;;;;:::i;:::-;4698:75;;4783:37;4823:48;4856:14;4823:32;:48::i;:::-;4888:71;::::0;-1:-1:-1;;;4888:71:0;;4783:88;;-1:-1:-1;4888:9:0::2;::::0;:19:::2;::::0;:71:::2;::::0;4908:7;;4917:10:::2;::::0;4929:11;;4942:5;;;;4783:88;;4888:71:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4881:78;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;4477:489:0;;;;;;:::o;4302:248:24:-;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;-1:-1:-1;;;;;4380:24:24;::::1;4376:50;;4413:13;;-1:-1:-1::0;;;4413:13:24::1;;;;;;;;;;;4376:50;4436:21;4460:5:::0;;-1:-1:-1;;;;;4475:16:24;;::::1;-1:-1:-1::0;;;;;;4475:16:24;::::1;::::0;::::1;::::0;;4506:37:::1;::::0;4460:5;;;::::1;::::0;;;4506:37:::1;::::0;4436:21;4506:37:::1;4366:184;4302:248:::0;:::o;15232:476:0:-;3361:10:24;;-1:-1:-1;;;3361:10:24;;-1:-1:-1;;;;;3361:10:24;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1;;;3380:15:24;;;;;;;;;;;3339:56;15421:2:0::1;15406:17:::0;::::1;;15398:51;;;::::0;-1:-1:-1;;;15398:51:0;;42356:2:37;15398:51:0::1;::::0;::::1;42338:21:37::0;42395:2;42375:18;;;42368:30;-1:-1:-1;;;42414:18:37;;;42407:51;42475:18;;15398:51:0::1;42154:345:37::0;15398:51:0::1;15459:12;15482:9;15488:2;15459:12:::0;15482:4;;:9:::1;:::i;:::-;15474:18;::::0;::::1;:::i;:::-;15459:33:::0;-1:-1:-1;;;;15506:33:0;;15502:200:::1;;15555:71;::::0;-1:-1:-1;;;15555:71:0;;:15:::1;::::0;:37:::1;::::0;:71:::1;::::0;15593:12;;15607;;15621:4;;;;15555:71:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;15502:200;;;15657:34;::::0;-1:-1:-1;;;15657:34:0;;43697:2:37;15657:34:0::1;::::0;::::1;43679:21:37::0;43736:2;43716:18;;;43709:30;43775:26;43755:18;;;43748:54;43819:18;;15657:34:0::1;43495:348:37::0;15502:200:0::1;15388:320;15232:476:::0;;;;:::o;2336:287:36:-;1759:1;2468:7;;:19;2460:63;;;;-1:-1:-1;;;2460:63:36;;44050:2:37;2460:63:36;;;44032:21:37;44089:2;44069:18;;;44062:30;44128:33;44108:18;;;44101:61;44179:18;;2460:63:36;43848:355:37;2460:63:36;1759:1;2598:18;;2336:287::o;2322:1135:22:-;2398:37;;:::i;:::-;2842:26;2870:24;2898:46;2929:14;2898:30;:46::i;:::-;2841:103;;;;3030:64;3059:9;3070:7;3079:14;3030:28;:64::i;:::-;3117:306;;;;;;;;3168:46;3189:9;3199:1;3189:12;;;;;;;;:::i;:::-;;;;;;;3203:7;3211:1;3203:10;;;;;;;;:::i;:::-;;;;;;;3168:20;:46::i;:::-;3117:306;;;;3238:40;3253:9;3263:1;3253:12;;;;;;;;:::i;:::-;;;;;;;3267:7;3275:1;3267:10;;;;;;;;:::i;:::-;;;;;;;3238:14;:40::i;:::-;3117:306;;;;3305:43;3323:9;3333:1;3323:12;;;;;;;;:::i;:::-;;;;;;;3337:7;3345:1;3337:10;;;;;;;;:::i;:::-;;;;;;;3305:17;:43::i;:::-;3117:306;;;;3372:40;3387:9;3397:1;3387:12;;;;;;;;:::i;:::-;;;;;;;3401:7;3409:1;3401:10;;;;;;;;:::i;:::-;;;;;;;3372:14;:40::i;:::-;-1:-1:-1;;;;;3117:306:22;;;3105:318;2322:1135;-1:-1:-1;;;;2322:1135:22:o;4230:6236::-;4414:34;;;2138:1;4414:34;;;;;;;;;4325:26;;;;4414:34;;;;;;;;;-1:-1:-1;;4468:34:22;;;2138:1;4468:34;;;;;;;;;4402:46;;-1:-1:-1;2138:1:22;-1:-1:-1;4468:34:22;;;;;;;;;;-1:-1:-1;4468:34:22;4458:44;;4551:420;;;-1:-1:-1;;;4632:1:22;4604:135;-1:-1:-1;;;4784:4:22;4756:138;4924:1;4918:4;4911:15;;4953:3;4950:1;4943:14;4551:420;5527:4;5523:1;5507:14;5503:22;5499:33;5483:14;5479:54;5567:8;5546:1247;5590:14;5581:7;5578:27;5546:1247;;;-1:-1:-1;;;;;;5806:4:22;5797:7;5793:18;5780:32;5776:60;-1:-1:-1;;;6618:10:22;6615:38;-1:-1:-1;;;6552:10:22;6549:39;-1:-1:-1;;;6511:10:22;6508:39;6505:84;6477:198;-1:-1:-1;;;6379:10:22;6376:30;-1:-1:-1;;;6352:10:22;6349:25;6346:61;-1:-1:-1;;;6274:10:22;6271:44;-1:-1:-1;;;6226:10:22;6223:46;6220:96;6188:245;-1:-1:-1;;;6098:10:22;6095:40;-1:-1:-1;;;6054:10:22;6051:42;6048:88;-1:-1:-1;;;5985:10:22;5982:35;-1:-1:-1;;;5946:10:22;5943:37;5940:78;5908:254;5880:575;5856:837;5853:926;;;6728:7;6716:19;;6756:5;;;5853:926;-1:-1:-1;;;5619:18:22;5546:1247;;;5550:27;6938:4;6928:8;6924:19;6911:33;-1:-1:-1;;;;;;6973:14:22;6969:42;7043:1;-1:-1:-1;;;7132:4:22;7129:29;-1:-1:-1;;;7083:4:22;7080:31;7060:112;7057:164;;;-1:-1:-1;7206:1:22;7057:164;-1:-1:-1;;;7314:4:22;7311:34;-1:-1:-1;;;7260:4:22;7257:36;7237:122;7234:174;;;-1:-1:-1;7393:1:22;7234:174;-1:-1:-1;;;7505:4:22;7502:38;-1:-1:-1;;;7447:4:22;7444:40;7424:130;7421:645;;;7618:4;7608:8;7604:19;7591:33;7573:51;;-1:-1:-1;;;7669:14:22;7665:44;7660:3;7656:54;7641:69;;7795:27;7782:11;7779:44;7749:27;7736:11;7733:44;7730:94;7727:325;;;7847:161;7982:4;7890:66;7847:161;:::i;:::-;8093:1;;-1:-1:-1;8110:18:22;;8107:154;;8174:1;8161:11;8157:19;8147:29;;8107:154;-1:-1:-1;;8296:4:22;8281:20;;;8274:38;;;8360:18;;;8353:34;;;8522:17;8508:32;;-1:-1:-1;;;;;;;;;8616:19:22;;8603:33;8657:30;-1:-1:-1;;;8764:19:22;;8761:66;;8812:1;8802:11;;8761:66;-1:-1:-1;;;8846:4:22;8843:24;8840:71;;8896:1;8886:11;;8840:71;-1:-1:-1;8946:4:22;8931:20;;;8924:38;;;9004:18;;8997:34;;;9159:4;9147:17;9133:32;;-1:-1:-1;;;9255:19:22;;9242:33;-1:-1:-1;;;;;;9296:45:22;;;-1:-1:-1;;;9496:33:22;;-1:-1:-1;;;9445:33:22;;9425:118;9422:286;;;9691:1;9582:64;9586:3;9582:64;;;;9673:20;;-1:-1:-1;9422:286:22;-1:-1:-1;;9743:4:22;9728:20;;;9721:38;;;9808:18;;9801:34;;;9967:4;9955:17;9941:32;;-1:-1:-1;;;10057:19:22;;10044:33;-1:-1:-1;;;;;;;;;10161:34:22;;10158:62;10155:109;;10249:1;10239:11;;10155:109;;10306:8;10299:4;10288:9;10284:20;10277:38;10381:6;10374:4;10365:7;10361:18;10354:34;;;4230:6236;;;:::o;11156:680::-;11414:9;11409:175;11433:23;11455:1;2138;11433:23;:::i;:::-;11429:27;;:1;:27;11409:175;;;11520:7;11528:1;11520:10;;;;;;;;:::i;:::-;;;;;;;11533:2;11520:15;;;;:::i;:::-;11505:9;11515:1;11505:12;;;;;;;;:::i;:::-;;;;;;;:30;;;;:::i;:::-;11485:9;11495:5;:1;11499;11495:5;:::i;:::-;11485:16;;;;;;;;:::i;:::-;;;;;;;:50;11477:96;;;;-1:-1:-1;;;11477:96:22;;45136:2:37;11477:96:22;;;45118:21:37;45175:2;45155:18;;;45148:30;45214:34;45194:18;;;45187:62;-1:-1:-1;;;45265:18:37;;;45258:31;45306:19;;11477:96:22;44934:397:37;11477:96:22;11458:3;;;:::i;:::-;;;11409:175;;;-1:-1:-1;11778:14:22;11737:7;11745:23;11767:1;2138;11745:23;:::i;:::-;11737:32;;;;;;;;;;:::i;:::-;;;;;;;11772:2;11737:37;;;;:::i;:::-;11700:9;11710:23;11732:1;2138;11710:23;:::i;:::-;11700:34;;;;;;;;;;:::i;:::-;;;;;;;:74;;;;:::i;:::-;:92;;11692:137;;;;-1:-1:-1;;;11692:137:22;;45678:2:37;11692:137:22;;;45660:21:37;;;45697:18;;;45690:30;45756:34;45736:18;;;45729:62;45808:18;;11692:137:22;45476:356:37;11879:3865:22;11965:47;;:::i;:::-;12024:63;;12055:21;12024:63;12096:19;12118:10;12127:1;12118:6;:10;:::i;:::-;12096:32;;12733:4;12723:8;12719:19;12706:33;-1:-1:-1;;;;;;12768:14:22;12764:42;-1:-1:-1;;;13067:4:22;13064:40;-1:-1:-1;;;12987:4:22;12984:36;-1:-1:-1;;;12930:4:22;12927:31;12899:143;12875:247;12843:14;12819:317;-1:-1:-1;;;13429:4:22;13426:38;-1:-1:-1;;;13351:4:22;13348:34;-1:-1:-1;;;13296:4:22;13293:29;13265:139;13241:241;13208:14;13202:4;13198:25;13174:322;-1:-1:-1;;;13612:14:22;13608:42;13603:3;13599:52;13566:14;13560:4;13556:25;13532:133;-1:-1:-1;;;;;13771:14:22;13767:34;13734:14;13728:4;13724:25;13700:115;13896:4;13886:8;13882:19;13869:33;13851:51;;13936:12;14090:1;-1:-1:-1;;;14050:14:22;14046:42;14043:49;14040:162;;;-1:-1:-1;14128:9:22;14040:162;14243:4;14239:25;;14215:110;-1:-1:-1;;;;;14405:34:22;;14366:4;14362:25;;14338:123;14485:4;14481:25;;14474:46;;;14572:1;14556:18;;14553:1144;;;14608:1;14593:1090;14618:11;14615:1;14612:18;14593:1090;;;14734:4;14731:1;14727:12;14721:4;14717:23;14707:8;14703:38;14690:52;14672:70;;-1:-1:-1;;;;;;14780:14:22;14776:42;14858:5;14852:4;14849:15;14839:277;;14892:173;15035:4;14939:66;14892:173;:::i;:::-;-1:-1:-1;15306:3:22;15302:52;;;;;15207:4;15200:12;;15169:44;;;;;15137:239;-1:-1:-1;;;;;15586:34:22;;15459:4;15451:44;;;15419:223;14645:1;14638:9;14593:1090;;;14597:14;14553:1144;;;15716:21;11879:3865;;;;;:::o;15781:3787::-;15861:35;;:::i;:::-;15908:57;;15939:15;15908:57;16536:4;16526:8;16522:19;16509:33;-1:-1:-1;;;;;;16575:8:22;16571:30;-1:-1:-1;;;16693:8:22;16690:28;-1:-1:-1;;;16652:8:22;16649:23;16629:103;16795:7;16769:8;16745:71;16859:1;16850:7;16847:14;16879:1;16874:1353;;;;18294:1;18283:8;18277:4;18273:19;18266:30;18353:1;18342:8;18336:4;18332:19;18325:30;18415:1;18404:8;18398:4;18394:19;18387:30;18473:1;18462:8;18456:4;18452:19;18445:30;16840:1668;;16874:1353;-1:-1:-1;;;16980:8:22;16976:30;16971:3;16967:40;16936:8;16930:4;16926:19;16898:127;-1:-1:-1;;;;;17127:8:22;17123:54;17092:8;17086:4;17082:19;17054:141;17317:4;17307:8;17303:19;17290:33;17278:45;;-1:-1:-1;;;;;;17356:8:22;17352:30;17422:4;17412:8;17409:18;17399:254;;17451:161;17586:4;-1:-1:-1;;;17451:161:22;:::i;:::-;-1:-1:-1;17685:12:22;-1:-1:-1;;;17781:30:22;;17778:37;17775:140;;-1:-1:-1;17849:9:22;17775:140;17964:4;17960:19;;17932:104;-1:-1:-1;;;;;18122:54:22;;18085:4;18081:19;;18053:141;16840:1668;;;-1:-1:-1;;;18531:8:22;18528:28;18574:1;18569:797;;;;19433:1;19422:8;19416:4;19412:19;19405:30;19494:1;19483:8;19477:4;19473:19;19466:30;18521:1006;;18569:797;18683:4;18673:8;18669:19;18656:33;18644:45;;-1:-1:-1;;;;;;18722:8:22;18718:30;18788:4;18778:8;18775:18;18765:254;;18817:161;18952:4;-1:-1:-1;;;18817:161:22;:::i;:::-;18765:254;-1:-1:-1;;;19118:8:22;19114:30;19109:3;19105:40;19074:8;19068:4;19064:19;19036:127;-1:-1:-1;;;;;19267:8:22;19263:54;19232:8;19226:4;19222:19;19194:141;18521:1006;;;15781:3787;;;;:::o;19608:3521::-;19691:41;;:::i;:::-;19744:60;;19775:18;19744:60;19969:10;19978:1;19969:6;:10;:::i;:::-;-1:-1:-1;;;;;19955:25:22;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;19955:25:22;-1:-1:-1;19933:19:22;;;:47;19990:23;;20078:1;20064:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;20064:16:22;;20023:57;;20702:4;20692:8;20688:19;20675:33;-1:-1:-1;;;;;;20744:15:22;20740:45;20721:64;;20933:1;20925:6;20921:14;-1:-1:-1;;;;;20972:15:22;20968:35;20955:11;20948:56;21122:4;21112:8;21108:19;21095:33;21076:52;;-1:-1:-1;;;;;;21157:15:22;21153:45;21241:4;21224:15;21221:25;21211:248;;21266:149;21393:4;21305:66;21266:149;:::i;:::-;21211:248;21524:24;21507:15;21503:46;21496:4;21483:11;21479:22;21472:78;21632:27;21615:15;21611:49;21607:2;21603:58;21596:4;21583:11;21579:22;21572:90;-1:-1:-1;;;21693:15:22;21690:44;21687:198;;-1:-1:-1;;;21806:15:22;21802:52;21798:2;21794:61;21787:4;21764:21;21760:32;21753:103;21687:198;-1:-1:-1;;21978:19:22;;21965:33;22045:4;22018:32;;22011:57;-1:-1:-1;;22177:19:22;;22164:33;22244:4;22217:32;;22210:57;;;22191:4;22355:22;;22349:29;22164:33;;-1:-1:-1;;22391:271:22;22416:12;22413:1;22410:19;22391:271;;;22530:4;22527:1;22523:12;22517:4;22513:23;22503:8;22499:38;22486:52;22467:71;;22606:15;22598:4;22594:1;22591;22587:9;22583:20;22566:15;22562:42;22555:67;22444:1;22441;22437:9;22432:14;;22391:271;;;22395:14;;;;-1:-1:-1;;;22685:15:22;:42;22681:413;;22792:21;22814:1;22792:24;;;;;;;;:::i;:::-;;;;;;;22784:33;;22827:21;22849:1;22827:24;;;;;;;;:::i;:::-;;;;;;;22819:33;;22867:21;22889:1;22867:24;;;;;;;;:::i;:::-;;;;;;;22854:39;;22767:127;;;;;;;;;46020:19:37;;;46064:2;46055:12;;46048:28;;;;-1:-1:-1;;;;;;46106:26:37;46101:2;46092:12;;46085:48;46158:2;46149:12;;45837:330;22767:127:22;;;;-1:-1:-1;;22767:127:22;;;;;;;;;22743:21;;;:151;22681:413;;;-1:-1:-1;;;22915:15:22;:42;22911:183;;23022:21;23044:1;23022:24;;;;;;;;:::i;:::-;;;;;;;23014:33;;23057:21;23079:1;23057:24;;;;;;;;:::i;:::-;;;;;;;23049:33;;22997:86;;;;;;;;46329:19:37;;;46373:2;46364:12;;46357:28;46410:2;46401:12;;46172:247;22997:86:22;;;;-1:-1:-1;;22997:86:22;;;;;;;;;22973:21;;;:110;22911:183;23104:18;;19608:3521;;;;:::o;23166:366::-;23246:16;23278:6;23288:1;23278:11;23274:59;;-1:-1:-1;23320:1:22;23305:17;;23274:59;-1:-1:-1;;;;23414:19:22;23401:33;-1:-1:-1;;;;;23459:32:22;;23166:366::o;-1:-1:-1:-;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;363:248:37:-;431:6;439;492:2;480:9;471:7;467:23;463:32;460:52;;;508:1;505;498:12;460:52;-1:-1:-1;;531:23:37;;;601:2;586:18;;;573:32;;-1:-1:-1;363:248:37:o;616:173::-;684:20;;-1:-1:-1;;;;;733:31:37;;723:42;;713:70;;779:1;776;769:12;713:70;616:173;;;:::o;794:160::-;858:5;903:3;894:6;889:3;885:16;881:26;878:46;;;920:1;917;910:12;878:46;-1:-1:-1;942:6:37;794:160;-1:-1:-1;794:160:37:o;959:367::-;1022:8;1032:6;1086:3;1079:4;1071:6;1067:17;1063:27;1053:55;;1104:1;1101;1094:12;1053:55;-1:-1:-1;1127:20:37;;-1:-1:-1;;;;;1159:30:37;;1156:50;;;1202:1;1199;1192:12;1156:50;1239:4;1231:6;1227:17;1215:29;;1299:3;1292:4;1282:6;1279:1;1275:14;1267:6;1263:27;1259:38;1256:47;1253:67;;;1316:1;1313;1306:12;1253:67;959:367;;;;;:::o;1331:1457::-;1636:6;1644;1652;1660;1668;1676;1684;1692;1700;1753:3;1741:9;1732:7;1728:23;1724:33;1721:53;;;1770:1;1767;1760:12;1721:53;1806:9;1793:23;1783:33;;1835:38;1869:2;1858:9;1854:18;1835:38;:::i;:::-;1825:48;;1892:67;1951:7;1946:2;1935:9;1931:18;1892:67;:::i;:::-;1882:77;;2010:3;1999:9;1995:19;1982:33;-1:-1:-1;;;;;2075:2:37;2067:6;2064:14;2061:34;;;2091:1;2088;2081:12;2061:34;2130:70;2192:7;2183:6;2172:9;2168:22;2130:70;:::i;:::-;2219:8;;-1:-1:-1;2104:96:37;-1:-1:-1;2307:3:37;2292:19;;2279:33;;-1:-1:-1;2324:16:37;;;2321:36;;;2353:1;2350;2343:12;2321:36;2392:72;2456:7;2445:8;2434:9;2430:24;2392:72;:::i;:::-;2483:8;;-1:-1:-1;2366:98:37;-1:-1:-1;2571:3:37;2556:19;;2543:33;;-1:-1:-1;2588:16:37;;;2585:36;;;2617:1;2614;2607:12;2585:36;;2656:72;2720:7;2709:8;2698:9;2694:24;2656:72;:::i;:::-;2630:98;;2747:8;2737:18;;;2774:8;2764:18;;;1331:1457;;;;;;;;;;;:::o;2975:717::-;3097:6;3105;3113;3121;3129;3137;3190:3;3178:9;3169:7;3165:23;3161:33;3158:53;;;3207:1;3204;3197:12;3158:53;3243:9;3230:23;3220:33;;3300:2;3289:9;3285:18;3272:32;3262:42;;3351:2;3340:9;3336:18;3323:32;3313:42;;3374:38;3408:2;3397:9;3393:18;3374:38;:::i;:::-;3364:48;;3463:3;3452:9;3448:19;3435:33;-1:-1:-1;;;;;3483:6:37;3480:30;3477:50;;;3523:1;3520;3513:12;3477:50;3562:70;3624:7;3615:6;3604:9;3600:22;3562:70;:::i;:::-;2975:717;;;;-1:-1:-1;2975:717:37;;-1:-1:-1;2975:717:37;;3651:8;;2975:717;-1:-1:-1;;;2975:717:37:o;3697:743::-;3869:6;3877;3885;3893;3901;3954:3;3942:9;3933:7;3929:23;3925:33;3922:53;;;3971:1;3968;3961:12;3922:53;4007:9;3994:23;3984:33;;4036:38;4070:2;4059:9;4055:18;4036:38;:::i;:::-;4026:48;;4093:67;4152:7;4147:2;4136:9;4132:18;4093:67;:::i;:::-;4083:77;;4211:3;4200:9;4196:19;4183:33;-1:-1:-1;;;;;4231:6:37;4228:30;4225:50;;;4271:1;4268;4261:12;4225:50;4310:70;4372:7;4363:6;4352:9;4348:22;4310:70;:::i;:::-;3697:743;;;;-1:-1:-1;3697:743:37;;-1:-1:-1;4399:8:37;;4284:96;3697:743;-1:-1:-1;;;3697:743:37:o;4445:642::-;4558:6;4566;4574;4582;4590;4643:3;4631:9;4622:7;4618:23;4614:33;4611:53;;;4660:1;4657;4650:12;4611:53;4696:9;4683:23;4673:33;;4753:2;4742:9;4738:18;4725:32;4715:42;;4804:2;4793:9;4789:18;4776:32;4766:42;;4859:2;4848:9;4844:18;4831:32;-1:-1:-1;;;;;4878:6:37;4875:30;4872:50;;;4918:1;4915;4908:12;5092:186;5151:6;5204:2;5192:9;5183:7;5179:23;5175:32;5172:52;;;5220:1;5217;5210:12;5172:52;5243:29;5262:9;5243:29;:::i;:::-;5233:39;5092:186;-1:-1:-1;;;5092:186:37:o;6290:423::-;6332:3;6370:5;6364:12;6397:6;6392:3;6385:19;6422:1;6432:162;6446:6;6443:1;6440:13;6432:162;;;6508:4;6564:13;;;6560:22;;6554:29;6536:11;;;6532:20;;6525:59;6461:12;6432:162;;;6436:3;6639:1;6632:4;6623:6;6618:3;6614:16;6610:27;6603:38;6702:4;6695:2;6691:7;6686:2;6678:6;6674:15;6670:29;6665:3;6661:39;6657:50;6650:57;;;6290:423;;;;:::o;6718:220::-;6867:2;6856:9;6849:21;6830:4;6887:45;6928:2;6917:9;6913:18;6905:6;6887:45;:::i;8112:388::-;8219:6;8227;8235;8288:3;8276:9;8267:7;8263:23;8259:33;8256:53;;;8305:1;8302;8295:12;8256:53;8341:9;8328:23;8318:33;;8370:38;8404:2;8393:9;8389:18;8370:38;:::i;:::-;8360:48;;8427:67;8486:7;8481:2;8470:9;8466:18;8427:67;:::i;:::-;8417:77;;8112:388;;;;;:::o;8505:1383::-;8801:6;8809;8817;8825;8833;8841;8849;8857;8910:3;8898:9;8889:7;8885:23;8881:33;8878:53;;;8927:1;8924;8917:12;8878:53;8963:9;8950:23;8940:33;;8992:67;9051:7;9046:2;9035:9;9031:18;8992:67;:::i;:::-;8982:77;;9110:3;9099:9;9095:19;9082:33;-1:-1:-1;;;;;9175:2:37;9167:6;9164:14;9161:34;;;9191:1;9188;9181:12;9161:34;9230:70;9292:7;9283:6;9272:9;9268:22;9230:70;:::i;:::-;9319:8;;-1:-1:-1;9204:96:37;-1:-1:-1;9407:3:37;9392:19;;9379:33;;-1:-1:-1;9424:16:37;;;9421:36;;;9453:1;9450;9443:12;9421:36;9492:72;9556:7;9545:8;9534:9;9530:24;9492:72;:::i;:::-;9583:8;;-1:-1:-1;9466:98:37;-1:-1:-1;9671:3:37;9656:19;;9643:33;;-1:-1:-1;9688:16:37;;;9685:36;;;9717:1;9714;9707:12;9685:36;;9756:72;9820:7;9809:8;9798:9;9794:24;9756:72;:::i;:::-;8505:1383;;;;-1:-1:-1;8505:1383:37;;-1:-1:-1;8505:1383:37;;;;;;9847:8;-1:-1:-1;;;8505:1383:37:o;10612:160::-;10677:20;;10733:13;;10726:21;10716:32;;10706:60;;10762:1;10759;10752:12;10777:254;10842:6;10850;10903:2;10891:9;10882:7;10878:23;10874:32;10871:52;;;10919:1;10916;10909:12;10871:52;10942:29;10961:9;10942:29;:::i;:::-;10932:39;;10990:35;11021:2;11010:9;11006:18;10990:35;:::i;:::-;10980:45;;10777:254;;;;;:::o;11036:669::-;11199:6;11207;11215;11223;11276:3;11264:9;11255:7;11251:23;11247:33;11244:53;;;11293:1;11290;11283:12;11244:53;11329:9;11316:23;11306:33;;11358:67;11417:7;11412:2;11401:9;11397:18;11358:67;:::i;:::-;11348:77;;11476:3;11465:9;11461:19;11448:33;-1:-1:-1;;;;;11496:6:37;11493:30;11490:50;;;11536:1;11533;11526:12;11490:50;11575:70;11637:7;11628:6;11617:9;11613:22;11575:70;:::i;:::-;11036:669;;;;-1:-1:-1;11664:8:37;-1:-1:-1;;;;11036:669:37:o;11710:725::-;11796:6;11804;11812;11820;11873:2;11861:9;11852:7;11848:23;11844:32;11841:52;;;11889:1;11886;11879:12;11841:52;11925:9;11912:23;11902:33;;11982:2;11971:9;11967:18;11954:32;11944:42;;12037:2;12026:9;12022:18;12009:32;-1:-1:-1;;;;;12101:2:37;12093:6;12090:14;12087:34;;;12117:1;12114;12107:12;12087:34;12155:6;12144:9;12140:22;12130:32;;12200:7;12193:4;12189:2;12185:13;12181:27;12171:55;;12222:1;12219;12212:12;12171:55;12262:2;12249:16;12288:2;12280:6;12277:14;12274:34;;;12304:1;12301;12294:12;12274:34;12349:7;12344:2;12335:6;12331:2;12327:15;12323:24;12320:37;12317:57;;;12370:1;12367;12360:12;12317:57;11710:725;;;;-1:-1:-1;;12401:2:37;12393:11;;-1:-1:-1;;;11710:725:37:o;12693:127::-;12754:10;12749:3;12745:20;12742:1;12735:31;12785:4;12782:1;12775:15;12809:4;12806:1;12799:15;12825:125;12890:9;;;12911:10;;;12908:36;;;12924:18;;:::i;13502:918::-;13621:1;13617;13612:3;13608:11;13604:19;13596:5;13590:12;13586:38;13581:3;13574:51;13556:3;13644:4;13695:2;13688:5;13684:14;13678:21;13673:2;13668:3;13664:12;13657:43;13749:4;13742:5;13738:16;13732:23;13725:4;13720:3;13716:14;13709:47;13802:4;13795:5;13791:16;13785:23;13840:4;13833;13828:3;13824:14;13817:28;13866:47;13907:4;13902:3;13898:14;13884:12;13866:47;:::i;:::-;13961:4;13950:16;;;13944:23;13999:14;;;13983;;;13976:38;;;;14063:21;;14093:20;;;14167:23;;;;-1:-1:-1;;;14131:13:37;;;14218:175;14232:6;14229:1;14226:13;14218:175;;;14295:13;;14281:28;;14368:15;;;;14254:1;14247:9;;;;;14331:14;;;;14218:175;;;-1:-1:-1;14409:5:37;13502:918;-1:-1:-1;;;;;;13502:918:37:o;14425:2453::-;14477:3;14505:6;14536:5;14530:12;14551:31;14578:3;14573:2;14567:9;5353:13;5346:21;5334:34;;5283:91;14551:31;14625:4;14621:2;14617:13;14611:20;14640:45;14679:4;14674:3;14670:14;14656:12;5353:13;5346:21;5334:34;;5283:91;14640:45;;14731:4;14727:2;14723:13;14717:20;14710:4;14705:3;14701:14;14694:44;14784:4;14780:2;14776:13;14770:20;14763:4;14758:3;14754:14;14747:44;14837:4;14833:2;14829:13;14823:20;14816:4;14811:3;14807:14;14800:44;14890:4;14886:2;14882:13;14876:20;14869:4;14864:3;14860:14;14853:44;14942:4;14938:2;14934:13;14928:20;14957:50;15001:4;14996:3;14992:14;14976;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;14957:50;;15053:4;15049:2;15045:13;15039:20;15032:4;15027:3;15023:14;15016:44;15079:6;15130:2;15126;15122:11;15116:18;15143:48;15187:2;15182:3;15178:12;15162:14;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;15143:48;-1:-1:-1;;15210:6:37;15252:11;;;15246:18;15232:12;;;15225:40;15284:6;15327:11;;;15321:18;-1:-1:-1;;;;;7214:31:37;;;15383:12;;;7202:44;;;;15415:6;15457:11;;;15451:18;15437:12;;;15430:40;15489:6;15532:11;;;15526:18;7214:31;;15588:12;;;7202:44;15620:6;15662:11;;;15656:18;15642:12;;;15635:40;15694:6;15737:11;;;15731:18;7214:31;;15793:12;;;7202:44;15826:6;15869:12;;;15863:19;15848:13;;;15841:42;15903:6;15946:12;;;15940:19;7214:31;;16003:13;;;7202:44;16037:6;16080:12;;;16074:19;16059:13;;;16052:42;16114:6;16157:12;;;16151:19;7214:31;;16214:13;;;7202:44;16248:6;16291:12;;;16285:19;16270:13;;;16263:42;16325:6;16368:12;;;16362:19;7214:31;;16425:13;;;7202:44;;;;16487:4;16476:16;;;16470:23;13043:12;;13036:20;13029:28;16554:6;16545:16;;13017:41;13096:16;;;13090:23;13074:14;;;13067:47;13160:4;13149:16;;;13143:23;13236:21;;13220:14;;;13213:45;13307:4;13296:16;;13290:23;13274:14;;;13267:47;13363:4;13352:16;;13346:23;13330:14;;;13323:47;13193:3;13408:16;;13402:23;13386:14;;;13379:47;13479:4;13468:16;;;13462:23;13458:32;;;13442:14;;;13435:56;16600:16;;16594:23;16642:6;16633:16;;16626:28;;;16675:60;16722:12;;;16594:23;16675:60;:::i;:::-;16663:72;;;16784:4;16777:5;16773:16;16767:23;16799:53;16844:6;16839:3;16835:16;16818:15;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;16799:53;-1:-1:-1;16868:4:37;14425:2453;-1:-1:-1;;;14425:2453:37:o;16883:412::-;17128:6;17117:9;17110:25;17171:6;17166:2;17155:9;17151:18;17144:34;17214:2;17209;17198:9;17194:18;17187:30;17091:4;17234:55;17285:2;17274:9;17270:18;17262:6;17234:55;:::i;17300:396::-;17386:19;;17374:32;;-1:-1:-1;;;;;17442:36:37;17472:4;17461:16;;17442:36;:::i;:::-;17438:62;17431:4;17426:3;17422:14;17415:86;17557:4;17550:5;17546:16;17533:30;17526:4;17521:3;17517:14;17510:54;17620:4;17613:5;17609:16;17596:30;17589:4;17584:3;17580:14;17573:54;17683:4;17676:5;17672:16;17659:30;17652:4;17647:3;17643:14;17636:54;;;17300:396::o;17701:311::-;17789:19;;;17771:3;-1:-1:-1;;;;;17820:31:37;;17817:51;;;17864:1;17861;17854:12;17817:51;17900:6;17897:1;17893:14;17952:8;17945:5;17938:4;17933:3;17929:14;17916:45;17981:18;;;;18001:4;17977:29;;17701:311;-1:-1:-1;;;17701:311:37:o;18017:520::-;18087:5;18094:6;18154:3;18141:17;18240:2;18236:7;18225:8;18209:14;18205:29;18201:43;18181:18;18177:68;18167:96;;18259:1;18256;18249:12;18167:96;18287:33;;18391:4;18378:18;;;-1:-1:-1;18339:21:37;;-1:-1:-1;;;;;;18408:30:37;;18405:50;;;18451:1;18448;18441:12;18405:50;18505:6;18502:1;18498:14;18482;18478:35;18471:5;18467:47;18464:67;;;18527:1;18524;18517:12;18542:447;18642:6;18637:3;18630:19;18612:3;18668:4;18697:2;18692:3;18688:12;18681:19;;18723:5;18746:1;18756:208;18770:6;18767:1;18764:13;18756:208;;;-1:-1:-1;;;;;18835:26:37;18854:6;18835:26;:::i;:::-;18831:52;18819:65;;18904:12;;;;18939:15;;;;18792:1;18785:9;18756:208;;;-1:-1:-1;18980:3:37;;18542:447;-1:-1:-1;;;;;18542:447:37:o;18994:266::-;19082:6;19077:3;19070:19;19134:6;19127:5;19120:4;19115:3;19111:14;19098:43;-1:-1:-1;19186:1:37;19161:16;;;19179:4;19157:27;;;19150:38;;;;19242:2;19221:15;;;-1:-1:-1;;19217:29:37;19208:39;;;19204:50;;18994:266::o;19265:500::-;19323:5;19330:6;19390:3;19377:17;19476:2;19472:7;19461:8;19445:14;19441:29;19437:43;19417:18;19413:68;19403:96;;19495:1;19492;19485:12;19403:96;19523:33;;19627:4;19614:18;;;-1:-1:-1;19575:21:37;;-1:-1:-1;;;;;;19644:30:37;;19641:50;;;19687:1;19684;19677:12;19641:50;19734:6;19718:14;19714:27;19707:5;19703:39;19700:59;;;19755:1;19752;19745:12;19770:296;19840:5;19899:3;19886:17;19985:3;19981:8;19970;19954:14;19950:29;19946:44;19926:18;19922:69;19912:97;;20005:1;20002;19995:12;19912:97;20027:33;;;;19770:296;-1:-1:-1;;19770:296:37:o;20071:2501::-;20190:6;20185:3;20178:19;20160:3;20216:4;20257:2;20252:3;20248:12;20282:11;20309;20302:18;;20339:1;20329:11;;20380:6;20376:2;20372:15;20365:5;20361:27;20411:5;20434:1;20455;20465:2081;20481:6;20476:3;20473:15;20465:2081;;;20556:5;20550:4;20546:16;20541:3;20534:29;20586:57;20636:6;20629:5;20586:57;:::i;:::-;20666:4;20717:50;20764:2;20760;20717:50;:::i;:::-;20793:2;20787:4;20780:16;20823:80;20899:2;20893:4;20889:13;20875:12;20861;20823:80;:::i;:::-;20809:94;;;;20954:59;21009:2;21005;21001:11;20997:2;20954:59;:::i;:::-;21060:4;21052:6;21048:17;21043:2;21037:4;21033:13;21026:40;21093:77;21163:6;21147:14;21131;21093:77;:::i;:::-;21079:91;;;;21193:4;21248:59;21303:2;21299;21295:11;21291:2;21248:59;:::i;:::-;21354:4;21346:6;21342:17;21337:2;21331:4;21327:13;21320:40;21387:77;21457:6;21441:14;21425;21387:77;:::i;:::-;21373:91;;;;;21487:4;21542:59;21597:2;21593;21589:11;21585:2;21542:59;:::i;:::-;21636:17;;;21621:13;;;21614:40;;;;21699:30;;;21751:15;;;;21809:23;;;21797:36;;21793:45;;21867:14;21905:1;21919:432;21935:14;21930:3;21927:23;21919:432;;;22022:19;;;-1:-1:-1;;22018:33:37;22004:48;;22105:56;22152:8;22136:14;22105:56;:::i;:::-;22188:63;22244:6;22229:13;22214;22188:63;:::i;:::-;22178:73;;;;22294:2;22284:8;22280:17;22268:29;;22334:2;22327:5;22323:14;22314:23;;21969:1;21964:3;21960:11;21953:18;;21919:432;;;-1:-1:-1;;22374:4:37;22426:11;;;22413:25;22398:13;;;;22391:48;;;;-1:-1:-1;;;22524:12:37;;;;22460:6;-1:-1:-1;22489:15:37;;;;20507:1;20498:11;20465:2081;;;-1:-1:-1;22562:4:37;;20071:2501;-1:-1:-1;;;;;;;;;20071:2501:37:o;22577:788::-;22715:6;22710:3;22703:19;22685:3;22741:4;22782:2;22777:3;22773:12;22807:11;22834;22827:18;;22884:6;22881:1;22877:14;22870:5;22866:26;22854:38;;22915:5;22938:1;22948:391;22962:6;22959:1;22956:13;22948:391;;;23033:5;23027:4;23023:16;23018:3;23011:29;23089:57;23139:6;23132:5;23089:57;:::i;:::-;23167:92;23254:4;23239:13;23224;23167:92;:::i;:::-;23317:12;;;;23159:100;-1:-1:-1;;;23282:15:37;;;;22984:1;22977:9;22948:391;;;-1:-1:-1;23355:4:37;;22577:788;-1:-1:-1;;;;;;;22577:788:37:o;23370:2126::-;23493:6;23488:3;23481:19;23463:3;23519:4;23560:2;23555:3;23551:12;23585:11;23612;23605:18;;23662:6;23659:1;23655:14;23648:5;23644:26;23632:38;;23693:5;23716:1;23737;23747:1723;23763:6;23758:3;23755:15;23747:1723;;;23838:5;23832:4;23828:16;23823:3;23816:29;23897:6;23884:20;23987:3;23983:8;23975:5;23959:14;23955:26;23951:41;23931:18;23927:66;23917:94;;24007:1;24004;23997:12;23917:94;24039:30;;24124:21;;24111:35;;24092:6;24179:36;24198:16;;;24179:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24261:13;;;7202:44;24298:4;24337:36;24356:16;;;24337:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24421:13;;;7202:44;24458:4;24497:36;24516:16;;;24497:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24581:13;;;7202:44;24618:4;24670:16;;;24657:30;24642:13;;;24635:53;24711:4;24763:16;;;24750:30;24735:13;;;24728:53;24804:4;24856:16;;;24843:30;24828:13;;;24821:53;24897:4;24949:16;;;24936:30;24921:13;;;24914:53;24990:6;25031:33;25047:16;;;25031:33;:::i;:::-;5353:13;5346:21;25109:13;;;5334:34;25147:6;25202:58;25242:17;;;25246:7;25202:58;:::i;:::-;25166:94;;25296:2;25290:3;25284:4;25280:14;25273:26;25320:70;25386:2;25380:4;25376:13;25362:12;25346:14;25320:70;:::i;:::-;25448:12;;;;25312:78;-1:-1:-1;;;25413:15:37;;;;-1:-1:-1;;23789:1:37;23780:11;23747:1723;;;-1:-1:-1;25486:4:37;;23370:2126;-1:-1:-1;;;;;;;;23370:2126:37:o;25501:1339::-;26186:25;;;-1:-1:-1;;;;;26247:32:37;;26242:2;26227:18;;26220:60;26145:4;26174:3;26289:66;26351:2;26336:18;;26328:6;26289:66;:::i;:::-;26392:2;26386:3;26375:9;26371:19;26364:31;26418:73;26487:2;26476:9;26472:18;26464:6;26456;26418:73;:::i;:::-;26404:87;;26540:9;26532:6;26528:22;26522:3;26511:9;26507:19;26500:51;26574:99;26666:6;26658;26650;26574:99;:::i;:::-;26560:113;;26722:9;26714:6;26710:22;26704:3;26693:9;26689:19;26682:51;26750:84;26827:6;26819;26811;26750:84;:::i;:::-;26742:92;25501:1339;-1:-1:-1;;;;;;;;;;;;25501:1339:37:o;26845:2540::-;27003:6;26998:3;26991:19;26973:3;27029:4;27070:2;27065:3;27061:12;27095:11;27122;27115:18;;27152:1;27142:11;;27193:6;27189:2;27185:15;27178:5;27174:27;27224:5;27247:1;27268;27278:2081;27294:6;27289:3;27286:15;27278:2081;;;27369:5;27363:4;27359:16;27354:3;27347:29;27399:57;27449:6;27442:5;27399:57;:::i;:::-;27479:4;27530:50;27577:2;27573;27530:50;:::i;:::-;27606:2;27600:4;27593:16;27636:80;27712:2;27706:4;27702:13;27688:12;27674;27636:80;:::i;:::-;27622:94;;;;27767:59;27822:2;27818;27814:11;27810:2;27767:59;:::i;:::-;27873:4;27865:6;27861:17;27856:2;27850:4;27846:13;27839:40;27906:77;27976:6;27960:14;27944;27906:77;:::i;:::-;27892:91;;;;28006:4;28061:59;28116:2;28112;28108:11;28104:2;28061:59;:::i;:::-;28167:4;28159:6;28155:17;28150:2;28144:4;28140:13;28133:40;28200:77;28270:6;28254:14;28238;28200:77;:::i;:::-;28186:91;;;;;28300:4;28355:59;28410:2;28406;28402:11;28398:2;28355:59;:::i;:::-;28449:17;;;28434:13;;;28427:40;;;;28512:30;;;28564:15;;;;28622:23;;;28610:36;;28606:45;;28680:14;28718:1;28732:432;28748:14;28743:3;28740:23;28732:432;;;28835:19;;;-1:-1:-1;;28831:33:37;28817:48;;28918:56;28965:8;28949:14;28918:56;:::i;:::-;29001:63;29057:6;29042:13;29027;29001:63;:::i;:::-;28991:73;;;;29107:2;29097:8;29093:17;29081:29;;29147:2;29140:5;29136:14;29127:23;;28782:1;28777:3;28773:11;28766:18;;28732:432;;;-1:-1:-1;;29187:4:37;29239:11;;;29226:25;29211:13;;;;29204:48;;;;-1:-1:-1;;;29337:12:37;;;;29273:6;-1:-1:-1;29302:15:37;;;;27320:1;27311:11;27278:2081;;29390:1787;29968:4;29997:3;30027:6;30016:9;30009:25;30053:2;30120:1;30116;30111:3;30107:11;30103:19;30095:6;30091:32;30086:2;30075:9;30071:18;30064:60;30133:66;30195:2;30184:9;30180:18;30172:6;30133:66;:::i;:::-;30236:2;30230:3;30219:9;30215:19;30208:31;30262:73;30331:2;30320:9;30316:18;30308:6;30300;30262:73;:::i;:::-;30372:22;;;30366:3;30351:19;;30344:51;30430:22;;;30248:87;-1:-1:-1;30468:15:37;;;30526:1;30522:14;;;30510:27;;30506:36;;30565:6;30589:1;30599:452;30613:6;30610:1;30607:13;30599:452;;;30678:19;;;-1:-1:-1;;30674:33:37;30662:46;;30757:58;30808:6;30800;30757:58;:::i;:::-;30838:133;30964:6;30949:13;30934;30838:133;:::i;:::-;31029:12;;;;30828:143;-1:-1:-1;;;30994:15:37;;;;30635:1;30628:9;30599:452;;;30603:3;;31100:9;31092:6;31088:22;31082:3;31071:9;31067:19;31060:51;31128:43;31164:6;31156;31128:43;:::i;:::-;31120:51;29390:1787;-1:-1:-1;;;;;;;;;;;;;;29390:1787:37:o;31182:184::-;31252:6;31305:2;31293:9;31284:7;31280:23;31276:32;31273:52;;;31321:1;31318;31311:12;31273:52;-1:-1:-1;31344:16:37;;31182:184;-1:-1:-1;31182:184:37:o;31371:601::-;31672:6;31661:9;31654:25;31715:6;31710:2;31699:9;31695:18;31688:34;31758:6;31753:2;31742:9;31738:18;31731:34;31830:1;31826;31821:3;31817:11;31813:19;31805:6;31801:32;31796:2;31785:9;31781:18;31774:60;31871:3;31865;31854:9;31850:19;31843:32;31635:4;31892:74;31961:3;31950:9;31946:19;31938:6;31930;31892:74;:::i;31977:815::-;32366:6;32355:9;32348:25;32409:6;32404:2;32393:9;32389:18;32382:34;32452:6;32447:2;32436:9;32432:18;32425:34;32524:1;32520;32515:3;32511:11;32507:19;32499:6;32495:32;32490:2;32479:9;32475:18;32468:60;32565:3;32559;32548:9;32544:19;32537:32;32329:4;32592:74;32661:3;32650:9;32646:19;32638:6;32630;32592:74;:::i;:::-;32715:9;32707:6;32703:22;32697:3;32686:9;32682:19;32675:51;32743:43;32779:6;32771;32743:43;:::i;:::-;32735:51;31977:815;-1:-1:-1;;;;;;;;;;31977:815:37:o;32797:715::-;33188:25;;;-1:-1:-1;;;;;33249:32:37;;33244:2;33229:18;;33222:60;33147:4;33176:3;33291:66;33353:2;33338:18;;33330:6;33291:66;:::i;:::-;33394:2;33388:3;33377:9;33373:19;33366:31;33414:92;33502:2;33491:9;33487:18;33479:6;33471;33414:92;:::i;33517:968::-;33996:25;;;-1:-1:-1;;;;;34057:32:37;;34052:2;34037:18;;34030:60;33955:4;33984:3;34099:66;34161:2;34146:18;;34138:6;34099:66;:::i;:::-;34202:2;34196:3;34185:9;34181:19;34174:31;34228:131;34355:2;34344:9;34340:18;34332:6;34324;34228:131;:::i;:::-;34214:145;;34408:9;34400:6;34396:22;34390:3;34379:9;34375:19;34368:51;34436:43;34472:6;34464;34436:43;:::i;34490:503::-;34763:6;34752:9;34745:25;34806:6;34801:2;34790:9;34786:18;34779:34;34849:6;34844:2;34833:9;34829:18;34822:34;34892:3;34887:2;34876:9;34872:18;34865:31;34726:4;34913:74;34982:3;34971:9;34967:19;34959:6;34951;34913:74;:::i;:::-;34905:82;34490:503;-1:-1:-1;;;;;;;34490:503:37:o;34998:717::-;35359:6;35348:9;35341:25;35402:6;35397:2;35386:9;35382:18;35375:34;35445:6;35440:2;35429:9;35425:18;35418:34;35488:3;35483:2;35472:9;35468:18;35461:31;35322:4;35515:74;35584:3;35573:9;35569:19;35561:6;35553;35515:74;:::i;:::-;35638:9;35630:6;35626:22;35620:3;35609:9;35605:19;35598:51;35666:43;35702:6;35694;35666:43;:::i;35720:640::-;36055:25;;;-1:-1:-1;;;;;36116:32:37;;36111:2;36096:18;;36089:60;36014:4;36043:3;36158:66;36220:2;36205:18;;36197:6;36158:66;:::i;:::-;36261:2;36255:3;36244:9;36240:19;36233:31;36281:73;36350:2;36339:9;36335:18;36327:6;36319;36281:73;:::i;36365:854::-;36788:25;;;-1:-1:-1;;;;;36849:32:37;;36844:2;36829:18;;36822:60;36747:4;36776:3;36891:66;36953:2;36938:18;;36930:6;36891:66;:::i;:::-;36994:2;36988:3;36977:9;36973:19;36966:31;37020:73;37089:2;37078:9;37074:18;37066:6;37058;37020:73;:::i;37732:436::-;37993:25;;;-1:-1:-1;;;;;38054:32:37;;38049:2;38034:18;;38027:60;37980:3;37965:19;;38096:66;38158:2;38143:18;;38135:6;38096:66;:::i;38173:622::-;38508:25;;;-1:-1:-1;;;;;38569:32:37;;38564:2;38549:18;;38542:60;38467:4;38496:3;38611:66;38673:2;38658:18;;38650:6;38611:66;:::i;:::-;38714:2;38708:3;38697:9;38693:19;38686:31;38734:55;38785:2;38774:9;38770:18;38762:6;38734:55;:::i;38800:1242::-;39416:4;39445:3;39475:6;39464:9;39457:25;39491:66;39553:2;39542:9;39538:18;39530:6;39491:66;:::i;:::-;39594:2;39588:3;39577:9;39573:19;39566:31;39620:73;39689:2;39678:9;39674:18;39666:6;39658;39620:73;:::i;:::-;39606:87;;39742:9;39734:6;39730:22;39724:3;39713:9;39709:19;39702:51;39776:99;39868:6;39860;39852;39776:99;:::i;:::-;39762:113;;39924:9;39916:6;39912:22;39906:3;39895:9;39891:19;39884:51;39952:84;40029:6;40021;40013;39952:84;:::i;:::-;39944:92;38800:1242;-1:-1:-1;;;;;;;;;;;38800:1242:37:o;41551:598::-;41910:6;41899:9;41892:25;41926:66;41988:2;41977:9;41973:18;41965:6;41926:66;:::i;:::-;42029:3;42023;42012:9;42008:19;42001:32;41873:4;42050:93;42138:3;42127:9;42123:19;42115:6;42107;42050:93;:::i;42504:331::-;42609:9;42620;42662:8;42650:10;42647:24;42644:44;;;42684:1;42681;42674:12;42644:44;42713:6;42703:8;42700:20;42697:40;;;42733:1;42730;42723:12;42697:40;-1:-1:-1;;42759:23:37;;;42804:25;;;;;-1:-1:-1;42504:331:37:o;42840:255::-;42960:19;;42999:2;42991:11;;42988:101;;;-1:-1:-1;;43060:2:37;43056:12;;;43053:1;43049:20;43045:33;43034:45;42840:255;;;;:::o;43100:390::-;43317:6;43306:9;43299:25;43360:6;43355:2;43344:9;43340:18;43333:34;43403:2;43398;43387:9;43383:18;43376:30;43280:4;43423:61;43480:2;43469:9;43465:18;43457:6;43449;43423:61;:::i;44208:127::-;44269:10;44264:3;44260:20;44257:1;44250:31;44300:4;44297:1;44290:15;44324:4;44321:1;44314:15;44340:127;44401:10;44396:3;44392:20;44389:1;44382:31;44432:4;44429:1;44422:15;44456:4;44453:1;44446:15;44472:151;44562:4;44555:12;;;44541;;;44537:31;;44580:14;;44577:40;;;44597:18;;:::i;44628:168::-;44701:9;;;44732;;44749:15;;;44743:22;;44729:37;44719:71;;44770:18;;:::i;44801:128::-;44868:9;;;44889:11;;;44886:37;;;44903:18;;:::i;45336:135::-;45375:3;45396:17;;;45393:43;;45416:18;;:::i;:::-;-1:-1:-1;45463:1:37;45452:13;;45336:135::o","linkReferences":{"contracts/8/router/DagRouter.sol":{"DagRouter":[{"start":2080,"length":20},{"start":4498,"length":20}]},"contracts/8/router/UnxswapRouter.sol":{"UnxswapRouter":[{"start":1793,"length":20},{"start":3098,"length":20},{"start":3846,"length":20}]},"contracts/8/router/SwapWrapRouter.sol":{"SwapWrapRouter":[{"start":1236,"length":20},{"start":3290,"length":20}]},"contracts/8/router/SmartSwapRouter.sol":{"SmartSwapRouter":[{"start":1499,"length":20},{"start":3554,"length":20}]},"contracts/8/router/UnxswapV3Router.sol":{"UnxswapV3Router":[{"start":2365,"length":20},{"start":2725,"length":20},{"start":4978,"length":20}]}},"cborAuxdata":{"1":{"value":"0xa2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","offset":13269}},"immutableReferences":{},"transformations":[{"id":"contracts/8/router/DagRouter.sol:DagRouter","type":"replace","offset":2080,"reason":"library"},{"id":"contracts/8/router/DagRouter.sol:DagRouter","type":"replace","offset":4498,"reason":"library"},{"id":"contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter","type":"replace","offset":1499,"reason":"library"},{"id":"contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter","type":"replace","offset":3554,"reason":"library"},{"id":"contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter","type":"replace","offset":1236,"reason":"library"},{"id":"contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter","type":"replace","offset":3290,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":1793,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":3098,"reason":"library"},{"id":"contracts/8/router/UnxswapRouter.sol:UnxswapRouter","type":"replace","offset":3846,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":2365,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":2725,"reason":"library"},{"id":"contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router","type":"replace","offset":4978,"reason":"library"},{"id":"1","type":"replace","offset":13269,"reason":"cborAuxdata"}],"transformationValues":{"libraries":{"contracts/8/router/DagRouter.sol:DagRouter":"0x408fab3aafc590d99b09e6ad13ad5df73b066526","contracts/8/router/UnxswapRouter.sol:UnxswapRouter":"0x14d28f43301a5a6277afad65e9817e0a12ea0fec","contracts/8/router/SwapWrapRouter.sol:SwapWrapRouter":"0x057d1e699296cced17696c442e637dca69b34e1a","contracts/8/router/SmartSwapRouter.sol:SmartSwapRouter":"0xbf0824d673a73c67287059fd351794284646b8d7","contracts/8/router/UnxswapV3Router.sol:UnxswapV3Router":"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f"},"cborAuxdata":{"1":"0xa264697066735822122037dd5e1ad0c3bcf0764c3605f7cf3d7c93f2b529638f61386f1c79adce923a3664736f6c63430008110033"}}},"deployment":{"transactionHash":"0x4d90539ecba9dbc18047f99ac54efcdab25304b3e1f104662db2622068ae9186","blockNumber":"25599885","transactionIndex":"101","deployer":"0xEB33b04b8731966DA91990C681f880F379050f33"},"sources":{"contracts/8/DexRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"./libraries/EthReceiver.sol\";\nimport \"./libraries/PMMLib.sol\";\nimport \"./libraries/PausableModuleV2.sol\";\nimport \"./libraries/ExtraDataLib.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nimport \"./interfaces/IDexRouter.sol\";\nimport \"./interfaces/IUniswapV3SwapCallback.sol\";\n\nimport \"./router/SmartSwapRouter.sol\";\nimport \"./router/DagRouter.sol\";\nimport \"./router/UnxswapRouter.sol\";\nimport \"./router/UnxswapV3Router.sol\";\nimport \"./router/SwapWrapRouter.sol\";\n\ncontract DexRouter is EthReceiver, IDexRouter, IUniswapV3SwapCallback, PausableModuleV2, ReentrancyGuard {\n\n    string public constant version = \"v1.0.10-rfq-anti-arbitrage\";\n\n    constructor(address _owner) PausableModuleV2(_owner) ReentrancyGuard() {}\n\n    /// ================================ smartSwap related ================================\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param pmmRequests PMM swap requests (currently used only for calldata length calculation, not for swap logic).\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function smartSwapByOrderId(\n        uint256 orderId,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        RouterPath[][] calldata batches,\n        PMMLib.PMMSwapRequest[] calldata pmmRequests\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, baseRequest, batchesAmount, batches, pmmRequests).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SmartSwapRouter.smartSwapTo(orderId, msg.sender, baseRequest, batchesAmount, batches, extraData);\n    }\n\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param receiver Address to receive the output tokens from the swap.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param pmmRequests PMM swap requests (currently used only for calldata length calculation, not for swap logic).\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function smartSwapTo(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        RouterPath[][] calldata batches,\n        PMMLib.PMMSwapRequest[] calldata pmmRequests\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, batchesAmount, batches, pmmRequests).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SmartSwapRouter.smartSwapTo(orderId, receiver, baseRequest, batchesAmount, batches, extraData);\n    }\n\n    /// ================================ dagSwap related ================================\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function dagSwapByOrderId(\n        uint256 orderId,\n        BaseRequest calldata baseRequest,\n        RouterPath[] calldata paths\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(orderId, baseRequest, paths).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return DagRouter.dagSwapTo(orderId, msg.sender, baseRequest, paths, extraData);\n    }\n\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function dagSwapTo(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        RouterPath[] calldata paths\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, paths).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return DagRouter.dagSwapTo(orderId, receiver, baseRequest, paths, extraData);\n    }\n\n    /// ============================== uniswapV3Swap related ==============================\n    /// @notice Executes a swap using the Uniswap V3 protocol.\n    /// @param receiver The address that will receive the swap funds (encoded as uint256 with order ID mask).\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.\n    /// @param pools An array of pool identifiers used to define the swap route within Uniswap V3.\n    /// @return returnAmount The amount of tokens received after the completion of the swap.\n    function uniswapV3SwapTo(\n        uint256 receiver,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(receiver, amount, minReturn, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapV3Router.uniswapV3SwapTo(receiver, amount, minReturn, pools, extraData);\n    }\n\n    /// @notice Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function uniswapV3SwapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata pools\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapV3Router.uniswapV3SwapToWithBaseRequest(orderId, receiver, baseRequest, pools, extraData);\n    }\n\n    /// ============================== unxswap related ==============================\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapByOrderId(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        bytes32[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(srcToken, amount, minReturn, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapTo(srcToken, amount, minReturn, msg.sender, pools, extraData);\n    }\n\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param receiver The address where the swapped tokens will be sent.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapTo(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        address receiver,\n        bytes32[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(srcToken, amount, minReturn, receiver, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapTo(srcToken, amount, minReturn, receiver, pools, extraData);\n    }\n\n    /// @notice Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        bytes32[] calldata pools\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapToWithBaseRequest(orderId, receiver, baseRequest, pools, extraData);\n    }\n\n    /// ================================ swapWrap related ================================\n    /// @notice Executes a simple swap between ETH and WETH using encoded parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param rawdata Encoded data containing swap direction, transfer mode and amount information using bit masks.\n    /// @dev This function supports bidirectional swaps between ETH and WETH with minimal gas overhead.\n    /// The rawdata parameter encodes:\n    /// - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH\n    function swapWrap(uint256 orderId, uint256 rawdata) external payable nonReentrant whenNotPaused {\n        uint256 swapDataLength = 4 + abi.encode(orderId, rawdata).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SwapWrapRouter.swapWrap(orderId, rawdata, extraData);\n    }\n\n    /// @notice Executes a swap between ETH and WETH using structured base request parameters to a specified receiver.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.\n    /// @dev This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly.\n    /// It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.\n    function swapWrapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SwapWrapRouter.swapWrapToWithBaseRequest(orderId, receiver, baseRequest, extraData);\n    }\n\n    /// ================================ uniswapV3Callback ==============================\n    /// @notice callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter\n    /// @dev The first 32 bytes of data is a flag to identify which router to call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external whenNotPaused override {\n        require(data.length >= 32, \"Invalid callback data\");\n        bytes32 flag = bytes32(data[:32]);\n        if (flag == V3_EXACT_IN_CALLBACK_FLAG) {\n            UnxswapV3Router.uniswapV3SwapCallback(amount0Delta, amount1Delta, data);\n        } else {\n            revert(\"Unknown V3 callback flag\");\n        }\n    }\n}\n"},"contracts/8/libraries/EthReceiver.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Base contract with common payable logics\nabstract contract EthReceiver {\n  receive() external payable {\n    // solhint-disable-next-line avoid-tx-origin\n    require(msg.sender != tx.origin, \"ETH deposit rejected\");\n  }\n}\n"},"contracts/8/libraries/PMMLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary PMMLib {\n\n  // ============ Struct ============\n  struct PMMSwapRequest {\n      uint256 pathIndex;\n      address payer;\n      address fromToken;\n      address toToken;\n      uint256 fromTokenAmountMax;\n      uint256 toTokenAmountMax;\n      uint256 salt;\n      uint256 deadLine;\n      bool isPushOrder;\n      bytes extension;\n      // address marketMaker;\n      // uint256 subIndex;\n      // bytes signature;\n      // uint256 source;  1byte type + 1byte bool（reverse） + 0...0 + 20 bytes address\n  }\n\n  struct PMMBaseRequest {\n    uint256 fromTokenAmount;\n    uint256 minReturnAmount;\n    uint256 deadLine;\n    bool fromNative;\n    bool toNative;\n  }\n\n  enum PMM_ERROR {\n      NO_ERROR,\n      INVALID_OPERATOR,\n      QUOTE_EXPIRED,\n      ORDER_CANCELLED_OR_FINALIZED,\n      REMAINING_AMOUNT_NOT_ENOUGH,\n      INVALID_AMOUNT_REQUEST,\n      FROM_TOKEN_PAYER_ERROR,\n      TO_TOKEN_PAYER_ERROR,\n      WRONG_FROM_TOKEN\n  }\n\n  event PMMSwap(\n    uint256 pathIndex,\n    uint256 subIndex,\n    uint256 errorCode\n  );\n\n  error PMMErrorCode(uint256 errorCode);\n\n}"},"contracts/8/libraries/PausableModuleV2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title PausableModuleV2 - Lightweight pause control module\n * @notice Abstract contract providing pause functionality with Owner and Reporter roles\n * @dev This is a gas-optimized implementation with zero external dependencies\n *      Storage optimization: address owner and uint64 pauseUntil are packed into the same slot\n */\nabstract contract PausableModuleV2 {\n    // ============ Constant Variables ============\n\n    /// @notice Zero address constant used for address validation\n    address private constant ZERO_ADDRESS = address(0);\n\n    /// @notice Value indicating contract is not paused\n    /// @dev Using 1 instead of 0 for gas optimization (avoids expensive zero->non-zero SSTORE)\n    uint64 private constant NOT_PAUSED = 1;\n\n    /// @notice Value indicating contract is paused by owner\n    uint64 private constant OWNER_PAUSED = type(uint64).max;\n\n    /// @notice Reporter pause duration (24 hours)\n    uint256 private constant REPORTER_PAUSE_DURATION = 24 hours;\n\n    // ============ Mutable State Variables ============\n\n    /// @notice Contract owner address\n    /// @dev Packed with pauseUntil in the same storage slot\n    address public owner;\n\n    /// @notice Pause state timestamp\n    /// @dev NOT_PAUSED (1) = not paused, type(uint64).max = owner paused, timestamp = reporter paused\n    /// @dev Packed with owner in the same storage slot\n    uint64 public pauseUntil = NOT_PAUSED;\n\n    /// @notice Mapping of reporter addresses\n    mapping(address => bool) public reporters;\n\n\n    // ============ Custom Errors ============\n\n    /// @notice Thrown when contract is already paused\n    error AlreadyPaused();\n\n    /// @notice Thrown when contract is already paused by owner\n    /// @dev This error is thrown when owner tries to pause an already owner-paused contract\n    error AlreadyPausedByOwner();\n\n    /// @notice Thrown when reporter state is already set\n    error AlreadySet();\n\n    /// @notice Thrown when caller is not the owner\n    error NotOwner();\n\n    /// @notice Thrown when caller is not a reporter\n    error NotReporter();\n\n    /// @notice Thrown when contract is not paused\n    error NotPaused();\n\n    /// @notice Thrown when zero address is provided\n    error ZeroAddress();\n\n    // ============ Events ============\n\n    /// @notice Emitted when ownership is transferred\n    /// @param previousOwner Previous owner address\n    /// @param newOwner New owner address\n    event OwnerChanged(address indexed previousOwner, address indexed newOwner);\n\n    /// @notice Emitted when a reporter is added or removed\n    /// @param reporter Reporter address\n    /// @param added True if added, false if removed\n    event ReporterUpdated(address indexed reporter, bool added);\n\n    /// @notice Emitted when contract is paused by owner\n    event OwnerPaused();\n\n    /// @notice Emitted when contract is unpaused by owner\n    event OwnerUnpaused();\n\n    /// @notice Emitted when contract is paused by reporter\n    /// @param reporter Reporter address that triggered the pause\n    /// @param until Timestamp when pause will automatically expire\n    event ReporterPaused(address indexed reporter, uint64 until);\n\n    // ============ Modifiers ============\n\n    /// @notice Modifier to ensure contract is not paused\n    modifier whenNotPaused() {\n        if (block.timestamp < pauseUntil) revert AlreadyPaused();\n        _;\n    }\n\n    /// @notice Modifier to restrict access to owner only\n    modifier onlyOwner() {\n        if (msg.sender != owner) revert NotOwner();\n        _;\n    }\n\n    /// @notice Modifier to restrict access to reporters only\n    modifier onlyReporter() {\n        if (!reporters[msg.sender]) revert NotReporter();\n        _;\n    }\n\n    // ============ Constructor ============\n\n    /// @notice Constructor to initialize the contract with an owner\n    /// @param _owner Initial owner address\n    constructor(address _owner) {\n        if (_owner == ZERO_ADDRESS) revert ZeroAddress();\n        owner = _owner;\n    }\n\n    // ============ Owner Functions ============\n\n    /// @notice Transfer ownership to a new address\n    /// @dev Only callable by the current owner\n    /// @dev Emits OwnerChanged event with previousOwner (current owner) and newOwner\n    /// @param newOwner New owner address\n    function transferOwnership(address newOwner) external onlyOwner {\n        if (newOwner == ZERO_ADDRESS) revert ZeroAddress();\n        address previousOwner = owner;\n        owner = newOwner;\n        emit OwnerChanged(previousOwner, newOwner);\n    }\n\n    /// @notice Add or remove a reporter\n    /// @dev Only callable by the owner\n    /// @param reporter Reporter address to add or remove\n    /// @param added True to add, false to remove\n    function setReporter(address reporter, bool added) external onlyOwner {\n        if (reporter == ZERO_ADDRESS) revert ZeroAddress();\n        if (reporters[reporter] == added) revert AlreadySet();\n        reporters[reporter] = added;\n        emit ReporterUpdated(reporter, added);\n    }\n\n    /// @notice Pause the contract (until manually unpaused by owner)\n    /// @dev Only callable by the owner\n    /// @dev Sets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pause\n    /// @dev Reverts if contract is already paused by owner\n    /// @dev Owner can override reporter pause (temporary pause) by calling this function\n    function pause() external onlyOwner {\n        if(pauseUntil == OWNER_PAUSED) revert AlreadyPausedByOwner();\n\n        pauseUntil = OWNER_PAUSED;\n        emit OwnerPaused();\n    }\n\n    /// @notice Unpause the contract\n    /// @dev Only callable by the owner\n    /// @dev Resets pauseUntil to NOT_PAUSED, clearing both owner and reporter pauses\n    /// @dev Reverts if contract is not paused\n    /// @dev Gas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause\n    function unpause() external onlyOwner {\n        if(!isPaused()) revert NotPaused();\n\n        pauseUntil = NOT_PAUSED;\n        emit OwnerUnpaused();\n    }\n\n    // ============ Reporter Functions ============\n\n    /// @notice Pause the contract for 24 hours\n    /// @dev Only callable by a reporter\n    /// @dev Reverts if contract is already paused\n    /// @dev Sets pauseUntil to block.timestamp + 24 hours\n    function pauseByReporter() external onlyReporter whenNotPaused {\n        pauseUntil = uint64(block.timestamp + REPORTER_PAUSE_DURATION);\n        emit ReporterPaused(msg.sender, pauseUntil);\n    }\n\n    // ============ View Functions ============\n\n    /// @notice Check if the contract is currently paused\n    /// @return True if paused, false otherwise\n    /// @dev Returns true if block.timestamp < pauseUntil\n    function isPaused() public view returns (bool) {\n        return block.timestamp < pauseUntil;\n    }\n}"},"contracts/8/libraries/ExtraDataLib.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"./EventLib.sol\";\n\n/*\n * To decode extra data encoded in calldata and parse to structs\n *\n * The extra data is appended after swapData in calldata, and parsed from the end (right to left).\n * All extra data fields are optional and can be omitted if not needed.\n *\n * Calldata Layout (from left to right):\n * ┌──────────┬────────┬──────────┬────────────┬──────────┬────────────┬────────────┐\n * │ swapData │ (memo) │ refundTo │ permit2Info│ trimInfo │ commission │ raw suffix │\n * │ N bytes  │ opt.   │  0/32 B  │   0/M B    │ 0/64/96 B│   0/K B    │  (0..N B)  │\n * └──────────┴────────┴──────────┴────────────┴──────────┴────────────┴────────────┘\n *                      ←─── Extra Data (anchored at endPoints[0]) ───→↑            ↑\n *                                                               endPoints[0]  calldatasize()\n *\n *   - `raw suffix` unstructured trailing bytes (e.g. ERC-8021 transaction-attribution data) that\n *                  may be appended by wallets, aggregators, or front-ends. The scan ignores them.\n *\n * Parsing Order (from right to left, anchored at endPoints[0]):\n * 1. commissionInfo  - Commission/referrer fee configuration (0, 64, 96, or more bytes depending on referrer count)\n * 2. trimInfo        - Trim/surplus handling configuration (0, 64, or 96 bytes)\n * 3. permit2Info     - Permit2 signature data for token approval (0 or variable bytes)\n * 4. refundTo        - Address to receive leftover tokens only for ByInvest mode (0 or 32 bytes)\n*/\n\nlibrary ExtraDataLib {\n    /// @dev Update EXTRA_DATA_TYPE_NUM when adding new extra calldata\n    uint8 internal constant EXTRA_DATA_TYPE_NUM = 4;\n\n    /// @notice Decode extra data and get structs with swapData boundary check\n    /// @param swapDataLength The length of swapData (4 bytes selector + ABI encoded parameters)\n    function getDecodedExtraData(uint256 swapDataLength) internal view returns (IDexRouter.ExtraData memory extraData) {\n        // calldatasize() may extend past the real ExtraData when an external suffix\n        // (e.g. ERC-8021 attribution data) has been appended. _getExtraDataEndPointAndLength\n        // performs a 32-byte aligned backward scan, bounded below by swapDataLength, to recover\n        // the true right edge and writes it into endPoints[0], which then anchors all subsequent\n        // parsing.\n        (uint256[] memory endPoints, uint256[] memory lengths) = _getExtraDataEndPointAndLength(swapDataLength);\n\n        // Validate extraData boundaries against the swapData lower bound.\n        _validateExtraDataBoundaries(endPoints, lengths, swapDataLength);\n\n        extraData = IDexRouter.ExtraData({\n            commissionInfo: _parseCommissionInfo(endPoints[0], lengths[0]),\n            trimInfo: _parseTrimInfo(endPoints[1], lengths[1]),\n            permit2Info: _parsePermit2Info(endPoints[2], lengths[2]),\n            refundTo: _parseRefundTo(endPoints[3], lengths[3])\n        });\n\n        return extraData;\n    }\n\n    // ================================ Private Functions ================================\n    /// @notice Get endPoints and lengths of each extra calldata bytes32.\n    /// @param swapDataLength Lower bound for the scan — anything before this offset is swapData\n    ///                       and cannot contain ExtraData, so the scan stops there.\n    /// @return endPoints The right edge (in calldata bytes) of each region, indexed by type.\n    ///                   endPoints[0] is the right edge of all ExtraData, located via a 32-byte\n    ///                   aligned backward flag scan; it equals calldatasize() when no trailing\n    ///                   suffix has been appended.\n    /// @return lengths   The number of 32-byte words occupied by each region.\n    function _getExtraDataEndPointAndLength(uint256 swapDataLength) private pure returns (\n        uint256[] memory endPoints,\n        uint256[] memory lengths\n    ) {\n        endPoints = new uint256[](EXTRA_DATA_TYPE_NUM);\n        lengths = new uint256[](EXTRA_DATA_TYPE_NUM);\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // Locate the right edge of ExtraData via backward 32-byte aligned flag scan, bounded\n            // below by swapDataLength — bytes before that are guaranteed swapData and cannot hold\n            // ExtraData, so flag-like patterns accidentally living in ABI params are never read.\n            // Initial value strips non-aligned trailing bytes (the external suffix);\n            // if no flag is found, parsing degenerates to \"no ExtraData\" (every length is 0).\n            let endPoint := sub(calldatasize(), mod(sub(calldatasize(), 4), 0x20))\n            for { let scanPos := endPoint } gt(scanPos, swapDataLength) { scanPos := sub(scanPos, 0x20) } {\n                // All four flag masks share the value 0xffffffffffff000…0, so one mask fits all.\n                let flagMasked := and(calldataload(sub(scanPos, 0x20)), _COMMISSION_FLAG_MASK)\n                if or(\n                    or(\n                        or(\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION), eq(flagMasked, TO_TOKEN_COMMISSION)),\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION_DUAL), eq(flagMasked, TO_TOKEN_COMMISSION_DUAL))\n                        ),\n                        or(\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION_MULTIPLE), eq(flagMasked, TO_TOKEN_COMMISSION_MULTIPLE)),\n                            or(eq(flagMasked, TRIM_FLAG), eq(flagMasked, TRIM_DUAL_FLAG))\n                        )\n                    ),\n                    or(\n                        or(eq(flagMasked, PERMIT2_INFO_SIG65_FLAG), eq(flagMasked, PERMIT2_INFO_SIG64_FLAG)),\n                        eq(flagMasked, REFUND_TO_ADDRESS_FLAG)\n                    )\n                ) {\n                    endPoint := scanPos\n                    break\n                }\n            }\n\n            // Get commission data bytes32 endPoint and length (anchor: endPoint)\n            let commissionData := calldataload(sub(endPoint, 0x20))\n            let flag := and(commissionData, _COMMISSION_FLAG_MASK)\n            let referrerNum := 0\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION),\n                eq(flag, TO_TOKEN_COMMISSION)\n            ) {\n                referrerNum := 1\n            }\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION_DUAL),\n                eq(flag, TO_TOKEN_COMMISSION_DUAL)\n            ) {\n                referrerNum := 2\n            }\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION_MULTIPLE),\n                eq(flag, TO_TOKEN_COMMISSION_MULTIPLE)\n            ) {\n                commissionData := calldataload(sub(endPoint, 0x40))\n                referrerNum := shr(240, and(commissionData, _COMMISSION_LENGTH_MASK))\n                if or(lt(referrerNum, MIN_COMMISSION_MULTIPLE_NUM), gt(referrerNum, MAX_COMMISSION_MULTIPLE_NUM)) {\n                    _revertWithReason(\n                        0x0000001520696e76616c6964207265666572726572206e756d00000000000000,\n                        0x59\n                    ) // \"invalid referrer num\"\n                }\n            }\n            let length := 0\n            if gt(referrerNum, 0) {\n                length := add(referrerNum, 1) // bytes32 length for commission is referrerNum + 1 if referrerNum > 0\n            }\n            mstore(add(endPoints, 0x20), endPoint) // commission data endPoint\n            mstore(add(lengths, 0x20), length) // commission data length\n            \n            // Get trim data bytes32 endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for trim data\n            let trimData := calldataload(sub(endPoint, 0x20))\n            flag := and(trimData, _TRIM_FLAG_MASK)\n            length := 0 // refresh length to 0 for trim data\n            if eq(flag, TRIM_FLAG) {\n                length := 2\n            }\n            if eq(flag, TRIM_DUAL_FLAG) {\n                length := 3\n            }\n            mstore(add(endPoints, 0x40), endPoint) // trim data endPoint\n            mstore(add(lengths, 0x40), length) // trim data length\n\n            // Get permit2Info data endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for permit2Info data\n            let permit2InfoData := calldataload(sub(endPoint, 0x20))\n            flag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            length := 0 // refresh length to 0 for permit2Info data\n            if or(\n                eq(flag, PERMIT2_INFO_SIG65_FLAG),\n                eq(flag, PERMIT2_INFO_SIG64_FLAG)\n            ) {\n                let amountLength := shr(200, and(permit2InfoData, _PERMIT2_INFO_AMOUNT_LENGTH_MASK))\n                length := add(amountLength, 4) \n            }\n            mstore(add(endPoints, 0x60), endPoint) // permit2Info data endPoint\n            mstore(add(lengths, 0x60), length) // permit2Info data length\n\n            // Get refundTo data endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for refundTo data\n            let refundToData := calldataload(sub(endPoint, 0x20))\n            length := 0 // refresh length to 0 for refundTo data\n            if eq(and(refundToData, _REFUND_TO_MASK), REFUND_TO_ADDRESS_FLAG) {\n                length := 1\n            }\n            mstore(add(endPoints, 0x80), endPoint) // refundTo data endPoint\n            mstore(add(lengths, 0x80), length) // refundTo data length\n        }\n\n        return (endPoints, lengths);\n    }\n\n    /// @notice Validate extraData boundaries to ensure no overlap with swapData and between regions.\n    /// @param endPoints   Array of end points for each extraData region. endPoints[0] is the scan\n    ///                    anchor (right edge of all ExtraData) produced by the backward flag scan.\n    /// @param lengths     Array of lengths (in 32-byte units) for each extraData region.\n    /// @param swapDataLength The length of swapData (4 bytes selector + ABI encoded parameters).\n    /// @dev endPoints[0] is guaranteed (4 + 32*K)-aligned because it is either `aligned` (computed\n    ///      by stripping non-aligned trailing bytes) or the position of an aligned flag word.\n    function _validateExtraDataBoundaries(\n        uint256[] memory endPoints,\n        uint256[] memory lengths,\n        uint256 swapDataLength\n    ) private pure {\n        // Check 1: Each extraData region must be consecutive (no overlaps or gaps)\n        for (uint256 i = 0; i < EXTRA_DATA_TYPE_NUM - 1; ++i) {\n            require(endPoints[i + 1] == endPoints[i] - lengths[i] * 32, \"ExtraData regions not consecutive\");\n        }\n\n        // Check 2: Last region's startPoint must be >= swapDataLength (no overlap with swapData)\n        require(endPoints[EXTRA_DATA_TYPE_NUM - 1] - lengths[EXTRA_DATA_TYPE_NUM - 1] * 32 >= swapDataLength, \"ExtraData overlaps with swapData\");\n    }\n\n    /// @notice Parse commissionInfo\n    function _parseCommissionInfo(uint256 endPoint, uint256 length) private pure returns (IDexRouter.CommissionInfo memory commissionInfo) {\n        if (length == 0) {\n            return commissionInfo;\n        }\n        uint256 referrerNum = length - 1; // referrerNum is calculated in getExtraDataEndPointAndLength() function\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            let commissionData := calldataload(sub(endPoint, 0x20))\n            let flag := and(commissionData, _COMMISSION_FLAG_MASK)\n            mstore(\n                commissionInfo,\n                or(\n                    or(\n                        eq(flag, FROM_TOKEN_COMMISSION),\n                        eq(flag, FROM_TOKEN_COMMISSION_DUAL)\n                    ),\n                    eq(flag, FROM_TOKEN_COMMISSION_MULTIPLE)\n                )\n            ) // isFromTokenCommission\n            mstore(\n                add(0x20, commissionInfo),\n                or(\n                    or(\n                        eq(flag, TO_TOKEN_COMMISSION),\n                        eq(flag, TO_TOKEN_COMMISSION_DUAL)\n                    ),\n                    eq(flag, TO_TOKEN_COMMISSION_MULTIPLE)\n                )\n            ) // isToTokenCommission\n            mstore(\n                add(0xa0, commissionInfo),\n                shr(160, and(commissionData, _COMMISSION_RATE_MASK))\n            ) // 1st commissionRate\n            mstore(\n                add(0xc0, commissionInfo),\n                and(commissionData, _ADDRESS_MASK)\n            ) // 1st referrerAddress\n            commissionData := calldataload(sub(endPoint, 0x40))\n            let toBCommission := NO_TO_B_MODE // default toBCommission is 1 for no-toB commission when commissionData exists\n            if gt(and(commissionData, _TO_B_COMMISSION_MASK), 0) {\n                toBCommission := TO_B_MODE // toB commission value when commissionData exists\n            }\n            mstore(\n                add(0x60, commissionInfo),\n                toBCommission //toBCommission\n            )\n            mstore(\n                add(0x40, commissionInfo),\n                and(commissionData, _ADDRESS_MASK) //token\n            )\n            mstore(add(0x80, commissionInfo), referrerNum) //commissionLength\n\n            if gt(referrerNum, 1) {\n                for { let i := 1 } lt(i, referrerNum) { i := add(i, 1) } {\n                    commissionData := calldataload(sub(endPoint, add(0x40, mul(i, 0x20))))\n                    let flag2 := and(commissionData, _COMMISSION_FLAG_MASK)\n                    if iszero(eq(flag, flag2)) {\n                        _revertWithReason(\n                            0x0000001820696e76616c696420636f6d6d697373696f6e20666c616700000000,\n                            0x5c\n                        ) // \"invalid commission flag\"\n                    }\n                    mstore(\n                        add(add(0xa0, commissionInfo), mul(i, 0x40)), // 0xa0: commissionRate0, 0xa0 + 0x40 * i: i-th commissionRate\n                        shr(160, and(commissionData, _COMMISSION_RATE_MASK))\n                    ) //i-th commissionRate\n                    mstore(\n                        add(add(0xc0, commissionInfo), mul(i, 0x40)), // 0xc0: referrerAddress0, 0xc0 + 0x40 * i: i-th referrerAddress\n                        and(commissionData, _ADDRESS_MASK)\n                    ) //i-th referrerAddress\n                }\n            }\n        }\n        return commissionInfo;\n    }\n\n    /// @notice Parse trimInfo\n    function _parseTrimInfo(uint256 endPoint, uint256 length) private pure returns (IDexRouter.TrimInfo memory trimInfo) {\n        if (length == 0) {\n            return trimInfo;\n        }\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // get first bytes32 of trim data\n            let trimData := calldataload(sub(endPoint, 0x20))\n            let trimFlag := and(trimData, _TRIM_FLAG_MASK)\n            let hasTrim := or(\n                eq(trimFlag, TRIM_FLAG),\n                eq(trimFlag, TRIM_DUAL_FLAG)\n            )\n            mstore(\n                trimInfo,\n                hasTrim\n            ) // hasTrim\n            switch eq(hasTrim, 1)\n            case 1{\n                mstore(\n                    add(0x20, trimInfo),\n                    shr(160, and(trimData, _TRIM_RATE_MASK))\n                ) // trimRate\n                mstore(\n                    add(0x40, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // trimAddress\n                // get second bytes32 of trim data\n                trimData := calldataload(sub(endPoint, 0x40))\n                let flag := and(trimData, _TRIM_FLAG_MASK)\n                if iszero(eq(trimFlag, flag)) {\n                    _revertWithReason(\n                        0x0000001220696e76616c6964207472696d20666c616700000000000000000000,\n                        0x56\n                    ) // \"invalid trim flag\"\n                }\n                let toBTrim := NO_TO_B_MODE // default toBTrim is 1 for no-toB trim when trimData exists\n                if gt(and(trimData, _TO_B_TRIM_MASK), 0) {\n                    toBTrim := TO_B_MODE // toB trim value when trimData exists\n                }\n                mstore(\n                    add(0x60, trimInfo),\n                    toBTrim //toBTrim\n                )\n                mstore(\n                    add(0x80, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // expectAmountOut\n            }\n            default {\n                mstore(add(0x20, trimInfo), 0) // trimRate\n                mstore(add(0x40, trimInfo), 0) // trimAddress\n                mstore(add(0x60, trimInfo), 0) // toBTrim\n                mstore(add(0x80, trimInfo), 0) // expectAmountOut\n            }\n            switch eq(trimFlag, TRIM_DUAL_FLAG)\n            case 1 {\n                // get third bytes32 of trim data\n                trimData := calldataload(sub(endPoint, 0x60))\n                let flag := and(trimData, _TRIM_FLAG_MASK)\n                if iszero(eq(trimFlag, flag)) {\n                    _revertWithReason(\n                        0x0000001220696e76616c6964207472696d20666c616700000000000000000000,\n                        0x56\n                    ) // \"invalid trim flag\"\n                }\n                mstore(\n                    add(0xa0, trimInfo),\n                    shr(160, and(trimData, _TRIM_RATE_MASK))\n                ) // chargeRate\n                mstore(\n                    add(0xc0, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // chargeAddress\n            }\n            default {\n                mstore(add(0xa0, trimInfo), 0) // chargeRate\n                mstore(add(0xc0, trimInfo), 0) // chargeAddress\n            }\n        }\n        return trimInfo;\n    }\n\n    /// @notice Parse permit2Info\n    function _parsePermit2Info(uint256 endPoint, uint256 length) private view returns (IDexRouter.Permit2Info memory permit2Info) {\n        if (length == 0) {\n            return permit2Info;\n        }\n        // Since length == amountLength + 4, so here when length != 0, the length of permit2Info.amounts is length - 4.\n        permit2Info.amounts = new uint256[](length - 4);\n        uint256 permit2InfoFlag;\n        uint256[] memory permit2SignatureCache = new uint256[](3); // signature r, signature s, signature v\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // get first bytes32 of permit2Info\n            let permit2InfoData := calldataload(sub(endPoint, 0x20))\n            permit2InfoFlag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            // The first permit2InfoFlag has been verified in getExtraDataEndPointAndLength() function\n            let amountLength := sub(length, 4)\n            mstore(permit2Info, and(permit2InfoData, _ADDRESS_MASK)) // owner\n\n            // get second bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x40))\n            let flag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            if iszero(eq(permit2InfoFlag, flag)) {\n                _revertWithReason(\n                    0x0000001920696e76616c6964207065726d697432496e666f20666c6167000000,\n                    0x5d\n                ) // \"invalid permit2Info flag\"\n            }\n            mstore(add(permit2Info, 0x20), and(permit2InfoData, _PERMIT2_INFO_NONCE_MASK)) // nonce\n            mstore(add(permit2Info, 0x40), shr(48, and(permit2InfoData, _PERMIT2_INFO_DEADLINE_MASK))) // deadline\n            if eq(permit2InfoFlag, PERMIT2_INFO_SIG65_FLAG) {\n                mstore(add(permit2SignatureCache, 0x60), shr(96, and(permit2InfoData, _PERMIT2_INFO_SIGNATURE_V_MASK))) // signature v\n            }\n            // get third bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x60))\n            mstore(add(permit2SignatureCache, 0x20), permit2InfoData) // signature r\n            // get fourth bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x80))\n            mstore(add(permit2SignatureCache, 0x40), permit2InfoData) // signature s\n            // get all amounts\n            let amountsPosition := mload(add(permit2Info, 0x80))\n            for { let i := 0 } lt(i, amountLength) { i := add(i, 1) } {\n                permit2InfoData := calldataload(sub(endPoint, add(0xa0, mul(i, 0x20))))\n                mstore(add(amountsPosition, mul(add(i, 1), 0x20)), permit2InfoData) // permit2Info.amounts[i]\n            }\n        }\n        if (permit2InfoFlag == PERMIT2_INFO_SIG65_FLAG) {\n            permit2Info.signature = abi.encodePacked(bytes32(permit2SignatureCache[0]), bytes32(permit2SignatureCache[1]), bytes1(uint8(permit2SignatureCache[2])));\n        } else if (permit2InfoFlag == PERMIT2_INFO_SIG64_FLAG) {\n            permit2Info.signature = abi.encodePacked(bytes32(permit2SignatureCache[0]), bytes32(permit2SignatureCache[1]));\n        }\n\n        return permit2Info;\n    }\n\n    /// @notice Parse refundTo\n    function _parseRefundTo(uint256 endPoint, uint256 length) private pure returns (address refundTo) {\n        if (length == 0) {\n            return address(0);\n        }\n        assembly (\"memory-safe\") {\n            let refundToData := calldataload(sub(endPoint, 0x20))\n            refundTo := and(refundToData, _ADDRESS_MASK)\n        }\n        return refundTo;\n    }\n}"},"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"},"contracts/8/interfaces/IDexRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IDexRouter {\n    /// =============================================================\n    /// ======================= Structs =============================\n    /// =============================================================\n    struct BaseRequest {\n        uint256 fromToken;\n        address toToken;\n        uint256 fromTokenAmount;\n        uint256 minReturnAmount;\n        uint256 deadLine;\n    }\n\n    struct RouterPath {\n        address[] mixAdapters;\n        address[] assetTo;\n        uint256[] rawData;\n        bytes[] extraData;\n        uint256 fromToken;\n    }\n\n    struct CommissionInfo {\n        bool isFromTokenCommission; //0x00\n        bool isToTokenCommission; //0x20\n        uint256 tokenWithMode; // 0x40, if isToTokenCommission, tokenWithMode is only the token address, otherwise tokenWithMode is the token address with mode encoded in high bits\n        uint256 toBCommission; // 0x60, 0 for no encoded commission data, 1 for no-toB commission, 2 for toB commission\n        uint256 commissionLength; // 0x80\n        uint256 commissionRate; // 0xa0\n        address referrerAddress; // 0xc0\n        uint256 commissionRate2; // 0xe0\n        address referrerAddress2; // 0x100\n        uint256 commissionRate3; // 0x120\n        address referrerAddress3; // 0x140\n        uint256 commissionRate4; // 0x160\n        address referrerAddress4; // 0x180\n        uint256 commissionRate5; // 0x1a0\n        address referrerAddress5; // 0x1c0\n        uint256 commissionRate6; // 0x1e0\n        address referrerAddress6; // 0x200\n        uint256 commissionRate7; // 0x220\n        address referrerAddress7; // 0x240\n        uint256 commissionRate8; // 0x260\n        address referrerAddress8; // 0x280\n    }\n\n    struct TrimInfo {\n        bool hasTrim; // 0x00\n        uint256 trimRate; // 0x20\n        address trimAddress; // 0x40\n        uint256 toBTrim; // 0x60, 0 for no encoded trim data, 1 for no-toB trim, 2 for toB trim\n        uint256 expectAmountOut; // 0x80\n        uint256 chargeRate; // 0xa0\n        address chargeAddress; // 0xc0\n    }\n\n    struct Permit2Info {\n        address owner; // 0x00\n        uint256 nonce; // 0x20\n        uint256 deadline; // 0x40\n        bytes signature; // 0x60\n        uint256[] amounts; // 0x80\n    }\n\n    struct ExtraData {\n        CommissionInfo commissionInfo;\n        TrimInfo trimInfo;\n        Permit2Info permit2Info;\n        address refundTo;\n    }\n\n    struct SwapCache {\n        address payer;\n        address refundTo;\n        address receiver;\n        address toToken;\n    }\n\n    struct AfterSwapParams {\n        CommissionInfo commissionInfo;\n        uint256 consumeAmount;\n        uint256 targetTokenBefore;\n        address srcToken;\n        address toToken;\n        address receiver;\n        address payer;\n        uint256 mode;\n        uint256 fromTokenCommissionAmount;\n    }\n\n    struct ExactOutSwapCache {\n        uint256 amountOut;\n        uint256 maxConsume;\n        address payer;\n    }\n}"},"contracts/8/interfaces/IUniswapV3SwapCallback.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n    /// @dev In the implementation you must pay the pool tokens owed for the swap.\n    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external;\n}\n"},"contracts/8/router/SmartSwapRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../libraries/PMMLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\n\nlibrary SmartSwapRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param receiver Address to receive the output tokens from the swap.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function enables users to perform token swaps with complex routing directly to a specified address,\n    /// optimizing for best returns and accommodating specific trading strategies.\n    function smartSwapTo(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        IDexRouter.RouterPath[][] calldata batches,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n        return\n            _smartSwapTo(\n                IDexRouter.SwapCache({\n                    payer: msg.sender,\n                    refundTo: msg.sender,\n                    receiver: receiver == address(0) ? msg.sender : receiver,\n                    toToken: baseRequest.toToken\n                }),\n                baseRequest,\n                batchesAmount,\n                batches,\n                extraData\n            );\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If fromToken or toToken is ETH, the address needs to be 0xEeee. And for commission validation, ETH needs to be 0xEeee.\n    function _smartSwapTo(\n        IDexRouter.SwapCache memory swapCache,\n        IDexRouter.BaseRequest memory baseRequest,\n        uint256[] memory batchesAmount,\n        IDexRouter.RouterPath[][] memory batches,\n        IDexRouter.ExtraData memory extraData\n    ) private returns (uint256 returnAmount) {\n        uint256 mode = batches[0][0].fromToken & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST || mode == _MODE_NO_TRANSFER,\n            \"invalid transfer mode\"\n        );\n        \n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, fromToken, baseRequest.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        if (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) {\n            swapCache.refundTo = extraData.refundTo;\n        }\n\n        // Stash the receiver's toToken balanceBefore in returnAmount; it is replaced by the actual delta after the swap.\n        returnAmount = CommonLib.getBalanceOf(baseRequest.toToken, swapCache.receiver);\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalFromTokenAmount = baseRequest.fromTokenAmount;\n\n        uint256 fromTokenCommissionAmount;\n        {\n            address onlyOneAssetTo = (batches.length == 1 && batches[0][0].assetTo.length == 1)\n                ? batches[0][0].assetTo[0]\n                : address(0);\n            (\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                fromTokenCommissionAmount\n            ) = TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(fromToken)) | mode,\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                onlyOneAssetTo,\n                extraData\n            );\n        }\n\n        {\n            (\n                address middleReceiver,\n                uint256 balanceBefore\n            ) = CommissionLib.doCommissionFromToken(\n                    extraData.commissionInfo,\n                    swapCache,\n                    fromTokenCommissionAmount,\n                    extraData.trimInfo.hasTrim\n                );\n\n            _smartSwapInternal(\n                baseRequest,\n                batchesAmount,\n                batches,\n                swapCache,\n                middleReceiver\n            );\n\n            CommissionLib.doCommissionAndTrimToToken(\n                extraData.commissionInfo,\n                swapCache.receiver,\n                balanceBefore,\n                baseRequest.toToken,\n                extraData.trimInfo\n            );\n        }\n\n        // Refund unused fromToken\n        if (fromToken == _ETH) {\n            TransferLib.refundToken(_ETH, swapCache.refundTo); // In case of  msg.value > fromTokenAmount, the unused ETH will be refunded to refundTo\n            TransferLib.refundToken(_WETH, swapCache.refundTo); // In case of fromTokenAmount > sum of batchesAmount, the unused WETH will be refunded to refundTo\n        } else {\n            TransferLib.refundToken(fromToken, swapCache.refundTo); // In case of fromTokenAmount > sum of batchesAmount, the unused fromToken will be refunded to refundTo\n        }\n\n        // check minReturnAmount\n        returnAmount =\n            CommonLib.getBalanceOf(baseRequest.toToken, swapCache.receiver) -\n            returnAmount;\n        require(\n            returnAmount >= baseRequest.minReturnAmount,\n            \"Min return not reached\"\n        );\n\n        EventLib.emitOrderRecord(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken),\n            baseRequest.toToken,\n            tx.origin,\n            originalFromTokenAmount,\n            returnAmount\n        );\n    }\n\n    /// @notice Executes a complex swap based on provided parameters and paths.\n    /// @param baseRequest Basic swap details including tokens, amounts, and deadline.\n    /// @param batchesAmount Amounts for each swap batch.\n    /// @param batches Detailed swap paths for execution.\n    /// @param swapCache Provides payer and refundTo; swapCache.receiver is unused here.\n    /// @param receiver Hop output recipient (middleReceiver when commission/trim is active).\n    function _smartSwapInternal(\n        IDexRouter.BaseRequest memory baseRequest,\n        uint256[] memory batchesAmount,\n        IDexRouter.RouterPath[][] memory batches,\n        IDexRouter.SwapCache memory swapCache,\n        address receiver\n    ) private {\n        // 1. transfer from token in\n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n\n        // In order to deal with ETH/WETH transfer rules in a unified manner,\n        // we do not need to judge according to fromToken.\n        if (fromToken == _ETH) {\n            IWETH(_WETH).deposit{\n                value: baseRequest.fromTokenAmount\n            }();\n            require(CommonLib.bytes32ToAddress(batches[0][0].fromToken) == _WETH, \"firstToken mismatch\");\n            require(swapCache.payer == address(this), \"payer must be router\");\n        } else {\n            require(CommonLib.bytes32ToAddress(batches[0][0].fromToken) == fromToken, \"firstToken mismatch\");\n            require(msg.value == 0, \"value must be 0\");\n        }\n\n        // 2. check total batch amount\n        {\n            // avoid stack too deep\n            uint256 totalBatchAmount;\n            for (uint256 i = 0; i < batchesAmount.length; ) {\n                totalBatchAmount += batchesAmount[i];\n                unchecked {\n                    ++i;\n                }\n            }\n            // payer == address(0) signals that fromTokenAmount has been transferred\n            // directly to the pool via permit2 signature. The unused portion cannot\n            // be refunded in this case (funds are already in the pool, where adapters\n            // settle by balanceOf), so require exact match to prevent silent over-swap.\n            if (swapCache.payer == address(0)) {\n                require(\n                    totalBatchAmount == baseRequest.fromTokenAmount,\n                    \"Route: total batch amount must equal fromTokenAmount\"\n                );\n            } else {\n                require(\n                    totalBatchAmount <= baseRequest.fromTokenAmount,\n                    \"Route: total batch amount should be <= fromTokenAmount\"\n                );\n            }\n        }\n\n        // 4. execute batch\n        // check length, fix DRW-02: LACK OF LENGTH CHECK ON BATATCHES\n        require(batchesAmount.length == batches.length, \"length mismatch\");\n        for (uint256 i = 0; i < batches.length; ) {\n            if (i > 0) {\n                require(batches[i][0].fromToken == batches[0][0].fromToken, \"Inconsistent fromToken across batches\");\n            }\n\n            // execute hop, if the whole swap replacing by pmm fails, the funds will return to dexRouter\n            _exeHop(\n                swapCache.payer,\n                swapCache.refundTo,\n                receiver,\n                baseRequest.toToken == _ETH,\n                batchesAmount[i],\n                batches[i]\n            );\n            unchecked {\n                ++i;\n            }\n        }\n\n        // 5. transfer tokens to user\n        TransferLib.transferTokenToUser(baseRequest.toToken, receiver);\n    }\n\n    /// @notice Executes a series of swaps or operations defined by a set of routing paths, potentially across different protocols or pools.\n    /// @param payer The address providing the tokens for the swap.\n    /// @param receiver The address receiving the output tokens.\n    /// @param isToNative Indicates whether the final asset should be converted to the native blockchain asset (e.g., ETH).\n    /// @param batchAmount The total amount of the input token to be swapped.\n    /// @param hops An array of RouterPath structures, each defining a segment of the swap route.\n    /// @dev This function manages complex swap routes that might involve multiple hops through different liquidity pools or swapping protocols.\n    /// It iterates through the provided `hops`, executing each segment of the route in sequence.\n    function _exeHop(\n        address payer,\n        address refundTo,\n        address receiver,\n        bool isToNative,\n        uint256 batchAmount,\n        IDexRouter.RouterPath[] memory hops\n    ) private {\n        address fromToken = CommonLib.bytes32ToAddress(hops[0].fromToken);\n\n        // execute hop\n        uint256 hopLength = hops.length;\n        for (uint256 i = 0; i < hopLength; ) {\n            if (i > 0) {\n                fromToken = CommonLib.bytes32ToAddress(hops[i].fromToken);\n                batchAmount = CommonLib.getBalanceOf(fromToken, address(this));\n                payer = address(this);\n            }\n\n            address to = address(this);\n            if (i == hopLength - 1 && !isToNative) {\n                to = receiver;\n            }\n\n            // 3.2 execute forks\n            _exeForks(payer, refundTo, to, batchAmount, hops[i]);\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @notice Executes multiple adapters for a transaction pair.\n    /// @param payer The address of the payer.\n    /// @param to The address of the receiver.\n    /// @param batchAmount The amount to be transferred in each batch.\n    /// @param path The routing path for the swap.\n    /// @dev It includes checks for the total weight of the paths and executes the swapping through the adapters.\n    function _exeForks(\n        address payer,\n        address refundTo,\n        address to,\n        uint256 batchAmount,\n        IDexRouter.RouterPath memory path\n    ) private {\n        uint256 totalWeight;\n        uint256 accAmount;\n        for (uint256 i = 0; i < path.mixAdapters.length; ++i) {\n            bytes32 rawData = bytes32(path.rawData[i]);\n            address poolAddress;\n            bool reverse;\n            {\n                uint256 weight;\n                assembly {\n                    poolAddress := and(rawData, _ADDRESS_MASK)\n                    reverse := and(rawData, _REVERSE_MASK)\n                    weight := shr(160, and(rawData, _WEIGHT_MASK))\n                }\n                totalWeight += weight;\n                if (i == path.mixAdapters.length - 1) {\n                    require(\n                        totalWeight == 10_000,\n                        \"totalWeight must be 10000\"\n                    );\n                }\n\n                uint256 _fromTokenAmount;\n                if (i == path.mixAdapters.length - 1) {\n                    _fromTokenAmount = batchAmount - accAmount;\n                } else {\n                    _fromTokenAmount = (batchAmount * weight) / 10_000;\n                    accAmount += _fromTokenAmount;\n                }\n                if (_fromTokenAmount > 0) {\n                    TransferLib.transferInternal(\n                        payer,\n                        path.assetTo[i],\n                        path.fromToken,\n                        _fromTokenAmount\n                    );\n                }\n            }\n\n            CommonLib.exeAdapter(\n                reverse,\n                path.mixAdapters[i],\n                to,\n                poolAddress,\n                path.extraData[i],\n                refundTo\n            );\n        }\n    }\n}"},"contracts/8/router/DagRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary DagRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    function dagSwapTo(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest memory baseRequest,\n        IDexRouter.RouterPath[] calldata paths,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        require(paths.length > 0 && paths[0].assetTo.length > 0, \"paths must be > 0\");\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        receiver = receiver == address(0) ? msg.sender : receiver;\n\n        uint256 mode = paths[0].fromToken & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST || mode == _MODE_NO_TRANSFER,\n            \"invalid transfer mode\"\n        );\n        \n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, fromToken, baseRequest.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(baseRequest.toToken, receiver);\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) ? extraData.refundTo : msg.sender,\n            receiver: receiver,\n            toToken: baseRequest.toToken\n        });\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalFromTokenAmount = baseRequest.fromTokenAmount;\n\n        uint256 fromTokenCommissionAmount;\n        {\n            address onlyOneAssetTo = paths[0].assetTo.length == 1 ? paths[0].assetTo[0] : address(0); // Output edge of node0 is only one\n            (\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                fromTokenCommissionAmount\n            ) = TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(fromToken)) | mode,\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                onlyOneAssetTo,\n                extraData\n            );\n        }\n\n        {\n            uint256 balanceBefore;\n            (\n                swapCache.receiver,\n                balanceBefore\n            ) = CommissionLib.doCommissionFromToken(\n                    extraData.commissionInfo,\n                    swapCache,\n                    fromTokenCommissionAmount,\n                    extraData.trimInfo.hasTrim\n                );\n\n            _dagSwapInternal(\n                baseRequest,\n                paths,\n                swapCache\n            );\n\n            CommissionLib.doCommissionAndTrimToToken(\n                extraData.commissionInfo,\n                receiver,\n                balanceBefore,\n                baseRequest.toToken,\n                extraData.trimInfo\n            );\n        }\n\n        // check minReturnAmount\n        returnAmount =\n            CommonLib.getBalanceOf(baseRequest.toToken, receiver) -\n            returnAmount;\n        require(\n            returnAmount >= baseRequest.minReturnAmount,\n            \"Min return not reached\"\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (fromToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(fromToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        EventLib.emitOrderRecord(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken),\n            baseRequest.toToken,\n            tx.origin,\n            originalFromTokenAmount,\n            returnAmount\n        );\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice The fromTokenAmount will not must be greater than 0, cause for some protocols the fromTokenAmount needs to be 0 to skip token transfer like fourmeme. \n    function _dagSwapInternal(\n        IDexRouter.BaseRequest memory baseRequest,\n        IDexRouter.RouterPath[] calldata paths,\n        IDexRouter.SwapCache memory swapCache\n    ) private {\n        // 1. check and process ETH\n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n\n        address firstNodeToken = CommonLib.bytes32ToAddress(paths[0].fromToken);\n\n        // In order to deal with ETH/WETH transfer rules in a unified manner,\n        // we do not need to judge according to fromToken.\n        if (fromToken == _ETH) {\n            IWETH(_WETH).deposit{\n                value: baseRequest.fromTokenAmount\n            }();\n            require(firstNodeToken == _WETH, \"firstToken mismatch\");\n            require(swapCache.payer == address(this), \"payer must be router\");\n        } else {\n            require(firstNodeToken == fromToken, \"firstToken mismatch\");\n            require(msg.value == 0, \"value must be 0\");\n        }\n\n        // 2. execute dag swap\n        _exeDagSwap(swapCache, baseRequest.fromTokenAmount, baseRequest.toToken == _ETH, paths);\n\n        // 3. transfer tokens to receiver\n        TransferLib.transferTokenToUser(baseRequest.toToken, swapCache.receiver);\n    }\n\n    /// @notice The core logic to execute the DAG swap. For the first node, the payer should use passed value.\n    /// For the non-first node, the payer should always be address(this) cause the to address of the middle swap is address(this).\n    function _exeDagSwap(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 firstNodeBalance,\n        bool isToNative,\n        IDexRouter.RouterPath[] calldata paths\n    ) private {\n        uint256 nodeNum = paths.length;\n\n        // execute nodes\n        for (uint256 i = 0; i < nodeNum;) {\n            if (i != 0) { // reset payer for non-first node\n                swapCache.payer = address(this);\n            }\n\n            _exeNode(swapCache, firstNodeBalance, i, isToNative, paths[i], nodeNum);\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @notice The core logic to execute the each node\n    function _exeNode(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 nodeBalance,\n        uint256 nodeIndex,\n        bool isToNative,\n        IDexRouter.RouterPath calldata path,\n        uint256 nodeNum\n    ) private {\n        uint256 totalWeight;\n        uint256 accAmount;\n        address fromToken = CommonLib.bytes32ToAddress(path.fromToken);\n\n        require(\n            path.mixAdapters.length == path.rawData.length &&\n            path.mixAdapters.length == path.extraData.length &&\n            path.mixAdapters.length == path.assetTo.length,\n            \"path length mismatch\"\n        );\n\n        // to get the nodeBalance for non-first node, the balance of the first node is the original passed value\n        if (nodeIndex != 0) {\n            nodeBalance = CommonLib.getBalanceOf(fromToken, address(this));\n            require(nodeBalance > 0, \"node balance must be > 0\");\n        }\n\n        // execute edges\n        for (uint256 i = 0; i < path.mixAdapters.length;) {\n            uint256 inputIndex;\n            uint256 outputIndex;\n            uint256 weight;\n\n            // 1. get inputIndex, outputIndex, weight and verify\n            {\n                bytes32 rawData = bytes32(path.rawData[i]);\n                assembly {\n                    weight := shr(160, and(rawData, _WEIGHT_MASK))\n                    inputIndex := shr(184, and(rawData, _INPUT_INDEX_MASK))\n                    outputIndex := shr(176, and(rawData, _OUTPUT_INDEX_MASK))\n                }\n\n                require(inputIndex == nodeIndex, \"node inputIndex inconsistent\");\n                require(inputIndex < outputIndex && outputIndex <= nodeNum, \"node index out of range\");\n\n                totalWeight += weight;\n                if (i == path.mixAdapters.length - 1) {\n                    require(\n                        totalWeight == 10_000,\n                        \"totalWeight must be 10000\"\n                    );\n                }\n            }\n\n            // 2. transfer fromToken from payer to assetTo of edge\n            {\n                uint256 _fromTokenAmount;\n                if (i == path.mixAdapters.length - 1) {\n                    _fromTokenAmount = nodeBalance - accAmount;\n                } else {\n                    _fromTokenAmount = (nodeBalance * weight) / 10_000;\n                    accAmount += _fromTokenAmount;\n                }\n                if (_fromTokenAmount > 0) {\n                    TransferLib.transferInternal(\n                        swapCache.payer,\n                        path.assetTo[i],\n                        path.fromToken,\n                        _fromTokenAmount\n                    );\n                }\n            }\n\n            // 3. execute single swap\n            {\n                address to = address(this);\n                if (outputIndex == nodeNum && !isToNative) {\n                    to = swapCache.receiver;\n                }\n                address refundTo_ = swapCache.refundTo; // avoid stack too deep\n                _exeEdge(\n                    path.rawData[i],\n                    path.mixAdapters[i],\n                    path.extraData[i],\n                    to,\n                    refundTo_\n                );\n            }\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function _exeEdge(\n        uint256 rawData,\n        address mixAdapter,\n        bytes memory extraData,\n        address to,\n        address refundTo\n    ) private {\n        bool reverse;\n        address poolAddress;\n        assembly {\n            poolAddress := and(rawData, _ADDRESS_MASK)\n            reverse := and(rawData, _REVERSE_MASK)\n        }\n\n        CommonLib.exeAdapter(\n            reverse,\n            mixAdapter,\n            to,\n            poolAddress,\n            extraData,\n            refundTo\n        );\n    }\n}"},"contracts/8/router/UnxswapRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/UniswapTokenInfoHelper.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/ExtraDataLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\n\nlibrary UnxswapRouter {\n    uint256 private constant _IS_TOKEN0_TAX =\n        0x1000000000000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _IS_TOKEN1_TAX =\n        0x2000000000000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _CLAIM_TOKENS_CALL_SELECTOR_32 =\n        0x0a5ea46600000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _TRANSFER_DEPOSIT_SELECTOR =\n        0xa9059cbbd0e30db0000000000000000000000000000000000000000000000000;\n    uint256 private constant _SWAP_GETRESERVES_SELECTOR =\n        0x022c0d9f0902f1ac000000000000000000000000000000000000000000000000;\n    uint256 private constant _BALANCEOF_TOKEN0_SELECTOR =\n        0x70a082310dfe1681000000000000000000000000000000000000000000000000;\n    uint256 private constant _BALANCEOF_TOKEN1_SELECTOR =\n        0x70a08231d21220a7000000000000000000000000000000000000000000000000;\n    uint256 private constant _WITHDRAW_SELECTOR =\n        0x2e1a7d4d00000000000000000000000000000000000000000000000000000000;\n\n    uint256 private constant _NUMERATOR_MASK =\n        0x0000000000000000ffffffff0000000000000000000000000000000000000000;\n\n    uint256 private constant _DENOMINATOR = 1_000_000_000;\n    uint256 private constant _NUMERATOR_OFFSET = 160;\n\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param receiver The address where the swapped tokens will be sent.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function facilitates direct swaps using Unxswap, allowing users to specify custom swap routes and ensuring that the output is sent to a predetermined address.\n    ///      It is designed for scenarios where the user wants to directly receive the tokens in their wallet or another contract.\n    function unxswapTo(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        address receiver,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) public returns (uint256 returnAmount) {\n        EventLib.emitSwapOrderId((srcToken & _ORDER_ID_MASK) >> 160);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        // validate token info\n        (address fromToken, address toToken) = UniswapTokenInfoHelper.getUnxswapTokenInfo(msg.value > 0, pools);\n        address srcTokenAddr = CommonLib.bytes32ToAddress(srcToken);\n        require(\n            (srcTokenAddr == fromToken) || (srcTokenAddr == address(0) && fromToken == _ETH),\n            \"unxswap: token mismatch\"\n        );\n        \n        return\n            _unxswapTo(\n                fromToken,\n                toToken,\n                amount,\n                minReturn,\n                msg.sender,\n                receiver,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    /// It supports both ETH and ERC20 token swaps, with automatic WETH wrapping/unwrapping as needed.\n    /// The function verifies that toToken matches the expected output token from the last pool in the route.\n    function unxswapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address fromToken, address toToken) = UniswapTokenInfoHelper.getUnxswapTokenInfo(msg.value > 0, pools);\n\n        // validate fromToken and toToken from baseRequest\n        address fromTokenAddr = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        require((fromTokenAddr == fromToken) || (fromTokenAddr == address(0) && fromToken == _ETH), \"unxswap: fromToken mismatch\");\n        require((baseRequest.toToken == toToken) || (baseRequest.toToken == address(0) && toToken == _ETH), \"unxswap: toToken mismatch\");\n\n        return\n            _unxswapTo(\n                fromToken,\n                toToken,\n                baseRequest.fromTokenAmount,\n                baseRequest.minReturnAmount,\n                msg.sender,\n                receiver,\n                pools,\n                extraData\n            );\n    }\n\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If srcToken is ETH, srcToken needs to be 0xEeee for commission validation and _unxswapInternal.\n    function _unxswapTo(\n        address srcToken,\n        address toToken,\n        uint256 amount,\n        uint256 minReturn,\n        address payer,\n        address receiver,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) internal returns (uint256 returnAmount) {\n        receiver = receiver == address(0) ? msg.sender : receiver;\n\n        uint256 mode = uint256(pools[0]) & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST,\n            \"invalid transfer mode\"\n        );\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, srcToken, toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(toToken, receiver);\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: payer,\n            refundTo: (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) ? extraData.refundTo : msg.sender,\n            receiver: receiver,\n            toToken: toToken\n        });\n        \n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalAmount = amount;\n\n        // Handle Permit2Signature mode and fromToken commission\n        uint256 fromTokenCommissionAmount;\n        (swapCache.payer, amount, fromTokenCommissionAmount) =\n            TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(srcToken)) | mode,\n                swapCache.payer,\n                amount,\n                CommonLib.bytes32ToAddress(uint256(pools[0])), // onlyOneAssetTo\n                extraData\n            );\n        \n        _doUnxswap(\n            swapCache,\n            srcToken,\n            amount,\n            pools,\n            extraData,\n            fromTokenCommissionAmount\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (srcToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(srcToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        // check minReturnAmount\n        returnAmount = CommonLib.getBalanceOf(toToken, receiver) - returnAmount;\n        require(\n            returnAmount >= minReturn,\n            \"Min return not reached\"\n        );\n\n        EventLib.emitOrderRecord(\n            srcToken,\n            toToken,\n            tx.origin,\n            originalAmount,\n            returnAmount\n        );\n\n        return returnAmount;\n    }\n\n    function _doUnxswap(\n        IDexRouter.SwapCache memory swapCache,\n        address srcToken,\n        uint256 amount,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                extraData.trimInfo.hasTrim\n            );\n\n        _unxswapInternal(\n            IERC20(srcToken),\n            amount,\n            pools,\n            swapCache.payer,\n            middleReceiver\n        );\n\n        CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            swapCache.receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n    }\n\n    /// @notice Performs the internal logic for executing a swap using the Unxswap protocol.\n    /// @param srcToken The token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param pools The array of pool identifiers that define the swap route.\n    /// @param payer The address of the entity providing the source tokens for the swap.\n    /// @param receiver The address that will receive the tokens after the swap.\n    /// @return returnAmount The amount of tokens received from the swap.\n    /// @dev This internal function encapsulates the core logic of the Unxswap token swap process. It is meant to be called by other external functions that set up the required parameters. The actual interaction with the Unxswap pools and the token transfer mechanics are implemented here.\n    function _unxswapInternal(\n        IERC20 srcToken,\n        uint256 amount,\n        bytes32[] calldata pools,\n        address payer,\n        address receiver\n    ) private returns (uint256 returnAmount) {\n        assembly {\n            function revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _getTokenAddr(emptyPtr, pair, selector) -> token {\n                mstore(emptyPtr, selector)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x0000001067657420746f6b656e206661696c6564000000000000000000000000,\n                        0x54\n                    ) // \"get token failed\"\n                }\n                token := mload(0x00)\n            }\n            function _getBalanceOfToken0(emptyPtr, pair) -> token0, balance0 {\n                mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x00000012746f6b656e302063616c6c206661696c656400000000000000000000,\n                        0x56\n                    ) // \"token0 call failed\"\n                }\n                token0 := mload(0x00)\n                mstore(add(0x04, emptyPtr), pair)\n                if iszero(\n                    staticcall(gas(), token0, emptyPtr, 0x24, 0x00, 0x20)\n                ) {\n                    revertWithReason(\n                        0x0000001562616c616e63654f662063616c6c206661696c656400000000000000,\n                        0x59\n                    ) // \"balanceOf call failed\"\n                }\n                balance0 := mload(0x00)\n            }\n            function _getBalanceOfToken1(emptyPtr, pair) -> token1, balance1 {\n                mstore(emptyPtr, _BALANCEOF_TOKEN1_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x00000012746f6b656e312063616c6c206661696c656400000000000000000000,\n                        0x56\n                    ) // \"token1 call failed\"\n                }\n                token1 := mload(0x00)\n                mstore(add(0x04, emptyPtr), pair)\n                if iszero(\n                    staticcall(gas(), token1, emptyPtr, 0x24, 0x00, 0x20)\n                ) {\n                    revertWithReason(\n                        0x0000001562616c616e63654f662063616c6c206661696c656400000000000000,\n                        0x59\n                    ) // \"balanceOf call failed\"\n                }\n                balance1 := mload(0x00)\n            }\n\n            function swap(\n                emptyPtr,\n                swapAmount,\n                pair,\n                reversed,\n                isToken0Tax,\n                isToken1Tax,\n                numerator,\n                dst\n            ) -> ret {\n                mstore(emptyPtr, _SWAP_GETRESERVES_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x4,\n                        0x00,\n                        0x40\n                    )\n                ) {\n                    // we only need the first 0x40 bytes, no need timestamp info\n                    revertWithReason(\n                        0x0000001472657365727665732063616c6c206661696c65640000000000000000,\n                        0x58\n                    ) // \"reserves call failed\"\n                }\n                let reserve0 := mload(0x00)\n                let reserve1 := mload(0x20)\n\n                switch reversed\n                case 0 {\n                    //swap token0 for token1\n                    if isToken0Tax {\n                        let token0, balance0 := _getBalanceOfToken0(\n                            emptyPtr,\n                            pair\n                        )\n                        swapAmount := sub(balance0, reserve0)\n                    }\n                }\n                default {\n                    //swap token1 for token0\n                    if isToken1Tax {\n                        let token1, balance1 := _getBalanceOfToken1(\n                            emptyPtr,\n                            pair\n                        )\n                        swapAmount := sub(balance1, reserve1)\n                    }\n                    let temp := reserve0\n                    reserve0 := reserve1\n                    reserve1 := temp\n                }\n\n                ret := mul(swapAmount, numerator)\n                ret := div(\n                    mul(ret, reserve1),\n                    add(ret, mul(reserve0, _DENOMINATOR))\n                )\n                mstore(emptyPtr, _SWAP_GETRESERVES_SELECTOR)\n                switch reversed\n                case 0 {\n                    mstore(add(emptyPtr, 0x04), 0)\n                    mstore(add(emptyPtr, 0x24), ret)\n                }\n                default {\n                    mstore(add(emptyPtr, 0x04), ret)\n                    mstore(add(emptyPtr, 0x24), 0)\n                }\n                mstore(add(emptyPtr, 0x44), dst)\n                mstore(add(emptyPtr, 0x64), 0x80)\n                mstore(add(emptyPtr, 0x84), 0)\n                if iszero(call(gas(), pair, 0, emptyPtr, 0xa4, 0, 0)) {\n                    revertWithReason(\n                        0x00000010737761702063616c6c206661696c6564000000000000000000000000,\n                        0x54\n                    ) // \"swap call failed\"\n                }\n            }\n\n            // ========== Transfer Helper Functions ==========\n            function _sendToken(token, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x44))\n                mstore(\n                    freePtr,\n                    0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                ) // transfer\n                mstore(add(freePtr, 0x04), to)\n                mstore(add(freePtr, 0x24), amt)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x44,\n                    0,\n                    0x20\n                )\n                if and(\n                    iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                    success\n                ) {\n                    success := iszero(\n                        or(iszero(extcodesize(token)), returndatasize())\n                    )\n                }\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001c207472616e7366657220746f6b656e2072656665726572206661696c,\n                        0x60\n                    ) // \"transfer token referer fail\"\n                }\n            }\n            function _claimToken(token, _payer, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    _CLAIM_TOKENS_CALL_SELECTOR_32\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amt)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            function _transferTokenDirect(token, from, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amt)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n            function _transferTokenPermit2Allowance(token, from, to, amt) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amt) {\n                    revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amt)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n            function _transferTokenWithMode(token, _payer, rawPair, amt) {\n                if gt(amt, 0) {\n                    let mode := and(rawPair, _TRANSFER_MODE_MASK)\n\n                    // _payer has been set to address(this), means the token has been transferred to address(this).\n                    if eq(_payer, address()) {\n                        _sendToken(token, and(rawPair, _ADDRESS_MASK), amt)\n                    }\n                    // _payer != address(this) && _payer != address(0), means the token has not been transferred yet.\n                    if iszero(or(eq(_payer, address()), eq(_payer, 0))) {\n                        switch mode\n                        case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                            _transferTokenDirect(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                            _transferTokenPermit2Allowance(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                            _claimToken(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        default {\n                            revertWithReason(\n                                0x00000015696e76616c6964207472616e73666572206d6f646500000000000000,\n                                0x59\n                            ) // \"invalid transfer mode\"\n                        }\n                    }\n                }\n            }\n            // ========== End Transfer Helper Functions ==========\n\n            let poolsOffset\n            let poolsEndOffset\n            {\n                let len := pools.length\n                poolsOffset := pools.offset //\n                poolsEndOffset := add(poolsOffset, mul(len, 32))\n\n                if eq(len, 0) {\n                    revertWithReason(\n                        0x000000b656d70747920706f6f6c73000000000000000000000000000000000000,\n                        0x4e\n                    ) // \"empty pools\"\n                }\n            }\n            let emptyPtr := mload(0x40)\n            let rawPair := calldataload(poolsOffset)\n            \n            switch eq(_ETH, srcToken)\n            case 1 {\n                // ========== ETH Transfer ==========\n                // require callvalue() >= amount, lt: if x < y return 1，else return 0\n                if eq(lt(callvalue(), amount), 1) {\n                    revertWithReason(\n                        0x00000011696e76616c6964206d73672e76616c75650000000000000000000000,\n                        0x55\n                    ) // \"invalid msg.value\"\n                }\n\n                mstore(emptyPtr, _TRANSFER_DEPOSIT_SELECTOR)\n                if iszero(\n                    call(gas(), _WETH, amount, add(emptyPtr, 0x04), 0x4, 0, 0)\n                ) {\n                    revertWithReason(\n                        0x000000126465706f73697420455448206661696c656400000000000000000000,\n                        0x56\n                    ) // \"deposit ETH failed\"\n                }\n                mstore(add(0x04, emptyPtr), and(rawPair, _ADDRESS_MASK))\n                mstore(add(0x24, emptyPtr), amount)\n                if iszero(call(gas(), _WETH, 0, emptyPtr, 0x44, 0, 0x20)) {\n                    revertWithReason(\n                        0x000000147472616e736665722057455448206661696c65640000000000000000,\n                        0x58\n                    ) // \"transfer WETH failed\"\n                }\n            }\n            default {\n                // ========== ERC20 Transfer ==========\n                if callvalue() {\n                    revertWithReason(\n                        0x00000011696e76616c6964206d73672e76616c75650000000000000000000000,\n                        0x55\n                    ) // \"invalid msg.value\"\n                }\n\n                // For PERMIT2_SIGNATURE mode: token already transferred via permitTransferFrom, no need to transfer\n                // Other modes: transfer token to the address specified in the rawPair\n                _transferTokenWithMode(srcToken, payer, rawPair, amount)\n            }\n\n            returnAmount := amount\n\n            for {\n                let i := add(poolsOffset, 0x20)\n            } lt(i, poolsEndOffset) {\n                i := add(i, 0x20)\n            } {\n                let nextRawPair := calldataload(i)\n\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    and(nextRawPair, _ADDRESS_MASK)\n                )\n\n                rawPair := nextRawPair\n            }\n            let toToken\n            switch and(rawPair, _WETH_MASK)\n            case 0 {\n                let beforeAmount\n                switch and(rawPair, _REVERSE_MASK)\n                case 0 {\n                    if and(rawPair, _IS_TOKEN1_TAX) {\n                        mstore(emptyPtr, _BALANCEOF_TOKEN1_SELECTOR)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                and(rawPair, _ADDRESS_MASK),\n                                add(0x04, emptyPtr),\n                                0x04,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000012746f6b656e312063616c6c206661696c656400000000000000000000,\n                                0x56\n                            ) // \"token1 call failed\"\n                        }\n                        toToken := mload(0)\n                        mstore(add(0x04, emptyPtr), receiver)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                toToken,\n                                emptyPtr,\n                                0x24,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000015746f6b656e312062616c616e6365206661696c656400000000000000,\n                                0x59\n                            ) // \"token1 balance failed\"\n                        }\n                        beforeAmount := mload(0)\n                    }\n                }\n                default {\n                    if and(rawPair, _IS_TOKEN0_TAX) {\n                        mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                and(rawPair, _ADDRESS_MASK),\n                                add(0x04, emptyPtr),\n                                0x04,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000012746f6b656e302063616c6c206661696c656400000000000000000000,\n                                0x56\n                            ) // \"token0 call failed\"\n                        }\n                        toToken := mload(0)\n                        mstore(add(0x04, emptyPtr), receiver)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                toToken,\n                                emptyPtr,\n                                0x24,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000015746f6b656e302062616c616e6365206661696c656400000000000000,\n                                0x56\n                            ) // \"token0 balance failed\"\n                        }\n                        beforeAmount := mload(0)\n                    }\n                }\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    receiver\n                )\n                if gt(toToken, 0x0) {\n                    mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                    mstore(add(0x04, emptyPtr), receiver)\n                    if iszero(\n                        staticcall(gas(), toToken, emptyPtr, 0x24, 0x00, 0x20)\n                    ) {\n                        revertWithReason(\n                            0x000000146765742062616c616e63654f66206661696c65640000000000000000,\n                            0x58\n                        ) // \"get balanceOf failed\"\n                    }\n                    returnAmount := sub(mload(0), beforeAmount)\n                }\n            }\n            default {\n                toToken := _ETH\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    address()\n                )\n\n                // Directly call WETH.withdraw(returnAmount) instead of using WNativeRelayer\n                mstore(emptyPtr, _WITHDRAW_SELECTOR)\n                mstore(add(emptyPtr, 0x04), returnAmount)\n                if iszero(\n                    call(gas(), _WETH, 0, emptyPtr, 0x24, 0, 0)\n                ) {\n                    revertWithReason(\n                        0x00000013574554482077697468647261772066616c6c6564000000000000000000,\n                        0x57\n                    ) // \"WETH withdraw failed\"\n                }\n                \n                // Send ETH to receiver, skip when receiver is this contract.\n                if iszero(eq(receiver, address())) {\n                    if iszero(call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, receiver, returnAmount, 0, 0, 0, 0)) {\n                        revertWithReason(\n                            0x000000137472616e7366657220455448206661696c6564000000000000000000,\n                            0x57\n                        ) // \"transfer ETH failed\"\n                    }\n                }\n            }\n\n        }\n    }\n}"},"contracts/8/router/UnxswapV3Router.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/UniswapTokenInfoHelper.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\n\nlibrary UnxswapV3Router {\n    using Address for address payable;\n\n    bytes32 private constant _POOL_INIT_CODE_HASH =\n        0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; // Pool init code hash\n    // _FF_FACTORY is maintained centrally in Constants.sol (injected per-chain by gen-chainconfig).\n    // concatenation of token0(), token1() fee(), transfer() and claimTokens() selectors\n    bytes32 private constant _SELECTORS =\n        0x0dfe1681d21220a7ddca3f43a9059cbb0a5ea466000000000000000000000000;\n    // concatenation of withdraw(uint),transfer()\n    bytes32 private constant _SELECTORS2 =\n        0x2e1a7d4da9059cbb000000000000000000000000000000000000000000000000;\n    bytes32 private constant _SELECTORS3 =\n        0xa9059cbb70a08231000000000000000000000000000000000000000000000000;\n    uint160 private constant _MIN_SQRT_RATIO = 4_295_128_739 + 1;\n    uint160 private constant _MAX_SQRT_RATIO =\n        1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342 - 1;\n    bytes32 private constant _SWAP_SELECTOR =\n        0x128acb0800000000000000000000000000000000000000000000000000000000; // Swap function selector\n    uint256 private constant _INT256_MAX =\n        0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; // Maximum int256\n    uint256 private constant _INT256_MIN =\n        0x8000000000000000000000000000000000000000000000000000000000000000; // Minimum int256\n\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a swap using the Uniswap V3 protocol.\n    /// @param receiver The address that will receive the swap funds (encoded as uint256 with order ID mask).\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.\n    /// @param pools An array of pool identifiers used to define the swap route within Uniswap V3.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The amount of tokens received after the completion of the swap.\n    /// @dev This function wraps and unwraps ETH as required, ensuring the transaction only accepts non-zero `msg.value` for ETH swaps. It invokes `_uniswapV3Swap` to execute the actual swap and handles commission post-swap.\n    function uniswapV3SwapTo(\n        uint256 receiver,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) public returns (uint256 returnAmount) {\n        EventLib.emitSwapOrderId((receiver & _ORDER_ID_MASK) >> 160);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address srcToken, address toToken) = UniswapTokenInfoHelper.getUniswapV3TokenInfo(msg.value > 0, pools);\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: CommonLib.bytes32ToAddress(receiver),\n            toToken: toToken\n        });\n        return\n            _uniswapV3SwapTo(\n                swapCache,\n                srcToken,\n                amount,\n                minReturn,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    /// It supports both ETH and ERC20 token swaps, with automatic WETH wrapping/unwrapping as needed.\n    /// The function verifies that fromToken matches the first pool and toToken matches the last pool in the route.\n    function uniswapV3SwapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address srcToken, address toToken) = UniswapTokenInfoHelper.getUniswapV3TokenInfo(msg.value > 0, pools);\n\n        // validate fromToken and toToken from baseRequest\n        require(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken) == srcToken && baseRequest.toToken == toToken,\n            \"uniswapV3: token mismatch\"\n        );\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: receiver,\n            toToken: toToken\n        });\n        return\n            _uniswapV3SwapTo(\n                swapCache,\n                srcToken,\n                baseRequest.fromTokenAmount,\n                baseRequest.minReturnAmount,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Callback function invoked by Uniswap V3 pools during a swap.\n    /// @param amount0Delta The change in token0 balance (positive means the contract must pay token0).\n    /// @param amount1Delta The change in token1 balance (positive means the contract must pay token1).\n    /// @dev This function is called by the Uniswap V3 pool after executing a swap. It handles the payment of tokens to the pool.\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata /*data*/\n    ) public {\n        _uniswapV3SwapCallback(amount0Delta, amount1Delta);\n    }\n\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If srcToken or toToken is ETH, the address needs to be 0xEeee. And for commission validation, ETH needs to be 0xEeee.\n    function _uniswapV3SwapTo(\n        IDexRouter.SwapCache memory swapCache,\n        address srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) private returns (uint256 returnAmount) {\n        swapCache.receiver = swapCache.receiver == address(0) ? msg.sender : swapCache.receiver;\n\n        uint256 mode = pools[0] & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST,\n            \"invalid transfer mode\"\n        );\n\n        if (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) {\n            swapCache.refundTo = extraData.refundTo;\n        }\n\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, srcToken, swapCache.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(swapCache.toToken, swapCache.receiver);\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalAmount = amount;\n\n        uint256 fromTokenCommissionAmount;\n        (\n            swapCache.payer,\n            amount,\n            fromTokenCommissionAmount\n        ) = TransferLib.handlePermit2SigModeWithCommission(\n            uint256(uint160(srcToken)) | mode,\n            swapCache.payer,\n            amount,\n            address(0),\n            extraData\n        );\n\n        _doUniswapV3Swap(\n            swapCache,\n            amount,\n            pools,\n            extraData,\n            fromTokenCommissionAmount\n        );\n\n        // check minReturnAmount\n        returnAmount = CommonLib.getBalanceOf(swapCache.toToken, swapCache.receiver) - returnAmount;\n        require(\n            returnAmount >= minReturn,\n            \"Min return not reached\"\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (srcToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(srcToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        EventLib.emitOrderRecord(\n            srcToken,\n            swapCache.toToken,\n            tx.origin,\n            originalAmount,\n            returnAmount\n        );\n    }\n\n    function _doUniswapV3Swap(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 amount,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        \n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                extraData.trimInfo.hasTrim\n            );\n\n        _uniswapV3Swap(\n            swapCache.payer,\n            payable(middleReceiver),\n            swapCache.refundTo,\n            amount,\n            pools\n        );\n\n        CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            swapCache.receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n    }\n\n    /// @notice Conducts a swap using the Uniswap V3 protocol internally within the contract.\n    /// @param payer The address of the account providing the tokens for the swap.\n    /// @param receiver The address that will receive the tokens after the swap.\n    /// @param refundTo The address to refund the unused tokens to.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param pools An array of pool identifiers defining the swap route within Uniswap V3.\n    /// @return returnAmount The amount of tokens received from the swap.\n    /// @dev This internal function encapsulates the core logic for executing swaps on Uniswap V3. It is intended to be used by other functions in the contract that prepare and pass the necessary parameters.\n    ///      The function handles the swapping process, ensuring that the minimum return is met and managing the transfer of tokens.\n    function _uniswapV3Swap(\n        address payer,\n        address payable receiver,\n        address refundTo,\n        uint256 amount,\n        uint256[] calldata pools\n    ) internal returns (uint256 returnAmount) {\n        assembly {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _makeSwap(_receiver, _payer, _refundTo, _pool, _amount, _transferMode)\n                -> _returnAmount\n            {\n                if lt(_INT256_MAX, _amount) {\n                    mstore(\n                        0,\n                        0xb3f79fd000000000000000000000000000000000000000000000000000000000\n                    ) //SafeCastToInt256Failed()\n                    revert(0, 4)\n                }\n                let freePtr := mload(0x40)\n                let zeroForOne := eq(and(_pool, _ONE_FOR_ZERO_MASK), 0)\n\n                let poolAddr := and(_pool, _ADDRESS_MASK)\n                switch zeroForOne\n                case 1 {\n                    mstore(freePtr, _SWAP_SELECTOR)\n                    let paramPtr := add(freePtr, 4)\n                    mstore(paramPtr, _receiver)\n                    mstore(add(paramPtr, 0x20), true)\n                    mstore(add(paramPtr, 0x40), _amount)\n                    mstore(add(paramPtr, 0x60), _MIN_SQRT_RATIO)\n                    mstore(add(paramPtr, 0x80), 0xa0)\n                    mstore(add(paramPtr, 0xa0), 128)                    // data.length = 128 (0x80)\n                    mstore(add(paramPtr, 0xc0), V3_EXACT_IN_CALLBACK_FLAG)  // data[0] = flag\n                    mstore(add(paramPtr, 0xe0), _payer)                 // data[1] = payer\n                    mstore(add(paramPtr, 0x100), _refundTo)             // data[2] = refundTo\n                    mstore(add(paramPtr, 0x120), _transferMode)         // data[3] = transferMode\n                    let success := call(\n                        gas(),\n                        poolAddr,\n                        0,\n                        freePtr,\n                        0x144,\n                        0,\n                        0\n                    )\n                    if iszero(success) {\n                        revert(0, 32)\n                    }\n                    returndatacopy(0, 32, 32) // only copy _amount1   MEM[0:] <= RETURNDATA[32:32+32]\n                }\n                default {\n                    mstore(freePtr, _SWAP_SELECTOR)\n                    let paramPtr := add(freePtr, 4)\n                    mstore(paramPtr, _receiver)\n                    mstore(add(paramPtr, 0x20), false)\n                    mstore(add(paramPtr, 0x40), _amount)\n                    mstore(add(paramPtr, 0x60), _MAX_SQRT_RATIO)\n                    mstore(add(paramPtr, 0x80), 0xa0)\n                    mstore(add(paramPtr, 0xa0), 128)                    // data.length = 128 (0x80)\n                    mstore(add(paramPtr, 0xc0), V3_EXACT_IN_CALLBACK_FLAG)  // data[0] = flag\n                    mstore(add(paramPtr, 0xe0), _payer)                 // data[1] = payer\n                    mstore(add(paramPtr, 0x100), _refundTo)             // data[2] = refundTo\n                    mstore(add(paramPtr, 0x120), _transferMode)         // data[3] = transferMode\n                    let success := call(\n                        gas(),\n                        poolAddr,\n                        0,\n                        freePtr,\n                        0x144,\n                        0,\n                        0\n                    )\n                    if iszero(success) {\n                        revert(0, 32)\n                    }\n                    returndatacopy(0, 0, 32) // only copy _amount0   MEM[0:] <= RETURNDATA[0:0+32]\n                }\n                _returnAmount := mload(0)\n                if lt(_returnAmount, _INT256_MIN) {\n                    mstore(\n                        0,\n                        0x88c8ee9c00000000000000000000000000000000000000000000000000000000\n                    ) //SafeCastToUint256Failed()\n                    revert(0, 4)\n                }\n                _returnAmount := add(1, not(_returnAmount)) // -a = ~a + 1\n            }\n            function _wrapWeth(_amount) {\n                // require callvalue() >= amount, lt: if x < y return 1，else return 0\n                if eq(lt(callvalue(), _amount), 1) {\n                    mstore(\n                        0,\n                        0x1841b4e100000000000000000000000000000000000000000000000000000000\n                    ) // InvalidMsgValue()\n                    revert(0, 4)\n                }\n\n                let success := call(gas(), _WETH, _amount, 0, 0, 0, 0) //进入fallback逻辑\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001357455448206465706f736974206661696c6564000000000000000000,\n                        87\n                    ) //WETH deposit failed\n                }\n            }\n            function _unWrapWeth(_receiver, _amount) {\n                let freePtr := mload(0x40)\n\n                // withdraw WETH to ETH\n                mstore(freePtr, _SELECTORS2) // withdraw(uint256) selector (first 4 bytes)\n                mstore(add(freePtr, 4), _amount)\n                let success := call(gas(), _WETH, 0, freePtr, 36, 0, 0)\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001477697468647261772077657468206661696c65640000000000000000,\n                        88\n                    ) // withdraw weth failed\n                }\n                // send ETH to receiver, skip when target is this contract.\n                if iszero(eq(_receiver, address())) {\n                    success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, _receiver, _amount, 0, 0, 0, 0)\n                    if iszero(success) {\n                        _revertWithReason(\n                            0x0000001173656e64206574686572206661696c65640000000000000000000000,\n                            85\n                        ) // send ether failed\n                    }\n                }\n            }\n            function _token0(_pool) -> token0 {\n                let freePtr := mload(0x40)\n                mstore(freePtr, _SELECTORS)\n                let success := staticcall(gas(), _pool, freePtr, 0x4, 0, 0)\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001167657420746f6b656e30206661696c65640000000000000000000000,\n                        85\n                    ) // get token0 failed\n                }\n                returndatacopy(0, 0, 32)\n                token0 := mload(0)\n            }\n            function _token1(_pool) -> token1 {\n                let freePtr := mload(0x40)\n                mstore(freePtr, _SELECTORS)\n                let success := staticcall(\n                    gas(),\n                    _pool,\n                    add(freePtr, 4),\n                    0x4,\n                    0,\n                    0\n                )\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001167657420746f6b656e31206661696c65640000000000000000000000,\n                        84\n                    ) // get token1 failed\n                }\n                returndatacopy(0, 0, 32)\n                token1 := mload(0)\n            }\n\n            let firstPoolStart\n            let lastPoolStart\n\n            {\n                let len := pools.length\n                firstPoolStart := pools.offset //\n                lastPoolStart := sub(add(firstPoolStart, mul(len, 32)), 32)\n\n                if eq(len, 0) {\n                    mstore(\n                        0,\n                        0x67e7c0f600000000000000000000000000000000000000000000000000000000\n                    ) // EmptyPools()\n                    revert(0, 4)\n                }\n                \n            }\n\n            {\n                let wrapWeth := gt(callvalue(), 0)\n                if wrapWeth {\n                    _wrapWeth(amount)\n                    payer := address()\n                }\n            }\n\n            for {\n                let i := firstPoolStart\n            } lt(i, lastPoolStart) {\n                i := add(i, 32)\n            } {\n                amount := _makeSwap(\n                    address(),\n                    payer,\n                    refundTo,\n                    calldataload(i),\n                    amount,\n                    and(calldataload(firstPoolStart), _TRANSFER_MODE_MASK)\n                )\n                payer := address()\n            }\n            {\n                let unwrapWeth := gt(\n                    and(calldataload(lastPoolStart), _WETH_UNWRAP_MASK),\n                    0\n                ) // pools[lastIndex] & _WETH_UNWRAP_MASK > 0\n\n                // last one or only one\n                switch unwrapWeth\n                case 1 {\n                    returnAmount := _makeSwap(\n                        address(),\n                        payer,\n                        refundTo,\n                        calldataload(lastPoolStart),\n                        amount,\n                        and(calldataload(lastPoolStart), _TRANSFER_MODE_MASK)\n                    )\n                    _unWrapWeth(receiver, returnAmount)\n                }\n                case 0 {\n                    returnAmount := _makeSwap(\n                        receiver,\n                        payer,\n                        refundTo,\n                        calldataload(lastPoolStart),\n                        amount,\n                        and(calldataload(lastPoolStart), _TRANSFER_MODE_MASK)\n                    )\n                }\n            }\n\n        }\n    }\n\n    function _uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta\n    ) private {\n        assembly {\n            // solhint-disable-line no-inline-assembly\n            function reRevert() {\n                returndatacopy(0, 0, returndatasize())\n                revert(0, returndatasize())\n            }\n            function getBalanceAndTransfer(emptyPtr, token) {\n                mstore(emptyPtr, _SELECTORS3)\n                mstore(add(8, emptyPtr), address())\n                if iszero(\n                    staticcall(gas(), token, add(4, emptyPtr), 36, 0, 32)\n                ) {\n                    reRevert()\n                }\n                let amount := mload(0)\n                if gt(amount, 0) {\n                    let refundTo := calldataload(196) // offset adjusted for flag: 164 + 32 = 196\n                    mstore(add(4, emptyPtr), refundTo)\n                    mstore(add(36, emptyPtr), amount)\n                    validateERC20Transfer(\n                        call(gas(), token, 0, emptyPtr, 0x44, 0, 0x20)\n                    )\n                }\n            }\n\n            function validateERC20Transfer(status) {\n                if iszero(status) {\n                    reRevert()\n                }\n                let success := or(\n                    iszero(returndatasize()), // empty return data\n                    and(gt(returndatasize(), 31), eq(mload(0), 1)) // true in return data\n                )\n                if iszero(success) {\n                    mstore(\n                        0,\n                        0xf27f64e400000000000000000000000000000000000000000000000000000000\n                    ) // ERC20TransferFailed()\n                    revert(0, 4)\n                }\n            }\n\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            function _transferTokenDirect(token, from, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n\n            function _transferTokenPermit2Allowance(token, from, to, amount) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amount) {\n                    _revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n\n            function _claimToken(token, _payer, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    0x0a5ea46600000000000000000000000000000000000000000000000000000000\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amount)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            \n            function _transferTokenWithMode(token, mode, _payer, to, amount) {\n                if gt(amount, 0) {\n                    switch mode\n                    case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                        _transferTokenDirect(token, _payer, to, amount)\n                    }\n                    case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                        _transferTokenPermit2Allowance(token, _payer, to, amount)\n                    }\n                    case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                        _claimToken(token, _payer, to, amount)\n                    }\n                    default {\n                        _revertWithReason(\n                            0x00000015696e76616c6964207472616e73666572206d6f646500000000000000,\n                            0x59\n                        ) // \"invalid transfer mode\"\n                    }\n                }\n            }\n\n            let emptyPtr := mload(0x40)\n            let resultPtr := add(emptyPtr, 21) // 0x15 = _FF_FACTORY size\n\n\n            // Store token0/token1/fee at emptyPtr+32 to avoid overwriting\n            // Solidity's free memory pointer at 0x40\n            let hashBase := add(emptyPtr, 32)\n\n            mstore(emptyPtr, _SELECTORS)\n            // token0\n            if iszero(staticcall(gas(), caller(), emptyPtr, 4, hashBase, 32)) {\n                reRevert()\n            }\n            //token1\n            if iszero(\n                staticcall(gas(), caller(), add(emptyPtr, 4), 4, add(hashBase, 32), 32)\n            ) {\n                reRevert()\n            }\n            // fee\n            if iszero(\n                staticcall(gas(), caller(), add(emptyPtr, 8), 4, add(hashBase, 64), 32)\n            ) {\n                reRevert()\n            }\n\n            let token\n            let amount\n            switch sgt(amount0Delta, 0)\n            case 1 {\n                token := mload(hashBase)\n                amount := amount0Delta\n            }\n            default {\n                token := mload(add(hashBase, 32))\n                amount := amount1Delta\n            }\n            // let salt := keccak256(hashBase, 96)\n            mstore(emptyPtr, _FF_FACTORY)\n            mstore(resultPtr, keccak256(hashBase, 96)) // Compute the inner hash in-place\n            mstore(add(resultPtr, 32), _POOL_INIT_CODE_HASH)\n            let pool := and(keccak256(emptyPtr, 85), _ADDRESS_MASK)\n            if iszero(eq(pool, caller())) {\n                // if xor(pool, caller()) {\n                mstore(\n                    0,\n                    0xb2c0272200000000000000000000000000000000000000000000000000000000\n                ) // BadPool()\n                revert(0, 4)\n            }\n\n            // Calldata layout after adding flag:\n            // offset 132: data[0] = flag (32 bytes) - skipped by DexRouter\n            // offset 164: data[1] = payer (32 bytes)\n            // offset 196: data[2] = refundTo (32 bytes)\n            // offset 228: data[3] = transferMode (32 bytes)\n            let payer := calldataload(164)        // 132 + 32 = 164 (skip flag)\n            let transferMode := calldataload(228) // 164 + 64 = 228\n            mstore(emptyPtr, _SELECTORS)\n            switch eq(payer, address())\n            case 1 {\n                // token.safeTransfer(msg.sender,amount)\n                mstore(add(emptyPtr, 0x10), caller())\n                mstore(add(emptyPtr, 0x30), amount)\n                validateERC20Transfer(\n                    call(gas(), token, 0, add(emptyPtr, 0x0c), 0x44, 0, 0x20)\n                )\n                getBalanceAndTransfer(emptyPtr, token)\n            }\n            default {\n                // payer is not address(this), use transferMode\n                _transferTokenWithMode(token, transferMode, payer, caller(), amount)\n            }\n        }\n    }\n}"},"contracts/8/router/SwapWrapRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\n\nlibrary SwapWrapRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a simple swap between ETH and WETH using encoded parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param rawdata Encoded data containing swap direction, transfer mode and amount information using bit masks.\n    /// @param extraData Additional data encoded in calldata.\n    /// @dev This function supports bidirectional swaps between ETH and WETH with minimal gas overhead.\n    /// The rawdata parameter encodes:\n    /// - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH\n    function swapWrap(uint256 orderId, uint256 rawdata, IDexRouter.ExtraData memory extraData) public {\n        bool reversed;\n        uint128 amount;\n        uint256 mode;\n        assembly {\n            reversed := and(rawdata, _REVERSE_MASK)\n            amount := and(rawdata, SWAP_AMOUNT)\n            mode := and(rawdata, _TRANSFER_MODE_MASK)\n        }\n        _swapWrap(orderId, msg.sender, reversed, amount, mode, extraData);\n    }\n\n    /// @notice Executes a swap between ETH and WETH using structured base request parameters to a specified receiver.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.\n    /// @param extraData Additional data encoded in calldata.\n    /// @dev This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly.\n    /// It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.\n    function swapWrapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n\n        bool reversed;\n        address fromTokenAddr = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        if (fromTokenAddr == _ETH && baseRequest.toToken == _WETH) {\n            reversed = false;\n        } else if (fromTokenAddr == _WETH && baseRequest.toToken == _ETH) {\n            reversed = true;\n        } else {\n            revert(\"SwapWrap: invalid token pair\");\n        }\n\n        _swapWrap(orderId, receiver == address(0) ? msg.sender : receiver, reversed, baseRequest.fromTokenAmount, baseRequest.fromToken & _TRANSFER_MODE_MASK, extraData);\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice For commission validation, ETH needs to be 0xEeee.\n    function _swapWrap(\n        uint256 orderId,\n        address receiver,\n        bool reversed,\n        uint256 amount,\n        uint256 mode,\n        IDexRouter.ExtraData memory extraData\n    ) private {\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        require(amount > 0, \"amount must be > 0\");\n        require(mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE, \"invalid transfer mode\");\n\n        require(!extraData.trimInfo.hasTrim, \"trim is not supported in swapWrap\");\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, reversed ? _WETH : _ETH, reversed ? _ETH : _WETH, mode);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: receiver,\n            toToken: reversed ? _ETH : _WETH\n        });\n\n        uint256 fromTokenCommissionAmount;\n        (\n            swapCache.payer, \n            amount, \n            fromTokenCommissionAmount\n        ) = TransferLib.handlePermit2SigModeWithCommission(\n            reversed ? (mode | uint256(uint160(_WETH))) : (mode | uint256(uint160(_ETH))),\n            swapCache.payer,\n            amount,\n            address(0),\n            extraData\n        );\n\n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                false // extraData.trimInfo.hasTrim\n            );\n\n        if (reversed) {\n            require(msg.value == 0, \"value must be 0\");\n            TransferLib.transferInternal(\n                swapCache.payer,\n                address(this),\n                mode | uint256(uint160(_WETH)),\n                amount\n            );\n            IWETH(_WETH).withdraw(amount);\n            if (middleReceiver != address(this)) {\n                // Invariant: `middleReceiver != address(this)` implies no toToken commission and no trim\n                (bool success, ) = payable(middleReceiver).call{\n                    value: amount,\n                    gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT\n                }(\"\");\n                require(success, \"transfer native token failed\");\n            }\n        } else {\n            require(msg.value >= amount + fromTokenCommissionAmount, \"value not enough\");\n            IWETH(_WETH).deposit{value: amount}();\n            if (middleReceiver != address(this)) {\n                SafeERC20.safeTransfer(IERC20(_WETH), middleReceiver, amount);\n            }\n        }\n        // emit return amount should be the amount after commission\n        uint256 toTokenCommissionAndTrimAmount = CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n\n        // Refund unused fromToken\n        if (!reversed) {\n            TransferLib.refundToken(_ETH, swapCache.refundTo);\n        }\n\n        EventLib.emitOrderRecord(\n            reversed ? _WETH : _ETH,\n            swapCache.toToken,\n            tx.origin,\n            amount,\n            amount - toTokenCommissionAndTrimAmount\n        );\n    }\n}"},"contracts/8/libraries/Constants.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// Per-chain constants are generated into ChainConfig.sol (gitignored) and\n// re-exported transitively to every importer of Constants.sol.\nimport \"./ChainConfig.sol\";\n\n// =============================================================================\n// ============================ ETH Address Constants ==========================\n// =============================================================================\naddress constant _ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n// =============================================================================\n// ======================= Universal Masks And Flags ===========================\n// =============================================================================\nuint256 constant _ADDRESS_MASK =\n    0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;\nuint256 constant _REVERSE_MASK =\n    0x8000000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _ORDER_ID_MASK =\n    0xffffffffffffffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _WEIGHT_MASK =\n    0x00000000000000000000ffff0000000000000000000000000000000000000000;\nuint256 constant _CALL_GAS_LIMIT = 5000;\nuint256 constant ORIGIN_PAYER =\n    0x3ca20afc2ccc0000000000000000000000000000000000000000000000000000;\n// Marker for the DexRouter caller tail word appended before ORIGIN_PAYER.\nuint256 constant DEX_ROUTER_CALLER_MARKER =\n    0x3ca20afc2ddd0000000000000000000000000000000000000000000000000000;\n// Exact-match mask for marker validation.\nuint256 constant MARKER_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant SWAP_AMOUNT =\n    0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\nuint256 constant _WETH_MASK =\n    0x4000000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _ONE_FOR_ZERO_MASK = 1 << 255; // Mask for identifying if the swap is one-for-zero\nuint256 constant _WETH_UNWRAP_MASK = 1 << 253; // Mask for identifying if WETH should be unwrapped to ETH\n\n// =============================================================================\n// ===================== Transfer Mode Masks and Flags =========================\n// =============================================================================\nuint256 constant _MODE_LEGACY =\n    0x0000000000000000000000000000000000000000000000000000000000000000; // 0b000 in [bit251, bit250, bit249]\nuint256 constant _MODE_PERMIT2_ALLOWANCE =\n    0x0200000000000000000000000000000000000000000000000000000000000000; // 0b001 in [bit251, bit250, bit249]\nuint256 constant _MODE_PERMIT2_SIGNATURE =\n    0x0600000000000000000000000000000000000000000000000000000000000000; // 0b011 in [bit251, bit250, bit249]\nuint256 constant _MODE_BY_INVEST =\n    0x0400000000000000000000000000000000000000000000000000000000000000; // 0b010 in [bit251, bit250, bit249]\nuint256 constant _MODE_NO_TRANSFER =\n    0x0800000000000000000000000000000000000000000000000000000000000000; // 0b100 in [bit251, bit250, bit249]\nuint256 constant _MODE_DIRECT =\n    0x0A00000000000000000000000000000000000000000000000000000000000000; // 0b101 in [bit251, bit250, bit249]\nuint256 constant _TRANSFER_MODE_MASK =\n    0x0E00000000000000000000000000000000000000000000000000000000000000; // 0b111 in [bit251, bit250, bit249]\n\n// =============================================================================\n// ============================== DAG Swap Masks ===============================\n// =============================================================================\nuint256 constant _INPUT_INDEX_MASK =\n    0x0000000000000000ff0000000000000000000000000000000000000000000000;\nuint256 constant _OUTPUT_INDEX_MASK =\n    0x000000000000000000ff00000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ======================= Commission Masks and Flags ==========================\n// =============================================================================\nuint256 constant _COMMISSION_RATE_MASK =\n    0x000000000000ffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _COMMISSION_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION =\n    0x3ca20afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION =\n    0x3ca20afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION_DUAL =\n    0x22220afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION_DUAL =\n    0x22220afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION_MULTIPLE =\n    0x88880afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION_MULTIPLE =\n    0x88880afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant _COMMISSION_LENGTH_MASK =\n    0x00ff000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _TO_B_COMMISSION_MASK =\n    0x8000000000000000000000000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ============================= Trim Masks and Flags ==========================\n// =============================================================================\nuint256 constant _TRIM_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK =\n    0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;\nuint256 constant _TRIM_RATE_MASK =\n    0x000000000000ffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _TO_B_TRIM_MASK =\n    0x0000000000008000000000000000000000000000000000000000000000000000;\nuint256 constant TRIM_FLAG =\n    0x7777777711110000000000000000000000000000000000000000000000000000;\nuint256 constant TRIM_DUAL_FLAG =\n    0x7777777722220000000000000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ======================== Permit2 Info Masks and Flags =======================\n// =============================================================================\nuint256 constant _PERMIT2_INFO_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant _PERMIT2_INFO_AMOUNT_LENGTH_MASK =\n    0x000000000000ff00000000000000000000000000000000000000000000000000;\nuint256 constant _PERMIT2_INFO_NONCE_MASK =\n    0x0000000000000000000000000000000000000000000000000000ffffffffffff;\nuint256 constant _PERMIT2_INFO_DEADLINE_MASK =\n    0x0000000000000000000000000000000000000000ffffffffffff000000000000;\nuint256 constant _PERMIT2_INFO_SIGNATURE_V_MASK =\n    0x00000000000000000000000000000000000000ff000000000000000000000000;\nuint256 constant PERMIT2_INFO_SIG65_FLAG =\n    0x92527fff1a650000000000000000000000000000000000000000000000000000; // bytes5(keccak256(\"Permit2Info\")) + 0x65\nuint256 constant PERMIT2_INFO_SIG64_FLAG =\n    0x92527fff1a640000000000000000000000000000000000000000000000000000; // bytes5(keccak256(\"Permit2Info\")) + 0x64\n\n// =============================================================================\n// ============================= RefundTo Masks and Flags ======================\n// =============================================================================\nuint256 constant _REFUND_TO_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant REFUND_TO_ADDRESS_FLAG =\n    0xac3a7da8b1c60000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"RefundTo\"))\n\n// =============================================================================\n// ==================== UniswapV3 Callback Flags ===============================\n// =============================================================================\nbytes32 constant V3_EXACT_IN_CALLBACK_FLAG = 0x97d5390607e40000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"V3ExactInCallback\"))\nbytes32 constant V3_EXACT_OUT_CALLBACK_FLAG = 0xae25331d0e6e0000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"V3ExactOutCallback\"))\n\n// =============================================================================\n// ============================= Universal Values ==============================\n// =============================================================================\nuint256 constant MIN_COMMISSION_MULTIPLE_NUM = 3; // min referrer num for multiple commission\nuint256 constant MAX_COMMISSION_MULTIPLE_NUM = 8; // max referrer num for multiple commission\nuint256 constant COMMISSION_RATE_LIMIT = 30000000; // 3%\nuint256 constant COMMISSION_DENOMINATOR_1E9 = 10 ** 9;\nuint256 constant NO_TO_B_MODE = 1; // value for no-toB commission and no-toB trim when related encoded calldata exists\nuint256 constant TO_B_MODE = 2; // value for toB commission and toB trim when related encoded calldata exists\nuint256 constant WAD = 10 ** 18;\nuint256 constant TRIM_RATE_LIMIT = 100;\nuint256 constant TRIM_DENOMINATOR_1E3 = 1000;\n// =============================================================================\n// ==================== Network-Specific Constants =============================\n// =============================================================================\n// NATIVE_TOKEN_TRANSFER_GAS_LIMIT, _WETH, _APPROVE_PROXY, _PERMIT2 and _FF_FACTORY\n// are per-chain values. They live in ChainConfig.sol (generated per deploy by\n// scripts/deploy/gen-chainconfig.js, gitignored) and are re-exported via the import above.\n"},"contracts/8/libraries/EventLib.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../interfaces/IDexRouter.sol\";\n\n/// @title EventLib\n/// @notice The single source of truth for all DexRouter event definitions in this repository.\n/// @dev This library centralizes DexRouter events to ensure consistency across all contracts and libraries.\n///      Other contracts/router should use the emit functions provided here instead of defining events locally.\nlibrary EventLib {\n    /// ==============================================================\n    /// ========================= Events =============================\n    /// ==============================================================\n    event OrderRecord(\n        address fromToken,\n        address toToken,\n        address sender,\n        uint256 fromAmount,\n        uint256 returnAmount\n    );\n\n    event SwapOrderId(uint256 id);\n\n    event CommissionAndTrimInfo(\n        uint256 toBCommission, // 0 for no encoded commission data, 1 for no-toB commission, 2 for toB commission\n        uint256 toBTrim, // 0 for no encoded trim data, 1 for no-toB trim, 2 for toB trim\n        uint256 trimRate,\n        uint256 chargeRate\n    );\n\n    // @notice CommissionFromTokenRecord is emitted in assembly, commentted out for contract size saving\n    // event CommissionFromTokenRecord(\n    //     address fromTokenAddress,\n    //     uint256 commissionAmount,\n    //     address referrerAddress,\n    //     uint256 commissionRate\n    // );\n\n    // @notice CommissionToTokenRecord is emitted in assembly, commentted out for contract size saving\n    // event CommissionToTokenRecord(\n    //     address toTokenAddress,\n    //     uint256 commissionAmount,\n    //     address referrerAddress,\n    //     uint256 commissionRate\n    // );\n\n    // @notice PositiveSlippageTrimRecord is emitted in assembly, commentted out for contract size saving\n    // event PositiveSlippageTrimRecord(\n    //     address toTokenAddress,\n    //     uint256 trimAmount,\n    //     address trimAddress\n    // );\n\n    // @notice PositiveSlippageChargeRecord is emitted in assembly, commentted out for contract size saving\n    // event PositiveSlippageChargeRecord(\n    //     address toTokenAddress,\n    //     uint256 chargeAmount,\n    //     address chargeAddress\n    // );\n\n    /// ==============================================================\n    /// ====================== Emit Functions ========================\n    /// ==============================================================\n    function emitOrderRecord(\n        address fromToken,\n        address toToken,\n        address sender,\n        uint256 fromAmount,\n        uint256 returnAmount\n    ) internal {\n        emit OrderRecord(fromToken, toToken, sender, fromAmount, returnAmount);\n    }\n\n    function emitSwapOrderId(uint256 id) internal {\n        emit SwapOrderId(id);\n    }\n\n    function emitCommissionAndTrimInfoIfNeeded(IDexRouter.ExtraData memory extraData) internal {\n        if (extraData.commissionInfo.isFromTokenCommission || extraData.commissionInfo.isToTokenCommission || extraData.trimInfo.hasTrim) {\n            emit CommissionAndTrimInfo(\n                extraData.commissionInfo.toBCommission,\n                extraData.trimInfo.toBTrim,\n                extraData.trimInfo.trimRate,\n                extraData.trimInfo.chargeRate\n            );\n        }\n    }\n}"},"contracts/8/libraries/CommissionLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\n\nlibrary CommissionLib {\n    /// @notice swapCache.refundTo is not used in this function.\n    function doCommissionFromToken(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        IDexRouter.SwapCache memory swapCache,\n        uint256 fromTokenCommissionAmount,\n        bool hasTrim\n    ) internal returns (address middleReceiver, uint256 balanceBefore) {\n        if (commissionInfo.isToTokenCommission || hasTrim) {\n            middleReceiver = address(this);\n            balanceBefore = CommonLib.getBalanceOf(swapCache.toToken, address(this));\n        } else {\n            middleReceiver = swapCache.receiver;\n        }\n\n        if (commissionInfo.isFromTokenCommission) {\n            _doCommissionFromTokenInternal(commissionInfo, swapCache.payer, fromTokenCommissionAmount);\n        }\n    }\n\n    /// @notice For ERC20 fromToken non-toB commission with PERMIT2_SIGNATURE mode, the commission token has been transferred to referrers earlier than here.\n    ///         So for this situation, only need to emit event.\n    function _doCommissionFromTokenInternal(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address payer,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        assembly (\"memory-safe\") {\n            // https://github.com/Vectorized/solady/blob/701406e8126cfed931645727b274df303fbcd94d/src/utils/FixedPointMathLib.sol#L595\n            function _mulDiv(x, y, d) -> z {\n                z := mul(x, y)\n                // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`.\n                if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) {\n                    mstore(0x00, 0xad251c27) // `MulDivFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := div(z, d)\n            }\n            function _safeSub(x, y) -> z {\n                if lt(x, y) {\n                    mstore(0x00, 0x46e72d03) // `SafeSubFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := sub(x, y)\n            }\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _sendETH(to, amount) {\n                if and(gt(amount, 0), iszero(eq(to, address()))) {\n                    let success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, to, amount, 0, 0, 0, 0)\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x0000001c20636f6d6d697373696f6e2077697468206574686572206572726f72,\n                            0x60\n                        ) // \"commission with ether error\"\n                    }\n                }\n            }\n            function _claimToken(token, _payer, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    0x0a5ea46600000000000000000000000000000000000000000000000000000000\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amount)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            function _sendToken(token, to, amount) {\n                if gt(amount, 0) {\n                    let freePtr := mload(0x40)\n                    mstore(0x40, add(freePtr, 0x44))\n                    mstore(\n                        freePtr,\n                        0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                    ) // transfer\n                    mstore(add(freePtr, 0x04), to)\n                    mstore(add(freePtr, 0x24), amount)\n                    let success := call(\n                        gas(),\n                        token,\n                        0,\n                        freePtr,\n                        0x44,\n                        0,\n                        0x20\n                    )\n                    if and(\n                        iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                        success\n                    ) {\n                        success := iszero(\n                            or(iszero(extcodesize(token)), returndatasize())\n                        )\n                    }\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x0000001c207472616e7366657220746f6b656e2072656665726572206661696c,\n                            0x60\n                        ) // \"transfer token referer fail\"\n                    }\n                }\n            }\n            function _getBalanceOfToken(token) -> tokenBalance {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x24))\n                mstore(\n                    freePtr,\n                    0x70a0823100000000000000000000000000000000000000000000000000000000\n                ) // balanceOf\n                // get token balance of address(this)\n                mstore(add(freePtr, 0x4), address())\n                let success := staticcall(\n                    gas(),\n                    token,\n                    freePtr,\n                    0x24,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x00000015206765742062616c616e63654f66206661696c656400000000000000,\n                        0x59\n                    ) // \"get balanceOf failed\"\n                }\n                tokenBalance := mload(0x00)\n            }\n            function _emitCommissionFromToken(token, amount, referrer, rate) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x80))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), amount)\n                mstore(add(freePtr, 0x40), referrer)\n                mstore(add(freePtr, 0x60), rate)\n                log1(\n                    freePtr,\n                    0x80,\n                    0xcd5eae9d9d0b96532bd1b7dbf6628ce436b2af735829087a03c548439f8bf850\n                ) //emit CommissionFromTokenRecord(address,uint256,address,uint256)\n            }\n            function _transferTokenDirect(token, from, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if and(\n                    iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                    success\n                ) {\n                    success := iszero(\n                        or(iszero(extcodesize(token)), returndatasize())\n                    )\n                }\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n            function _transferTokenPermit2Allowance(token, from, to, amount) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amount) {\n                    _revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n            function _transferTokenWithMode(token, mode, _payer, to, amount) {\n                if gt(amount, 0) {\n                    // _payer has been set to address(this), means the token has been transferred to address(this).\n                    if eq(_payer, address()) {\n                        _sendToken(token, to, amount)\n                    }\n                    // _payer != address(this) && _payer != address(0), means the token has not been transferred yet.\n                    if iszero(or(eq(_payer, address()), eq(_payer, 0))) {\n                        switch mode\n                        case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                            _transferTokenDirect(token, _payer, to, amount)\n                        }\n                        case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                            _transferTokenPermit2Allowance(token, _payer, to, amount)\n                        }\n                        case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                            _claimToken(token, _payer, to, amount)\n                        }\n                        default {\n                            _revertWithReason(\n                                0x0000001520696e76616c6964207472616e73666572206d6f6465000000000000,\n                                0x5a\n                            ) // \"invalid transfer mode\"\n                        }\n                    }\n                }\n            }\n\n            let tokenWithMode := mload(add(commissionInfo, 0x40))\n            let mode := and(tokenWithMode, _TRANSFER_MODE_MASK)\n            let token := and(tokenWithMode, _ADDRESS_MASK)\n            let toBCommission := mload(add(commissionInfo, 0x60))\n            let totalRate := 0\n            let referrerNum := mload(add(commissionInfo, 0x80))\n            for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                totalRate := add(totalRate, rate)\n            }\n            if eq(token, _ETH) { // commission token is ETH, the process is same between no toB mode and toB mode\n                let sendAmount := 0\n                for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                    let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                    let referrer := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    let amount\n                    switch eq(i, sub(referrerNum, 1))\n                    case 1 {\n                        amount := sub(fromTokenCommissionAmount, sendAmount)\n                    }\n                    default {\n                        amount := _mulDiv(fromTokenCommissionAmount, rate, totalRate)\n                        sendAmount := add(sendAmount, amount)\n                    }\n                    _sendETH(referrer, amount)\n                    _emitCommissionFromToken(_ETH, amount, referrer, rate)\n                }\n            }\n            if iszero(eq(token, _ETH)) {\n                if and(eq(toBCommission, TO_B_MODE), eq(mode, _MODE_PERMIT2_SIGNATURE)) { // ToB mode && transferMode == _MODE_PERMIT2_SIGNATURE, the token should have been claimed to address(this)\n                    // require(payer == address(), \"invalid payer\");\n                    if iszero(eq(payer, address())) {\n                        _revertWithReason(\n                            0x0000000e20696e76616c69642070617965720000000000000000000000000000,\n                            0x52\n                        ) // \"invalid payer\"\n                    }\n                }\n                // ToB mode && transferMode != _MODE_PERMIT2_SIGNATURE, the token needs to be claimed from payer to address(this) first\n                if and(eq(toBCommission, TO_B_MODE), iszero(eq(mode, _MODE_PERMIT2_SIGNATURE))) {\n                    _transferTokenWithMode(token, mode, payer, address(), fromTokenCommissionAmount)\n                    payer := address()\n                    fromTokenCommissionAmount := _getBalanceOfToken(token)\n                }\n\n                // For ToC mode && transferMode == _MODE_PERMIT2_SIGNATURE, the commission has already been transferred via Permit2 batch transfer.\n                // In this case, we only need to emit events, not transfer again.\n                let skipTransfer := and(eq(toBCommission, NO_TO_B_MODE), eq(mode, _MODE_PERMIT2_SIGNATURE))\n\n                // Execute the transfer to referrers (or just emit events if skipTransfer is true)\n                let sendAmount := 0\n                for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                    let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                    let referrer := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    let amount\n                    switch eq(i, sub(referrerNum, 1))\n                    case 1 {\n                        amount := sub(fromTokenCommissionAmount, sendAmount)\n                    }\n                    default {\n                        amount := _mulDiv(fromTokenCommissionAmount, rate, totalRate)\n                        sendAmount := add(sendAmount, amount)\n                    }\n\n                    // Only transfer if not in PERMIT2_SIGNATURE && ToC mode case\n                    if iszero(skipTransfer) {\n                        _transferTokenWithMode(token, mode, payer, referrer, amount)\n                    }\n                    _emitCommissionFromToken(token, amount, referrer, rate)\n                }\n            }\n        }\n    }\n\n    function doCommissionAndTrimToToken(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address receiver,\n        uint256 balanceBefore,\n        address toToken,\n        IDexRouter.TrimInfo memory trimInfo\n    ) internal returns (uint256 totalAmount) {\n        if (!commissionInfo.isToTokenCommission && !trimInfo.hasTrim) {\n            return 0;\n        }\n        uint256 balanceAfter = CommonLib.getBalanceOf(toToken, address(this));\n        assembly (\"memory-safe\") {\n            // https://github.com/Vectorized/solady/blob/701406e8126cfed931645727b274df303fbcd94d/src/utils/FixedPointMathLib.sol#L595\n            function _mulDiv(x, y, d) -> z {\n                z := mul(x, y)\n                // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`.\n                if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) {\n                    mstore(0x00, 0xad251c27) // `MulDivFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := div(z, d)\n            }\n            function _safeSub(x, y) -> z {\n                if lt(x, y) {\n                    mstore(0x00, 0x46e72d03) // `SafeSubFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := sub(x, y)\n            }\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _sendETH(to, amount) {\n                if and(gt(amount, 0), iszero(eq(to, address()))) {\n                    let success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, to, amount, 0, 0, 0, 0)\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x000000122073656e64206574686572206661696c656400000000000000000000,\n                            0x56\n                        ) // \"send ether failed\"\n                    }\n                }\n            }\n            function _sendToken(token, to, amount) {\n                if gt(amount, 0) {\n                    let freePtr := mload(0x40)\n                    mstore(0x40, add(freePtr, 0x44))\n                    mstore(\n                        freePtr,\n                        0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                    ) // transfer\n                    mstore(add(freePtr, 0x04), to)\n                    mstore(add(freePtr, 0x24), amount)\n                    let success := call(\n                        gas(),\n                        token,\n                        0,\n                        freePtr,\n                        0x44,\n                        0,\n                        0x20\n                    )\n                    if and(\n                        iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                        success\n                    ) {\n                        success := iszero(\n                            or(iszero(extcodesize(token)), returndatasize())\n                        )\n                    }\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x00000016207472616e7366657220746f6b656e206661696c6564000000000000,\n                            0x5a\n                        ) // \"transfer token failed\"\n                    }\n                }\n            }\n            function _emitCommissionToToken(token, amount, referrer, rate) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x80))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), amount)\n                mstore(add(freePtr, 0x40), referrer)\n                mstore(add(freePtr, 0x60), rate)\n                log1(\n                    freePtr,\n                    0x80,\n                    0x3cfb523a4c38d88561dd3bf04805a31715c8b5fc468a03b8d684356f360dea99\n                ) //emit CommissionToTokenRecord(address,uint256,address,uint256)\n            }\n            function _emitPositiveSlippageTrimRecord(token, trimAmount, trimAddress) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x60))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), trimAmount)\n                mstore(add(freePtr, 0x40), trimAddress)\n                log1(\n                    freePtr,\n                    0x60,\n                    0x7bec7d55a62a7a7b8068f1533e2a3bbf727b3e2e57f30c576fe159da60e09a65\n                ) // emit PositiveSlippageTrimRecord(address,uint256,address)\n            }\n            function _emitPositiveSlippageChargeRecord(token, chargeAmount, chargeAddress) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x60))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), chargeAmount)\n                mstore(add(freePtr, 0x40), chargeAddress)\n                log1(\n                    freePtr,\n                    0x60,\n                    0xfd08115c8e43d2a49d95ee18d7f69b8bbac60bd368c73cf22d30664a22a0626d\n                ) // emit PositiveSlippageChargeRecord(address,uint256,address)\n            }\n            function _processCommission(commissionInfo_, toToken_, inputAmount) -> commissionAmount {\n                let referrerNum := mload(add(commissionInfo_, 0x80)) // commissionInfo.referrerNum\n                commissionAmount := 0\n                switch eq(toToken_, _ETH)\n                case 1 { // commission token is ETH\n                    for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                        let rate := mload(add(commissionInfo_, add(0xa0, mul(i, 0x40))))\n                        let amount := _mulDiv(inputAmount, rate, COMMISSION_DENOMINATOR_1E9)\n                        let referrer := mload(add(commissionInfo_, add(0xc0, mul(i, 0x40))))\n                        _sendETH(referrer, amount)\n                        _emitCommissionToToken(_ETH, amount, referrer, rate)\n                        commissionAmount := add(commissionAmount, amount)\n                    }\n                }\n                default { // commission token is ERC20\n                    for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                        let rate := mload(add(commissionInfo_, add(0xa0, mul(i, 0x40))))\n                        let amount := _mulDiv(inputAmount, rate, COMMISSION_DENOMINATOR_1E9)\n                        let referrer := mload(add(commissionInfo_, add(0xc0, mul(i, 0x40))))\n                        _sendToken(toToken_, referrer, amount)\n                        _emitCommissionToToken(toToken_, amount, referrer, rate)\n                        commissionAmount := add(commissionAmount, amount)\n                    }\n                }\n            } \n            function _processTrim(trimInfo_, toToken_, inputAmount) -> trimAmount {\n                let trimRate := mload(add(trimInfo_, 0x20)) // trimInfo.trimRate\n                let chargeRate := mload(add(trimInfo_, 0xa0)) // trimInfo.chargeRate\n\n                // uint256 trimAmount = inputAmount - trimInfo.expectAmountOut;\n                let expectAmountOut := mload(add(trimInfo_, 0x80)) // trimInfo.expectAmountOut\n                trimAmount := sub(inputAmount, expectAmountOut)\n                // uint256 allowedMaxTrimAmount = inputAmount * trimInfo.trimRate / TRIM_DENOMINATOR_1E3;\n                let allowedMaxTrimAmount := _mulDiv(inputAmount, trimRate, TRIM_DENOMINATOR_1E3)\n                // trimAmount = min(trimAmount, allowedMaxTrimAmount)\n                if gt(trimAmount, allowedMaxTrimAmount) {\n                    trimAmount := allowedMaxTrimAmount\n                }\n\n                // send token and emit events\n                // actualChargeAmount = trimAmount * chargeRate / TRIM_DENOMINATOR_1E3\n                let actualChargeAmount := _mulDiv(trimAmount, chargeRate, TRIM_DENOMINATOR_1E3)\n                // actualTrimAmount = trimAmount - actualChargeAmount\n                let actualTrimAmount := sub(trimAmount, actualChargeAmount)\n                switch eq(toToken_, _ETH)\n                case 1 { // commission token is ETH\n                    let trimAddress := mload(add(trimInfo_, 0x40)) // trimInfo.trimAddress\n                    _sendETH(trimAddress, actualTrimAmount)\n                    _emitPositiveSlippageTrimRecord(_ETH, actualTrimAmount, trimAddress)\n\n                    let chargeAddress := mload(add(trimInfo_, 0xc0)) // trimInfo.chargeAddress\n                    _sendETH(chargeAddress, actualChargeAmount)\n                    _emitPositiveSlippageChargeRecord(_ETH, actualChargeAmount, chargeAddress)\n                }\n                case 0 { // commission token is ERC20\n                    let trimAddress := mload(add(trimInfo_, 0x40)) // trimInfo.trimAddress\n                    _sendToken(toToken_, trimAddress, actualTrimAmount)\n                    _emitPositiveSlippageTrimRecord(toToken_, actualTrimAmount, trimAddress)\n\n                    let chargeAddress := mload(add(trimInfo_, 0xc0)) // trimInfo.chargeAddress\n                    _sendToken(toToken_, chargeAddress, actualChargeAmount)\n                    _emitPositiveSlippageChargeRecord(toToken_, actualChargeAmount, chargeAddress)\n                }\n            }\n\n            // require(balanceAfter > balanceBefore, \"invalid balance after\");\n            if or(gt(balanceBefore, balanceAfter), eq(balanceAfter, balanceBefore)) {\n                _revertWithReason(\n                    0x0000001620696e76616c69642062616c616e6365206166746572000000000000,\n                    0x5a\n                ) // \"invalid balance after\"\n            }\n            let inputAmount := sub(balanceAfter, balanceBefore)\n\n            // process commission\n            let flag := mload(add(commissionInfo, 0x20)) // commissionInfo.isToTokenCommission\n            if gt(flag, 0) { // commissionInfo.isToTokenCommission == True\n                let commissionAmount := _processCommission(commissionInfo, toToken, inputAmount)\n                inputAmount := sub(inputAmount, commissionAmount)\n                totalAmount := commissionAmount\n            }\n\n            // process trim\n            flag := mload(add(trimInfo, 0x00)) // trimInfo.hasTrim\n            let expectAmountOut := mload(add(trimInfo, 0x80)) // trimInfo.expectAmountOut\n            if and(gt(flag, 0), gt(inputAmount, expectAmountOut)) { // trimInfo.hasTrim == True && inputAmount > trimInfo.expectAmountOut\n                let trimAmount := _processTrim(trimInfo, toToken, inputAmount)\n                inputAmount := sub(inputAmount, trimAmount)\n                totalAmount := add(totalAmount, trimAmount)\n            }\n\n            // transfer toToken to receiver\n            switch eq(toToken, _ETH)\n            case 1 {\n                _sendETH(shr(96, shl(96, receiver)), inputAmount)\n            }\n            default {\n                _sendToken(toToken, shr(96, shl(96, receiver)), inputAmount)\n            }\n        }\n    }\n\n    function validateCommissionInfo(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address fromToken,\n        address toToken,\n        uint256 mode\n    ) internal pure {\n        if (mode == _MODE_NO_TRANSFER && commissionInfo.isFromTokenCommission) {\n            revert(\"From commission not support for NO_TRANSFER mode\");\n        }\n\n        if (mode == _MODE_BY_INVEST && (commissionInfo.isFromTokenCommission || commissionInfo.isToTokenCommission)) {\n            revert(\"Commission not support for BY_INVEST mode\");\n        }\n\n        if (fromToken == toToken) {\n            revert(\"Invalid tokens\");\n        }\n\n        if (commissionInfo.isFromTokenCommission && commissionInfo.isToTokenCommission) {\n            revert(\"Invalid commission direction\");\n        }\n\n        address token = CommonLib.bytes32ToAddress(commissionInfo.tokenWithMode);\n        require(\n            (commissionInfo.isFromTokenCommission && token == fromToken)\n                || (commissionInfo.isToTokenCommission && token == toToken)\n                || (!commissionInfo.isFromTokenCommission && !commissionInfo.isToTokenCommission),\n            \"Invalid commission info\"\n        );\n\n        uint256 totalRate = calculateTotalRate(commissionInfo);\n        require(totalRate <= COMMISSION_RATE_LIMIT, \"Invalid commission rate\");\n\n        // Validate referrer addresses are not zero\n        for (uint256 i = 0; i < commissionInfo.commissionLength; ++i) {\n            address referrerAddress;\n            assembly (\"memory-safe\") {\n                referrerAddress := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n            }\n            require(referrerAddress != address(0), \"Invalid referrer address\");\n        }\n    }\n\n    function calculateTotalRate(IDexRouter.CommissionInfo memory commissionInfo) internal pure returns (uint256 totalRate) {\n        assembly (\"memory-safe\") {\n            let referrerNum := mload(add(commissionInfo, 0x80))\n            for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                totalRate := add(totalRate, rate)\n            }\n        }\n    }\n}"},"contracts/8/libraries/CommonLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./SafeERC20.sol\";\nimport \"../interfaces/IAdapter.sol\";\nimport \"../interfaces/IApproveProxy.sol\";\n\nlibrary CommonLib {\n\n    function getBalanceOf(\n        address token,\n        address user\n    ) internal view returns (uint256 amount) {\n        assembly {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            switch eq(token, _ETH)\n            case 1 {\n                amount := balance(user)\n            }\n            default {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x24))\n                mstore(\n                    freePtr,\n                    0x70a0823100000000000000000000000000000000000000000000000000000000\n                ) //balanceOf\n                mstore(add(freePtr, 0x04), user)\n                let success := staticcall(gas(), token, freePtr, 0x24, 0, 0x20)\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x00000015206765742062616c616e63654f66206661696c656400000000000000,\n                        0x59\n                    ) // \"get balanceOf failed\"\n                }\n                amount := mload(0x00)\n            }\n        }\n    }\n\n    function validateDeadline(uint256 deadLine) internal view {\n        require(deadLine >= block.timestamp, \"Route: expired\");\n    }\n\n    /// @dev Appends dexRouterCaller at -64 and refundTo at -32.\n    function exeAdapter(\n        bool reverse,\n        address adapter,\n        address to,\n        address poolAddress,\n        bytes memory moreinfo,\n        address refundTo\n    ) internal {\n        if (reverse) {\n            (bool s, bytes memory res) = address(adapter).call(\n                abi.encodePacked(\n                    abi.encodeWithSelector(\n                        IAdapter.sellQuote.selector,\n                        to,\n                        poolAddress,\n                        moreinfo\n                    ),\n                    DEX_ROUTER_CALLER_MARKER + uint(uint160(msg.sender)),\n                    ORIGIN_PAYER + uint(uint160(refundTo))\n                )\n            );\n            if (!s) {\n                _revert(res);\n            }\n        } else {\n            (bool s, bytes memory res) = address(adapter).call(\n                abi.encodePacked(\n                    abi.encodeWithSelector(\n                        IAdapter.sellBase.selector,\n                        to,\n                        poolAddress,\n                        moreinfo\n                    ),\n                    DEX_ROUTER_CALLER_MARKER + uint(uint160(msg.sender)),\n                    ORIGIN_PAYER + uint(uint160(refundTo))\n                )\n            );\n            if (!s) {\n                _revert(res);\n            }\n        }\n    }\n\n    /// @notice Converts a uint256 value into an address.\n    /// @param param The uint256 value to be converted.\n    /// @return result The address obtained from the conversion.\n    /// @dev This function is used to extract an address from a uint256,\n    /// typically used when dealing with low-level data operations or when addresses are packed into larger data types.\n    function bytes32ToAddress(\n        uint256 param\n    ) internal pure returns (address result) {\n        assembly {\n            result := and(param, _ADDRESS_MASK)\n        }\n    }\n\n    // ================================ Private Functions ================================\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with \"FailedCall\".\n     * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/c64a1edb67b6e3f4a15cca8909c9482ad33a02b0/contracts/utils/Address.sol#L135-L149\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            assembly (\"memory-safe\") {\n                revert(add(returndata, 0x20), mload(returndata))\n            }\n        } else {\n            revert(\"adaptor call failed\");\n        }\n    }\n}\n"},"contracts/8/libraries/TrimLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\n\nlibrary TrimLib {\n    function validateTrimInfo(IDexRouter.TrimInfo memory trimInfo) internal pure {\n        if (!trimInfo.hasTrim) return;\n\n        // Validate trimRate and chargeRate\n        require(trimInfo.trimRate <= TRIM_RATE_LIMIT, \"error trim rate\");\n        require(trimInfo.chargeRate <= TRIM_DENOMINATOR_1E3, \"error charge rate\");\n\n        // Validate trim/charge recipient addresses to prevent accidental burns.\n        if (trimInfo.chargeRate < TRIM_DENOMINATOR_1E3) { // Not all trim is charged, so trimAddress should not be zero\n            require(trimInfo.trimAddress != address(0), \"Invalid trimAddress\");\n        }\n        if (trimInfo.chargeRate > 0) {\n            require(trimInfo.chargeAddress != address(0), \"Invalid chargeAddress\");\n        }\n    }\n}"},"contracts/8/libraries/TransferLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"./SafeERC20.sol\";\nimport \"./CommissionLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IWETH.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/permit2/IPermit2.sol\";\nimport \"../interfaces/permit2/ISignatureTransfer.sol\";\nimport \"../interfaces/IApproveProxy.sol\";\n\n/// @title Library to handle multi transfer modes including Permit2.\nlibrary TransferLib {\n    /// @notice Handle Permit2Signature mode and fromTokenCommission mainly.\n    /// @param fromTokenWithMode The fromToken with mode encoded in high bits.\n    /// @param payer The address of the payer.\n    /// @param inputAmount The inputAmount of the fromToken.\n    /// @param onlyOneAssetTo The address of the only one assetTo. If the assetTo is more than one, it should be set to address(0).\n    /// @param extraData The extra data, only commissionInfo and permit2Info are used.\n    /// @return The new payer, new inputAmount, and fromTokenCommissionAmount. The new payer can be (1) original payer, (2) address(this), or (3) address(0).\n    ///         The address(0) means the fromToken has been paid and no need to pay later.\n    /// @dev  Since the permitTransferFrom can only be called once in a transaction, this function is designed to handle multiple scenarios and call permitTransferFrom if necessary.\n    function handlePermit2SigModeWithCommission(\n        uint256 fromTokenWithMode,\n        address payer,\n        uint256 inputAmount,\n        address onlyOneAssetTo,\n        IDexRouter.ExtraData memory extraData\n    ) internal returns (address, uint256, uint256) {\n        uint256 mode = fromTokenWithMode & _TRANSFER_MODE_MASK;\n        address token = CommonLib.bytes32ToAddress(fromTokenWithMode);\n        uint256 totalRate = 0;\n        uint256 fromTokenCommissionAmount = 0;\n\n        // For _MODE_BY_INVEST mode, the inputAmount is already the token balance according to agreement, and fromToken can not be ETH, commission is not allowed.\n        if (mode == _MODE_BY_INVEST) {\n            require(token != _ETH, \"Invalid source token\");\n            return (address(this), inputAmount, 0);\n        }\n\n        if (extraData.commissionInfo.isFromTokenCommission) {\n            totalRate = CommissionLib.calculateTotalRate(extraData.commissionInfo);\n            fromTokenCommissionAmount = inputAmount * totalRate / (COMMISSION_DENOMINATOR_1E9 - totalRate);\n        }\n\n        if (token == _ETH) {\n            require(mode == _MODE_LEGACY, \"ETH as fromToken is not allowed for non-legacy mode\");\n            return (address(this), inputAmount, fromTokenCommissionAmount);\n        }\n\n        // For other modes (not _MODE_PERMIT2_SIGNATURE), return the original payer, inputAmount, and calculated fromTokenCommissionAmount.\n        if (mode != _MODE_PERMIT2_SIGNATURE) {\n            return (payer, inputAmount, fromTokenCommissionAmount);\n        }\n\n        require(inputAmount + fromTokenCommissionAmount <= type(uint160).max, \"amount too large\");\n\n        // For _MODE_PERMIT2_SIGNATURE mode, the owner is constrained to router's msg.sender for now, but it still need to be encoded in the permit2Info calldata for future compatibility.\n        // But we use payer instead of msg.sender here, because all passed in payer is router's msg.sender and for UnxswapV3ExactOutRouter the msg.sender got here is not router's msg.sender but pool address.\n        require(extraData.permit2Info.owner == payer, \"permit2Info owner mismatch\");\n\n        // For _MODE_PERMIT2_SIGNATURE mode, token needs to be claimed to address `to` by calling permitTransferFrom. And the address `to` needs to be set according to the situation.\n        // For following 2 situations, the address `to` should be set to address(this):\n        // 1. onlyOneAssetTo=address(0): means the swap method needs the swapToken to be claimed to address(this).\n        // 2. isFromTokenCommission=true && toBCommission=TO_B_MODE: means the fromToken needs to be claimed to address(this) and then transfer commission to referrers.\n        // And when isFromTokenCommission=true && toBCommission=NO_TO_B_MODE, the commission needs to be transferred to referrers immediately.\n        address to;\n        uint256 toBCommission = extraData.commissionInfo.toBCommission;\n        // Get the address `to` according to the situation.\n        if (onlyOneAssetTo == address(0) || (extraData.commissionInfo.isFromTokenCommission && toBCommission == TO_B_MODE)) {\n            to = address(this);\n        } else {\n            to = onlyOneAssetTo;\n        }\n\n        _executePermitTransferFrom(\n            inputAmount,\n            fromTokenCommissionAmount,\n            token,\n            to,\n            totalRate,\n            extraData\n        );\n\n        if (to == address(this)) {\n            // Get balance of token because the token has been claimed to address(this).\n            uint256 balance = CommonLib.getBalanceOf(token, address(this));\n\n            // Calculate the inputAmount and fromTokenCommissionAmount according to the mode.\n            if (extraData.commissionInfo.isFromTokenCommission && toBCommission == TO_B_MODE) { // For Permit2Signature mode && ToB mode, the inputAmount and fromTokenCommissionAmount need to be calculated.\n                inputAmount = inputAmount * balance / (inputAmount + fromTokenCommissionAmount);\n                fromTokenCommissionAmount = balance - inputAmount;\n                return (address(this), inputAmount, fromTokenCommissionAmount); \n            } else { // For other situations (NoToB mode or no fromTokenCommission), the new inputAmount is the balance.\n                return (address(this), balance, fromTokenCommissionAmount);\n            }\n        } else {\n            return (address(0), inputAmount, fromTokenCommissionAmount);\n        }\n    }\n\n    /// @notice Private function to execute permitTransferFrom.\n    function _executePermitTransferFrom(\n        uint256 inputAmount,\n        uint256 fromTokenCommissionAmount,\n        address token,\n        address to,\n        uint256 totalRate,\n        IDexRouter.ExtraData memory extraData\n    ) private {\n        IDexRouter.CommissionInfo memory commissionInfo = extraData.commissionInfo;\n        // Get permitTransferFrom parameters\n        uint256 permitLength;\n        if (commissionInfo.isFromTokenCommission && commissionInfo.toBCommission == NO_TO_B_MODE) {\n            permitLength = commissionInfo.commissionLength + 1;\n        } else {\n            permitLength = 1;\n        }\n        require(permitLength == extraData.permit2Info.amounts.length, \"permit2Info amount length mismatch\");\n\n        // Execute permitTransferFrom\n        ISignatureTransfer.PermitBatchTransferFrom memory permitBatchTransferFrom = ISignatureTransfer.PermitBatchTransferFrom({\n            permitted: new ISignatureTransfer.TokenPermissions[](permitLength),\n            nonce: extraData.permit2Info.nonce,\n            deadline: extraData.permit2Info.deadline\n        });\n        ISignatureTransfer.SignatureTransferDetails[] memory transferDetails = new ISignatureTransfer.SignatureTransferDetails[](permitLength);\n        if (permitLength == 1) { // Generate permit params with permit2 array length = 1\n            permitBatchTransferFrom.permitted[0] = ISignatureTransfer.TokenPermissions({\n                token: token,\n                amount: extraData.permit2Info.amounts[0]\n            });\n            transferDetails[0] = ISignatureTransfer.SignatureTransferDetails({\n                to: to,\n                requestedAmount: inputAmount + fromTokenCommissionAmount\n            });\n        } else { // Generate permit params with permit2 array length > 1 (fromTokenCommission with NoToB mode)\n            for (uint256 i = 0; i < permitLength; ++i) {\n                permitBatchTransferFrom.permitted[i] = ISignatureTransfer.TokenPermissions({\n                    token: token,\n                    amount: extraData.permit2Info.amounts[i]\n                });\n            }\n            // transferDetails[0] is swap part, and the rest are commission parts.\n            transferDetails[0] = ISignatureTransfer.SignatureTransferDetails({\n                to: to,\n                requestedAmount: inputAmount\n            });\n            uint256 accumulatedAmount = 0;\n            for (uint256 i = 0; i < permitLength - 1; ++i) {\n                uint256 commissionRate;\n                address referrerAddress;\n                assembly (\"memory-safe\") {\n                    referrerAddress := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    commissionRate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                }\n                uint256 commissionAmount;\n                if (i == permitLength - 2) {\n                    commissionAmount = fromTokenCommissionAmount - accumulatedAmount;\n                } else {\n                    commissionAmount = fromTokenCommissionAmount * commissionRate / totalRate;\n                    accumulatedAmount += commissionAmount;\n                }\n                transferDetails[i + 1] = ISignatureTransfer.SignatureTransferDetails({\n                    to: referrerAddress,\n                    requestedAmount: commissionAmount\n                });\n            }\n        }\n\n        IPermit2(_PERMIT2).permitTransferFrom(permitBatchTransferFrom, transferDetails, extraData.permit2Info.owner, extraData.permit2Info.signature);\n    }\n\n    /// @notice Transfers tokens internally within the contract.\n    /// @param payer The address of the payer.\n    /// @param to The address of the receiver.\n    /// @param fromTokenWithMode FromToken with mode encoded in high bits\n    /// @param amount The amount of tokens to be transferred.\n    /// @dev Handles the transfer of ERC20 tokens.\n    function transferInternal(\n        address payer,\n        address to,\n        uint256 fromTokenWithMode,\n        uint256 amount\n    ) internal {\n        if (payer == to) {\n            return;\n        }\n\n        address token = address(uint160(fromTokenWithMode & _ADDRESS_MASK));\n        uint256 mode = fromTokenWithMode & _TRANSFER_MODE_MASK;\n\n        // For modes other than _MODE_NO_TRANSFER, payer needs to be checked. If the payer is address(this), the transfer logic is same.\n        // If mode is _MODE_BY_INVEST, the payer passed in must be address(this).\n        if (mode != _MODE_NO_TRANSFER) {\n            if (payer == address(this)) {\n                SafeERC20.safeTransfer(IERC20(token), to, amount);\n            } else {\n                if (mode == _MODE_DIRECT) {\n                    SafeERC20.safeTransferFrom(IERC20(token), payer, to, amount);\n                } else if (mode == _MODE_PERMIT2_ALLOWANCE) {\n                    require(amount <= type(uint160).max, \"amount too large\");\n                    IPermit2(_PERMIT2).transferFrom(payer, to, uint160(amount), token);\n                } else if (mode == _MODE_PERMIT2_SIGNATURE) {\n                    /// @notice The permitTransferFrom should not be called here, and if payer is not reset to address(this), the payer must be address(0).\n                    require(payer == address(0), \"permitTransferFrom must be called before\");\n                } else if (mode == _MODE_LEGACY) {\n                    IApproveProxy(_APPROVE_PROXY).claimTokens(token, payer, to, amount);\n                } else {\n                    revert(\"invalid transfer mode\");\n                }\n            }\n        }\n        // For _MODE_NO_TRANSFER mode, do nothing.\n    }\n\n    /// @notice Transfers the specified token to the user.\n    /// @param token The address of the token to be transferred.\n    /// @param to The address of the receiver.\n    /// @dev Handles the withdrawal of tokens to the user, converting WETH to ETH if necessary.\n    function transferTokenToUser(address token, address to) internal {\n        if (token == _ETH) {\n            uint256 wethBal = CommonLib.getBalanceOf(_WETH, address(this));\n            if (wethBal > 0) {\n                IWETH(_WETH).withdraw(wethBal);\n            }\n            if (to != address(this)) {\n                uint256 ethBal = address(this).balance;\n                if (ethBal > 0) {\n                    (bool success, ) = payable(to).call{value: ethBal, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n                    require(success, \"transfer native token failed\");\n                }\n            }\n        } else {\n            if (to != address(this)) {\n                uint256 bal = CommonLib.getBalanceOf(token, address(this));\n                if (bal > 0) {\n                    SafeERC20.safeTransfer(IERC20(token), to, bal);\n                }\n            }\n        }\n    }\n\n    /// @notice Refunds the specified token to the refundTo address.\n    /// @param token The address of the token to be refunded.\n    /// @param refundTo The address of the receiver.\n    /// @dev Handles the refund of tokens to the refundTo address.\n    function refundToken(address token, address refundTo) internal {\n        if (token == _ETH) {\n            if (refundTo != address(this)) {\n                uint256 ethBal = address(this).balance;\n                if (ethBal > 0) {\n                    (bool success, ) = payable(refundTo).call{value: ethBal, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n                    require(success, \"refund native token failed\");\n                }\n            }\n        } else {\n            uint256 bal = CommonLib.getBalanceOf(token, address(this));\n            if (bal > 0) {\n                SafeERC20.safeTransfer(IERC20(token), refundTo, bal);\n            }\n        }\n    }\n}"},"contracts/8/interfaces/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    function name() external view returns (string memory);\n\n    function symbol() external view returns (string memory);\n\n    function decimals() external view returns (uint8);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address owner) external view returns (uint256);\n\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n}\n"},"contracts/8/interfaces/IWETH.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IWETH {\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address account) external view returns (uint256);\n\n    function transfer(address recipient, uint256 amount)\n        external\n        returns (bool);\n\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256);\n\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    function transferFrom(\n        address src,\n        address dst,\n        uint256 wad\n    ) external returns (bool);\n\n    function deposit() external payable;\n\n    function withdraw(uint256 wad) external;\n}\n"},"contracts/8/libraries/UniswapTokenInfoHelper.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Constants.sol\";\nimport {IUni} from \"../interfaces/IUni.sol\";\nimport {IUniV3} from \"../interfaces/IUniV3.sol\";\n\n/// @title UniswapTokenInfoHelper\n/// @notice Helper functions for getting fromToken and toToken from\n/// encoded pools array of unxswap and uniswapV3Swap methods.\n/// @dev This contract will be used in DexRouter. So the\n/// masks are re-defined here and keep the same as in the original contracts.\nlibrary UniswapTokenInfoHelper {\n    function getUnxswapTokenInfo(bool sendValue, bytes32[] calldata pools)\n        internal\n        view\n        returns (address fromToken, address toToken)\n    {\n        require(pools.length > 0, \"pools must be greater than 0\");\n\n        // get fromToken\n        address firstPoolAddr = address(uint160(uint256(pools[0]) & _ADDRESS_MASK));\n        // default: token0 to token1; reverse: token1 to token0\n        bool firstReversed = (uint256(pools[0]) & _REVERSE_MASK) != 0;\n        fromToken = firstReversed ? IUni(firstPoolAddr).token1() : IUni(firstPoolAddr).token0();\n        if (fromToken == _WETH && sendValue) {\n            fromToken = _ETH;\n        }\n        require(!sendValue || fromToken == _ETH, \"msg.value should be zero\");\n\n        // get toToken\n        bytes32 lastPool = pools[pools.length - 1];\n        address lastPoolAddr = address(uint160(uint256(lastPool) & _ADDRESS_MASK));\n        bool lastReversed = (uint256(lastPool) & _REVERSE_MASK) != 0;\n        toToken = lastReversed ? IUni(lastPoolAddr).token0() : IUni(lastPoolAddr).token1();\n        bool isWeth = (uint256(lastPool) & _WETH_MASK) != 0; // unwrap weth to eth eventually\n        if (toToken == _WETH && isWeth) {\n            toToken = _ETH;\n        }\n    }\n\n\n    function getUniswapV3TokenInfo(bool sendValue, uint256[] calldata pools)\n        internal\n        view\n        returns (address fromToken, address toToken)\n    {\n        require(pools.length > 0, \"pools must be greater than 0\");\n\n        // get fromToken\n        address firstPoolAddr = address(uint160(pools[0] & _ADDRESS_MASK));\n        bool firstZeroForOne = (pools[0] & _ONE_FOR_ZERO_MASK) == 0;\n        fromToken = firstZeroForOne ? IUniV3(firstPoolAddr).token0() : IUniV3(firstPoolAddr).token1();\n        if (fromToken == _WETH && sendValue) {\n            fromToken = _ETH;\n        }\n        require(!sendValue || fromToken == _ETH, \"msg.value should be zero\");\n\n        // get toToken\n        uint256 lastPool = pools[pools.length - 1];\n        address lastPoolAddr = address(uint160(lastPool & _ADDRESS_MASK));\n        bool lastZeroForOne = (lastPool & _ONE_FOR_ZERO_MASK) == 0;\n        toToken = lastZeroForOne ? IUniV3(lastPoolAddr).token1() : IUniV3(lastPoolAddr).token0();\n        bool unwrapWeth = (lastPool & _WETH_UNWRAP_MASK) != 0; // unwrap weth to eth eventually\n        if (toToken == _WETH && unwrapWeth) {\n            toToken = _ETH;\n        }\n    }\n}"},"contracts/8/libraries/ChainConfig.sol":{"content":"/// SPDX-License-Identifier: MIT\n// AUTO-GENERATED — DO NOT EDIT BY HAND. This file is gitignored.\n// Per-chain constants for the current deploy target. Regenerated per deploy by\n// scripts/deploy/gen-chainconfig.js, or seeded with defaults by scripts/deploy/ensure-chainconfig.js.\npragma solidity ^0.8.0;\n\n// Target chain this config was generated for. DeployDexRouter.s.sol asserts\n// block.chainid == _EXPECTED_CHAIN_ID to prevent deploying with the wrong chain's config.\nuint256 constant _EXPECTED_CHAIN_ID = 1;\n\nuint256 constant NATIVE_TOKEN_TRANSFER_GAS_LIMIT = 100000;\naddress constant _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant _APPROVE_PROXY = 0x70cBb871E8f30Fc8Ce23609E9E0Ea87B6b222F58;\naddress constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;\n// Uniswap V3 CREATE2 prefix: 0xff ++ factory(20 bytes) ++ 11-byte zero padding.\nbytes32 constant _FF_FACTORY = 0xff1F98431c8aD98523631AE4a59f267346ea31F9840000000000000000000000;\n// DexRouter owner (constructor arg in DeployDexRouter.s.sol). Per-chain, REQUIRED in\n// deployed/<chain>/base.js owner (no default). NOT baked into any value/routing path.\naddress constant _OWNER = 0xAcE2B3E7c752d5deBca72210141d464371b3B9b1;\n"},"contracts/8/libraries/SafeERC20.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./SafeMath.sol\";\nimport \"./Address.sol\";\nimport \"./RevertReasonForwarder.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IERC20Permit.sol\";\nimport \"../interfaces/IDaiLikePermit.sol\";\n\n// File @1inch/solidity-utils/contracts/libraries/SafeERC20.sol@v2.1.1\n\nlibrary SafeERC20 {\n    error SafeTransferFailed();\n    error SafeTransferFromFailed();\n    error ForceApproveFailed();\n    error SafeIncreaseAllowanceFailed();\n    error SafeDecreaseAllowanceFailed();\n    error SafePermitBadLength();\n\n    // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {\n        bytes4 selector = token.transferFrom.selector;\n        bool success;\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            mstore(add(data, 0x04), from)\n            mstore(add(data, 0x24), to)\n            mstore(add(data, 0x44), amount)\n            success := call(gas(), token, 0, data, 100, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n        if (!success) revert SafeTransferFromFailed();\n    }\n\n    // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        if (!_makeCall(token, token.transfer.selector, to, value)) {\n            revert SafeTransferFailed();\n        }\n    }\n\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        forceApprove(token, spender, value);\n    }\n\n    // If `approve(from, to, amount)` fails, try to `approve(from, to, 0)` before retry\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        if (!_makeCall(token, token.approve.selector, spender, value)) {\n            if (!_makeCall(token, token.approve.selector, spender, 0) ||\n                !_makeCall(token, token.approve.selector, spender, value))\n            {\n                revert ForceApproveFailed();\n            }\n        }\n    }\n\n    \n\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 allowance = token.allowance(address(this), spender);\n        if (value > type(uint256).max - allowance) revert SafeIncreaseAllowanceFailed();\n        forceApprove(token, spender, allowance + value);\n    }\n\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 allowance = token.allowance(address(this), spender);\n        if (value > allowance) revert SafeDecreaseAllowanceFailed();\n        forceApprove(token, spender, allowance - value);\n    }\n\n    function safePermit(IERC20 token, bytes calldata permit) internal {\n        bool success;\n        if (permit.length == 32 * 7) {\n            success = _makeCalldataCall(token, IERC20Permit.permit.selector, permit);\n        } else if (permit.length == 32 * 8) {\n            success = _makeCalldataCall(token, IDaiLikePermit.permit.selector, permit);\n        } else {\n            revert SafePermitBadLength();\n        }\n        if (!success) RevertReasonForwarder.reRevert();\n    }\n\n    function _makeCall(IERC20 token, bytes4 selector, address to, uint256 amount) private returns(bool success) {\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            mstore(add(data, 0x04), to)\n            mstore(add(data, 0x24), amount)\n            success := call(gas(), token, 0, data, 0x44, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n    }\n\n    function _makeCalldataCall(IERC20 token, bytes4 selector, bytes calldata args) private returns(bool success) {\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let len := add(4, args.length)\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            calldatacopy(add(data, 0x04), args.offset, args.length)\n            success := call(gas(), token, 0, data, len, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n    }\n}\n\n\n"},"contracts/8/interfaces/IAdapter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IAdapter {\n    function sellBase(\n        address to,\n        address pool,\n        bytes memory data\n    ) external;\n\n    function sellQuote(\n        address to,\n        address pool,\n        bytes memory data\n    ) external;\n}\n"},"contracts/8/interfaces/IApproveProxy.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IApproveProxy {\n    function isAllowedProxy(address _proxy) external view returns (bool);\n\n    function claimTokens(\n        address token,\n        address who,\n        address dest,\n        uint256 amount\n    ) external;\n\n    function tokenApprove() external view returns (address);\n    function addProxy(address) external;\n}\n"},"contracts/8/interfaces/permit2/IPermit2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ISignatureTransfer} from \"./ISignatureTransfer.sol\";\nimport {IAllowanceTransfer} from \"./IAllowanceTransfer.sol\";\n\n/// @notice Permit2 handles signature-based transfers in SignatureTransfer and allowance-based transfers in AllowanceTransfer.\n/// @dev Users must approve Permit2 before calling any of the transfer functions.\ninterface IPermit2 is ISignatureTransfer, IAllowanceTransfer {\n// IPermit2 unifies the two interfaces so users have maximal flexibility with their approval.\n}\n"},"contracts/8/interfaces/permit2/ISignatureTransfer.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IEIP712} from \"./IEIP712.sol\";\n\n/// @title SignatureTransfer\n/// @notice Handles ERC20 token transfers through signature based actions\n/// @dev Requires user's token approval on the Permit2 contract\ninterface ISignatureTransfer is IEIP712 {\n    /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount\n    /// @param maxAmount The maximum amount a spender can request to transfer\n    error InvalidAmount(uint256 maxAmount);\n\n    /// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred\n    /// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred\n    error LengthMismatch();\n\n    /// @notice Emits an event when the owner successfully invalidates an unordered nonce.\n    event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask);\n\n    /// @notice The token and amount details for a transfer signed in the permit transfer signature\n    struct TokenPermissions {\n        // ERC20 token address\n        address token;\n        // the maximum amount that can be spent\n        uint256 amount;\n    }\n\n    /// @notice The signed permit message for a single token transfer\n    struct PermitTransferFrom {\n        TokenPermissions permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice Specifies the recipient address and amount for batched transfers.\n    /// @dev Recipients and amounts correspond to the index of the signed token permissions array.\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount.\n    struct SignatureTransferDetails {\n        // recipient address\n        address to;\n        // spender requested amount\n        uint256 requestedAmount;\n    }\n\n    /// @notice Used to reconstruct the signed permit message for multiple token transfers\n    /// @dev Do not need to pass in spender address as it is required that it is msg.sender\n    /// @dev Note that a user still signs over a spender address\n    struct PermitBatchTransferFrom {\n        // the tokens and corresponding amounts permitted for a transfer\n        TokenPermissions[] permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection\n    /// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order\n    /// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce\n    /// @dev It returns a uint256 bitmap\n    /// @dev The index, or wordPosition is capped at type(uint248).max\n    function nonceBitmap(address, uint256) external view returns (uint256);\n\n    /// @notice Transfers a token using a signed permit message\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers a token using a signed permit message\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Invalidates the bits specified in mask for the bitmap at the word position\n    /// @dev The wordPos is maxed at type(uint248).max\n    /// @param wordPos A number to index the nonceBitmap at\n    /// @param mask A bitmap masked against msg.sender's current bitmap at the word position\n    function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external;\n}\n"},"contracts/8/interfaces/IUni.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IUni {\n    function swapExactTokensForTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swap(\n        uint256 amount0Out,\n        uint256 amount1Out,\n        address to,\n        bytes calldata data\n    ) external;\n\n    function getReserves()\n        external\n        view\n        returns (\n            uint112 reserve0,\n            uint112 reserve1,\n            uint32 blockTimestampLast\n        );\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    function sync() external;\n}\n"},"contracts/8/interfaces/IUniV3.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IUniV3 {\n    function swap(\n        address recipient,\n        bool zeroForOne,\n        int256 amountSpecified,\n        uint160 sqrtPriceLimitX96,\n        bytes calldata data\n    ) external returns (int256 amount0, int256 amount1);\n\n    function slot0()\n        external\n        view\n        returns (\n            uint160 sqrtPriceX96,\n            int24 tick,\n            uint16 observationIndex,\n            uint16 observationCardinality,\n            uint16 observationCardinalityNext,\n            uint8 feeProtocol,\n            bool unlocked\n        );\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n    /// @return The fee\n    function fee() external view returns (uint24);\n}\n"},"contracts/8/libraries/SafeMath.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n    uint256 constant WAD = 10**18;\n    uint256 constant RAY = 10**27;\n\n    function wad() public pure returns (uint256) {\n        return WAD;\n    }\n\n    function ray() public pure returns (uint256) {\n        return RAY;\n    }\n\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n\n        return c;\n    }\n\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    function sub(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n\n        return c;\n    }\n\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    function div(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    function mod(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a <= b ? a : b;\n    }\n\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a >= b ? a : b;\n    }\n\n    function sqrt(uint256 a) internal pure returns (uint256 b) {\n        if (a > 3) {\n            b = a;\n            uint256 x = a / 2 + 1;\n            while (x < b) {\n                b = x;\n                x = (a / x + x) / 2;\n            }\n        } else if (a != 0) {\n            b = 1;\n        }\n    }\n\n    function wmul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mul(a, b) / WAD;\n    }\n\n    function wmulRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, b), WAD / 2) / WAD;\n    }\n\n    function rmul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mul(a, b) / RAY;\n    }\n\n    function rmulRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, b), RAY / 2) / RAY;\n    }\n\n    function wdiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(mul(a, WAD), b);\n    }\n\n    function wdivRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, WAD), b / 2) / b;\n    }\n\n    function rdiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(mul(a, RAY), b);\n    }\n\n    function rdivRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, RAY), b / 2) / b;\n    }\n\n    function wpow(uint256 x, uint256 n) internal pure returns (uint256) {\n        uint256 result = WAD;\n        while (n > 0) {\n            if (n % 2 != 0) {\n                result = wmul(result, x);\n            }\n            x = wmul(x, x);\n            n /= 2;\n        }\n        return result;\n    }\n\n    function rpow(uint256 x, uint256 n) internal pure returns (uint256) {\n        uint256 result = RAY;\n        while (n > 0) {\n            if (n % 2 != 0) {\n                result = rmul(result, x);\n            }\n            x = rmul(x, x);\n            n /= 2;\n        }\n        return result;\n    }\n\n    function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 quotient = div(a, b);\n        uint256 remainder = a - quotient * b;\n        if (remainder > 0) {\n            return quotient + 1;\n        } else {\n            return quotient;\n        }\n    }\n}\n"},"contracts/8/libraries/Address.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n        // for accounts without code, i.e. `keccak256('')`\n        bytes32 codehash;\n        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            codehash := extcodehash(account)\n        }\n        return (codehash != accountHash && codehash != 0x0);\n    }\n\n    /**\n     * @dev Converts an `address` into `address payable`. Note that this is\n     * simply a type cast: the actual underlying value is not changed.\n     *\n     * _Available since v2.4.0._\n     */\n    function toPayable(address account)\n        internal\n        pure\n        returns (address payable)\n    {\n        return payable(account);\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     *\n     * _Available since v2.4.0._\n     */\n    function sendValue(address recipient, uint256 amount) internal {\n        require(\n            address(this).balance >= amount,\n            \"Address: insufficient balance\"\n        );\n\n        // solhint-disable-next-line avoid-call-value\n        (bool success, ) = recipient.call{value: amount, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n        require(\n            success,\n            \"Address: unable to send value, recipient may have reverted\"\n        );\n    }\n}\n"},"contracts/8/libraries/RevertReasonForwarder.sol":{"content":"/// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary RevertReasonForwarder {\n    function reRevert() internal pure {\n        // bubble up revert reason from latest external call\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let ptr := mload(0x40)\n            returndatacopy(ptr, 0, returndatasize())\n            revert(ptr, returndatasize())\n        }\n    }\n}"},"contracts/8/interfaces/IERC20Permit.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens,\n     * given `owner`'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"contracts/8/interfaces/IDaiLikePermit.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Interface for DAI-style permits\ninterface IDaiLikePermit {\n    function permit(\n        address holder,\n        address spender,\n        uint256 nonce,\n        uint256 expiry,\n        bool allowed,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n}\n"},"contracts/8/interfaces/permit2/IAllowanceTransfer.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IEIP712} from \"./IEIP712.sol\";\n\n/// @title AllowanceTransfer\n/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts\n/// @dev Requires user's token approval on the Permit2 contract\ninterface IAllowanceTransfer is IEIP712 {\n    /// @notice Thrown when an allowance on a token has expired.\n    /// @param deadline The timestamp at which the allowed amount is no longer valid\n    error AllowanceExpired(uint256 deadline);\n\n    /// @notice Thrown when an allowance on a token has been depleted.\n    /// @param amount The maximum amount allowed\n    error InsufficientAllowance(uint256 amount);\n\n    /// @notice Thrown when too many nonces are invalidated.\n    error ExcessiveInvalidation();\n\n    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.\n    event NonceInvalidation(\n        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce\n    );\n\n    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.\n    event Approval(\n        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration\n    );\n\n    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.\n    event Permit(\n        address indexed owner,\n        address indexed token,\n        address indexed spender,\n        uint160 amount,\n        uint48 expiration,\n        uint48 nonce\n    );\n\n    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.\n    event Lockdown(address indexed owner, address token, address spender);\n\n    /// @notice The permit data for a token\n    struct PermitDetails {\n        // ERC20 token address\n        address token;\n        // the maximum amount allowed to spend\n        uint160 amount;\n        // timestamp at which a spender's token allowances become invalid\n        uint48 expiration;\n        // an incrementing value indexed per owner,token,and spender for each signature\n        uint48 nonce;\n    }\n\n    /// @notice The permit message signed for a single token allowance\n    struct PermitSingle {\n        // the permit data for a single token alownce\n        PermitDetails details;\n        // address permissioned on the allowed tokens\n        address spender;\n        // deadline on the permit signature\n        uint256 sigDeadline;\n    }\n\n    /// @notice The permit message signed for multiple token allowances\n    struct PermitBatch {\n        // the permit data for multiple token allowances\n        PermitDetails[] details;\n        // address permissioned on the allowed tokens\n        address spender;\n        // deadline on the permit signature\n        uint256 sigDeadline;\n    }\n\n    /// @notice The saved permissions\n    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message\n    /// @dev Setting amount to type(uint160).max sets an unlimited approval\n    struct PackedAllowance {\n        // amount allowed\n        uint160 amount;\n        // permission expiry\n        uint48 expiration;\n        // an incrementing value indexed per owner,token,and spender for each signature\n        uint48 nonce;\n    }\n\n    /// @notice A token spender pair.\n    struct TokenSpenderPair {\n        // the token the spender is approved\n        address token;\n        // the spender address\n        address spender;\n    }\n\n    /// @notice Details for a token transfer.\n    struct AllowanceTransferDetails {\n        // the owner of the token\n        address from;\n        // the recipient of the token\n        address to;\n        // the amount of the token\n        uint160 amount;\n        // the token to be transferred\n        address token;\n    }\n\n    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.\n    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]\n    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.\n    function allowance(address user, address token, address spender)\n        external\n        view\n        returns (uint160 amount, uint48 expiration, uint48 nonce);\n\n    /// @notice Approves the spender to use up to amount of the specified token up until the expiration\n    /// @param token The token to approve\n    /// @param spender The spender address to approve\n    /// @param amount The approved amount of the token\n    /// @param expiration The timestamp at which the approval is no longer valid\n    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve\n    /// @dev Setting amount to type(uint160).max sets an unlimited approval\n    function approve(address token, address spender, uint160 amount, uint48 expiration) external;\n\n    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature\n    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce\n    /// @param owner The owner of the tokens being approved\n    /// @param permitSingle Data signed over by the owner specifying the terms of approval\n    /// @param signature The owner's signature over the permit data\n    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;\n\n    /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature\n    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce\n    /// @param owner The owner of the tokens being approved\n    /// @param permitBatch Data signed over by the owner specifying the terms of approval\n    /// @param signature The owner's signature over the permit data\n    function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;\n\n    /// @notice Transfer approved tokens from one address to another\n    /// @param from The address to transfer from\n    /// @param to The address of the recipient\n    /// @param amount The amount of the token to transfer\n    /// @param token The token address to transfer\n    /// @dev Requires the from address to have approved at least the desired amount\n    /// of tokens to msg.sender.\n    function transferFrom(address from, address to, uint160 amount, address token) external;\n\n    /// @notice Transfer approved tokens in a batch\n    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers\n    /// @dev Requires the from addresses to have approved at least the desired amount\n    /// of tokens to msg.sender.\n    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;\n\n    /// @notice Enables performing a \"lockdown\" of the sender's Permit2 identity\n    /// by batch revoking approvals\n    /// @param approvals Array of approvals to revoke.\n    function lockdown(TokenSpenderPair[] calldata approvals) external;\n\n    /// @notice Invalidate nonces for a given (token, spender) pair\n    /// @param token The token to invalidate nonces for\n    /// @param spender The spender to invalidate nonces for\n    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.\n    /// @dev Can't invalidate more than 2**16 nonces per transaction.\n    function invalidateNonces(address token, address spender, uint48 newNonce) external;\n}\n"},"contracts/8/interfaces/permit2/IEIP712.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IEIP712 {\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"}},"compilation":{"language":"Solidity","compiler":"solc","compilerVersion":"0.8.17+commit.8df45f5f","compilerSettings":{"viaIR":false,"metadata":{"bytecodeHash":"ipfs","useLiteralContent":false},"libraries":{"contracts/8/DexRouter.sol":{"DagRouter":"0x408fab3aafc590d99b09e6ad13ad5df73b066526","UnxswapRouter":"0x14d28f43301a5a6277afad65e9817e0a12ea0fec","SwapWrapRouter":"0x057d1e699296cced17696c442e637dca69b34e1a","SmartSwapRouter":"0xbf0824d673a73c67287059fd351794284646b8d7","UnxswapV3Router":"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f"}},"optimizer":{"runs":200,"enabled":true},"evmVersion":"london","remappings":["@ensdomains/=node_modules/@ensdomains/","@openzeppelin/=node_modules/@openzeppelin/","ds-test/=lib/forge-std/lib/ds-test/src/","eth-gas-reporter/=node_modules/eth-gas-reporter/","forge-std/=lib/forge-std/src/","hardhat/=node_modules/hardhat/","@dex/=contracts/8/","@dex-exactout/=contracts/exactout/","@uniswap/=node_modules/@uniswap/","@zetachain/=node_modules/@zetachain/"]},"name":"DexRouter","fullyQualifiedName":"contracts/8/DexRouter.sol:DexRouter"},"abi":[{"type":"constructor","inputs":[{"name":"_owner","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"AlreadyPaused","type":"error","inputs":[]},{"name":"AlreadyPausedByOwner","type":"error","inputs":[]},{"name":"AlreadySet","type":"error","inputs":[]},{"name":"NotOwner","type":"error","inputs":[]},{"name":"NotPaused","type":"error","inputs":[]},{"name":"NotReporter","type":"error","inputs":[]},{"name":"ZeroAddress","type":"error","inputs":[]},{"name":"OwnerChanged","type":"event","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"name":"OwnerPaused","type":"event","inputs":[],"anonymous":false},{"name":"OwnerUnpaused","type":"event","inputs":[],"anonymous":false},{"name":"ReporterPaused","type":"event","inputs":[{"name":"reporter","type":"address","indexed":true,"internalType":"address"},{"name":"until","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"name":"ReporterUpdated","type":"event","inputs":[{"name":"reporter","type":"address","indexed":true,"internalType":"address"},{"name":"added","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"name":"dagSwapByOrderId","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"paths","type":"tuple[]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"dagSwapTo","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"paths","type":"tuple[]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"isPaused","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"owner","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"pause","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"pauseByReporter","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"pauseUntil","type":"function","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"name":"reporters","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"setReporter","type":"function","inputs":[{"name":"reporter","type":"address","internalType":"address"},{"name":"added","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"smartSwapByOrderId","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"batchesAmount","type":"uint256[]","internalType":"uint256[]"},{"name":"batches","type":"tuple[][]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]"},{"name":"pmmRequests","type":"tuple[]","components":[{"name":"pathIndex","type":"uint256","internalType":"uint256"},{"name":"payer","type":"address","internalType":"address"},{"name":"fromToken","type":"address","internalType":"address"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"toTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"salt","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"},{"name":"isPushOrder","type":"bool","internalType":"bool"},{"name":"extension","type":"bytes","internalType":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"smartSwapTo","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"batchesAmount","type":"uint256[]","internalType":"uint256[]"},{"name":"batches","type":"tuple[][]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]"},{"name":"pmmRequests","type":"tuple[]","components":[{"name":"pathIndex","type":"uint256","internalType":"uint256"},{"name":"payer","type":"address","internalType":"address"},{"name":"fromToken","type":"address","internalType":"address"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"toTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"salt","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"},{"name":"isPushOrder","type":"bool","internalType":"bool"},{"name":"extension","type":"bytes","internalType":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"swapWrap","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"rawdata","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"swapWrapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"}],"outputs":[],"stateMutability":"payable"},{"name":"transferOwnership","type":"function","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapCallback","type":"function","inputs":[{"name":"amount0Delta","type":"int256","internalType":"int256"},{"name":"amount1Delta","type":"int256","internalType":"int256"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapTo","type":"function","inputs":[{"name":"receiver","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"pools","type":"uint256[]","internalType":"uint256[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"uniswapV3SwapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"pools","type":"uint256[]","internalType":"uint256[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unpause","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"unxswapByOrderId","type":"function","inputs":[{"name":"srcToken","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unxswapTo","type":"function","inputs":[{"name":"srcToken","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unxswapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"version","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"type":"receive","stateMutability":"payable"}],"metadata":{"compiler":{"version":"0.8.17+commit.8df45f5f"},"language":"Solidity","output":{"abi":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyPaused","type":"error"},{"inputs":[],"name":"AlreadyPausedByOwner","type":"error"},{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotReporter","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"OwnerPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"OwnerUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reporter","type":"address"},{"indexed":false,"internalType":"uint64","name":"until","type":"uint64"}],"name":"ReporterPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reporter","type":"address"},{"indexed":false,"internalType":"bool","name":"added","type":"bool"}],"name":"ReporterUpdated","type":"event"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"components":[{"internalType":"address[]","name":"mixAdapters","type":"address[]"},{"internalType":"address[]","name":"assetTo","type":"address[]"},{"internalType":"uint256[]","name":"rawData","type":"uint256[]"},{"internalType":"bytes[]","name":"extraData","type":"bytes[]"},{"internalType":"uint256","name":"fromToken","type":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]","name":"paths","type":"tuple[]"}],"name":"dagSwapByOrderId","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"components":[{"internalType":"address[]","name":"mixAdapters","type":"address[]"},{"internalType":"address[]","name":"assetTo","type":"address[]"},{"internalType":"uint256[]","name":"rawData","type":"uint256[]"},{"internalType":"bytes[]","name":"extraData","type":"bytes[]"},{"internalType":"uint256","name":"fromToken","type":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]","name":"paths","type":"tuple[]"}],"name":"dagSwapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseByReporter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseUntil","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"reporters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"reporter","type":"address"},{"internalType":"bool","name":"added","type":"bool"}],"name":"setReporter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"internalType":"uint256[]","name":"batchesAmount","type":"uint256[]"},{"components":[{"internalType":"address[]","name":"mixAdapters","type":"address[]"},{"internalType":"address[]","name":"assetTo","type":"address[]"},{"internalType":"uint256[]","name":"rawData","type":"uint256[]"},{"internalType":"bytes[]","name":"extraData","type":"bytes[]"},{"internalType":"uint256","name":"fromToken","type":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]","name":"batches","type":"tuple[][]"},{"components":[{"internalType":"uint256","name":"pathIndex","type":"uint256"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmountMax","type":"uint256"},{"internalType":"uint256","name":"toTokenAmountMax","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"},{"internalType":"bool","name":"isPushOrder","type":"bool"},{"internalType":"bytes","name":"extension","type":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]","name":"pmmRequests","type":"tuple[]"}],"name":"smartSwapByOrderId","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"internalType":"uint256[]","name":"batchesAmount","type":"uint256[]"},{"components":[{"internalType":"address[]","name":"mixAdapters","type":"address[]"},{"internalType":"address[]","name":"assetTo","type":"address[]"},{"internalType":"uint256[]","name":"rawData","type":"uint256[]"},{"internalType":"bytes[]","name":"extraData","type":"bytes[]"},{"internalType":"uint256","name":"fromToken","type":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]","name":"batches","type":"tuple[][]"},{"components":[{"internalType":"uint256","name":"pathIndex","type":"uint256"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmountMax","type":"uint256"},{"internalType":"uint256","name":"toTokenAmountMax","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"},{"internalType":"bool","name":"isPushOrder","type":"bool"},{"internalType":"bytes","name":"extension","type":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]","name":"pmmRequests","type":"tuple[]"}],"name":"smartSwapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint256","name":"rawdata","type":"uint256"}],"name":"swapWrap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"}],"name":"swapWrapToWithBaseRequest","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"receiver","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"name":"uniswapV3SwapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"name":"uniswapV3SwapToWithBaseRequest","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"srcToken","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"}],"name":"unxswapByOrderId","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"srcToken","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"}],"name":"unxswapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"components":[{"internalType":"uint256","name":"fromToken","type":"uint256"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"fromTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"deadLine","type":"uint256"}],"internalType":"struct IDexRouter.BaseRequest","name":"baseRequest","type":"tuple"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"}],"name":"unxswapToWithBaseRequest","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}],"devdoc":{"errors":{"AlreadyPausedByOwner()":[{"details":"This error is thrown when owner tries to pause an already owner-paused contract"}]},"kind":"dev","methods":{"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","paths":"An array of RouterPath structs defining the DAG swap route."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","paths":"An array of RouterPath structs defining the DAG swap route.","receiver":"The address that will receive the swapped tokens."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"isPaused()":{"details":"Returns true if block.timestamp < pauseUntil","returns":{"_0":"True if paused, false otherwise"}},"pause()":{"details":"Only callable by the ownerSets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pauseReverts if contract is already paused by ownerOwner can override reporter pause (temporary pause) by calling this function"},"pauseByReporter()":{"details":"Only callable by a reporterReverts if contract is already pausedSets pauseUntil to block.timestamp + 24 hours"},"setReporter(address,bool)":{"details":"Only callable by the owner","params":{"added":"True to add, false to remove","reporter":"Reporter address to add or remove"}},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","batches":"Detailed routing information for executing the swap across different paths or protocols.","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations.","orderId":"Unique identifier for the swap order, facilitating tracking.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic)."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","batches":"Detailed routing information for executing the swap across different paths or protocols.","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations.","orderId":"Unique identifier for the swap order, facilitating tracking.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic).","receiver":"Address to receive the output tokens from the swap."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"swapWrap(uint256,uint256)":{"details":"This function supports bidirectional swaps between ETH and WETH with minimal gas overhead. The rawdata parameter encodes: - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH","params":{"orderId":"Unique identifier for the swap order, facilitating tracking and reference.","rawdata":"Encoded data containing swap direction, transfer mode and amount information using bit masks."}},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"details":"This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly. It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.","params":{"baseRequest":"Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens."}},"transferOwnership(address)":{"details":"Only callable by the current ownerEmits OwnerChanged event with previousOwner (current owner) and newOwner","params":{"newOwner":"New owner address"}},"uniswapV3SwapCallback(int256,int256,bytes)":{"details":"The first 32 bytes of data is a flag to identify which router to call"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"params":{"amount":"The amount of the source token to be swapped.","minReturn":"The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.","pools":"An array of pool identifiers used to define the swap route within Uniswap V3.","receiver":"The address that will receive the swap funds (encoded as uint256 with order ID mask)."},"returns":{"returnAmount":"The amount of tokens received after the completion of the swap."}},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"params":{"baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","pools":"An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.","receiver":"The address that will receive the swapped tokens."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"unpause()":{"details":"Only callable by the ownerResets pauseUntil to NOT_PAUSED, clearing both owner and reporter pausesReverts if contract is not pausedGas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause"},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"params":{"amount":"The amount of the source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.","pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","srcToken":"The source token to be swapped."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"params":{"amount":"The amount of the source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.","pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","receiver":"The address where the swapped tokens will be sent.","srcToken":"The source token to be swapped."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"params":{"baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","pools":"An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.","receiver":"The address that will receive the swapped tokens."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}}},"version":1},"userdoc":{"errors":{"AlreadyPaused()":[{"notice":"Thrown when contract is already paused"}],"AlreadyPausedByOwner()":[{"notice":"Thrown when contract is already paused by owner"}],"AlreadySet()":[{"notice":"Thrown when reporter state is already set"}],"NotOwner()":[{"notice":"Thrown when caller is not the owner"}],"NotPaused()":[{"notice":"Thrown when contract is not paused"}],"NotReporter()":[{"notice":"Thrown when caller is not a reporter"}],"ZeroAddress()":[{"notice":"Thrown when zero address is provided"}]},"events":{"OwnerChanged(address,address)":{"notice":"Emitted when ownership is transferred"},"OwnerPaused()":{"notice":"Emitted when contract is paused by owner"},"OwnerUnpaused()":{"notice":"Emitted when contract is unpaused by owner"},"ReporterPaused(address,uint64)":{"notice":"Emitted when contract is paused by reporter"},"ReporterUpdated(address,bool)":{"notice":"Emitted when a reporter is added or removed"}},"kind":"user","methods":{"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"================================ dagSwap related ================================Executes a DAG swap to a specified receiver using structured base request parameters."},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"Executes a DAG swap to a specified receiver using structured base request parameters."},"isPaused()":{"notice":"Check if the contract is currently paused"},"owner()":{"notice":"Contract owner address"},"pause()":{"notice":"Pause the contract (until manually unpaused by owner)"},"pauseByReporter()":{"notice":"Pause the contract for 24 hours"},"pauseUntil()":{"notice":"Pause state timestamp"},"reporters(address)":{"notice":"Mapping of reporter addresses"},"setReporter(address,bool)":{"notice":"Add or remove a reporter"},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"================================ smartSwap related ================================Executes a smart swap directly to a specified receiver address."},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"Executes a smart swap directly to a specified receiver address."},"swapWrap(uint256,uint256)":{"notice":"================================ swapWrap related ================================Executes a simple swap between ETH and WETH using encoded parameters."},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"notice":"Executes a swap between ETH and WETH using structured base request parameters to a specified receiver."},"transferOwnership(address)":{"notice":"Transfer ownership to a new address"},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"================================ uniswapV3Callback ==============================callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"notice":"============================== uniswapV3Swap related ==============================Executes a swap using the Uniswap V3 protocol."},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"notice":"Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee."},"unpause()":{"notice":"Unpause the contract"},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"notice":"============================== unxswap related ==============================Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"notice":"Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"notice":"Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."}},"version":1}},"settings":{"compilationTarget":{"contracts/8/DexRouter.sol":"DexRouter"},"evmVersion":"london","libraries":{"contracts/8/DexRouter.sol:DagRouter":"0x408fab3aafc590d99b09e6ad13ad5df73b066526","contracts/8/DexRouter.sol:SmartSwapRouter":"0xbf0824d673a73c67287059fd351794284646b8d7","contracts/8/DexRouter.sol:SwapWrapRouter":"0x057d1e699296cced17696c442e637dca69b34e1a","contracts/8/DexRouter.sol:UnxswapRouter":"0x14d28f43301a5a6277afad65e9817e0a12ea0fec","contracts/8/DexRouter.sol:UnxswapV3Router":"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f"},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[":@dex-exactout/=contracts/exactout/",":@dex/=contracts/8/",":@ensdomains/=node_modules/@ensdomains/",":@openzeppelin/=node_modules/@openzeppelin/",":@uniswap/=node_modules/@uniswap/",":@zetachain/=node_modules/@zetachain/",":ds-test/=lib/forge-std/lib/ds-test/src/",":eth-gas-reporter/=node_modules/eth-gas-reporter/",":forge-std/=lib/forge-std/src/",":hardhat/=node_modules/hardhat/"]},"sources":{"contracts/8/DexRouter.sol":{"keccak256":"0xa2e888d60cbec4aace3818de4cb341ac82423ece5ea4de5c2011d5cceed277a9","license":"MIT","urls":["bzz-raw://7cb5daa1e487814408abfff377652e36eddd8ccac29373fd36f67ed86051e910","dweb:/ipfs/QmU2YkbvaK6mQoTtHGiWTkAK42t69HWDjHpmndWWSLVRHs"]},"contracts/8/interfaces/IAdapter.sol":{"keccak256":"0x8861a0548ae3a9b7467c3eb5fcd4c04bce00d58d2cb4eaedd520cf666989fc69","license":"MIT","urls":["bzz-raw://118733596fa2a3ad4c310c9fa2bae239d2daebdaffbe9518e248564c93339025","dweb:/ipfs/QmWyJPwYzW2mQFdP7bemhEpkGTrZy9oCus5fHPEcFnH4uC"]},"contracts/8/interfaces/IApproveProxy.sol":{"keccak256":"0x405f493fdea26f110bcd8585ecb9b63dc477562b31fdfeea73006a38dd084c51","license":"MIT","urls":["bzz-raw://0b5817d2b37a73ffe57f89659f744359d686d5c83a2c66d1afe6053e250ea8fc","dweb:/ipfs/QmQWp1Hyxt45sTUcZu5PtKbLHQM49twkxKzyPEZGQJ35sL"]},"contracts/8/interfaces/IDaiLikePermit.sol":{"keccak256":"0x480d32f19e542d9daa222cb703dd091d4eea3b534c45269fd1f04f8ba470cc44","license":"MIT","urls":["bzz-raw://3a140269977a9ead684809df7f29ecc3b15bc98a94e1b19799cc247b8f006fcd","dweb:/ipfs/QmVgYfTVtfaUqjTkbzHe8G7ZJEhEcJqLvgGBhDLwuYfEUd"]},"contracts/8/interfaces/IDexRouter.sol":{"keccak256":"0x3bb573b81e2ec17af37c3a683136db5f60154093dbb2a2703fe929c2c9ea8524","license":"MIT","urls":["bzz-raw://de99ed726a09e017852a446b92553dec6af808815368a17e85f2645731180cab","dweb:/ipfs/QmX4k5i4giEG1bqnHgHUKXp171iLZX12oKqXXJzixasX1T"]},"contracts/8/interfaces/IERC20.sol":{"keccak256":"0xc2d4e51a0477ae32fc24b7a10da9bc9f6b0754fee338c1b099e8335b8b2fb18c","license":"MIT","urls":["bzz-raw://82f3ee0b162cf1bc9a9bfdbb24ac75af5cb2865f2183a857b53590c5ad5ab1eb","dweb:/ipfs/QmYGEwymZyHHRU4wKbXMbXwV2tVWYSVLkr1AvnhwcuSVmy"]},"contracts/8/interfaces/IERC20Permit.sol":{"keccak256":"0x25ca4efda5b398358811f84a4b914a8f1f1cc0522870d5ac166543209220900e","license":"MIT","urls":["bzz-raw://e17f726455864c6b0c14bb7dc842716b488d093de8805027728a6bfe5c4d9f7d","dweb:/ipfs/QmUfVkVkfTBnzBvjCU6ig1e9AoLyZhLfiKJxh51pu3s6Q1"]},"contracts/8/interfaces/IUni.sol":{"keccak256":"0xdbcf77948d2f22cbeb494fea8b053ce6da708a68ccf5965f38aa45d3d4124e0b","license":"MIT","urls":["bzz-raw://2386c909438e34ce6fe90de1953cd61d442dfd6f301fa0291e8e694df4002660","dweb:/ipfs/Qmehr1DdfJWQRppVns8b3r2PmJed3Mw733aFWsTfunvo8k"]},"contracts/8/interfaces/IUniV3.sol":{"keccak256":"0x2e4f6a760cf0327cd1d1137c054e18194739b1b727b2733f3be4befdb707f0d4","license":"MIT","urls":["bzz-raw://c4a58969dceb7f930696da70cfa044e2cadf444aba12a601f1420c1ffd71109e","dweb:/ipfs/Qmf3gKajta4dcmcdPbJXYRY3J1QZ7WmagsgRkK8rmSfy5T"]},"contracts/8/interfaces/IUniswapV3SwapCallback.sol":{"keccak256":"0xe7378c64d6811136b32c8b6fad142a4e7d8f2534337215983e52b288a0dbbbfd","license":"MIT","urls":["bzz-raw://d9058ab07cc5f2bb1b901f00307aa71f1ab4259426698da5b9b5a2ee7b317019","dweb:/ipfs/QmNWFPZ4uoTT7VdoPtjfExHPcaeZJN55WqUrBevMmejxku"]},"contracts/8/interfaces/IWETH.sol":{"keccak256":"0x7dc79bded17353823f20fb059c19d7d4e17fa726d90fb16e877d80955caedd61","license":"MIT","urls":["bzz-raw://e68128f5861e8a9239e490b4f52300e8afe8f532e56bc9e42314e05579307909","dweb:/ipfs/QmSJWjomYU9uSm5GJxU3Cw32cC2th1kUDbPe5T8WNwzGqY"]},"contracts/8/interfaces/permit2/IAllowanceTransfer.sol":{"keccak256":"0x37f0ac203b6ef605c9533e1a739477e8e9dcea90710b40e645a367f8a21ace29","license":"MIT","urls":["bzz-raw://e0104d72aeaec1cd66cc232e7de7b7ead08608efcc179491b8a66387614670b0","dweb:/ipfs/QmfAZDyuNC9FXXbnJUwqHNwmAK6uRrXxtWEytLsxjskPsN"]},"contracts/8/interfaces/permit2/IEIP712.sol":{"keccak256":"0xfdccf2b9639070803cd0e4198427fb0df3cc452ca59bd3b8a0d957a9a4254138","license":"MIT","urls":["bzz-raw://f7c936ac42ce89e827db905a1544397f8bdf46db34cdb6aa1b90dea42fdb4c72","dweb:/ipfs/QmVgurxo1N31qZqkPBirw9Z7S9tLYmv6jSwQp8R8ur2cBk"]},"contracts/8/interfaces/permit2/IPermit2.sol":{"keccak256":"0xaa631cc9f53e699301d94233007110a345e6779011def484e8dd97b8fe0af771","license":"MIT","urls":["bzz-raw://fc0502cf19c9c18f320a3001201e89e350393b75837f6b7971de18b2de06f30d","dweb:/ipfs/QmT9SfhdJ7VJNNrf94g4H5usyi7ShqWGx7Cqsz9jZTjX96"]},"contracts/8/interfaces/permit2/ISignatureTransfer.sol":{"keccak256":"0xe6df9966f8841dc3958ee86169c89de97e7f614c81c28b9dc947b12d732df64e","license":"MIT","urls":["bzz-raw://3d4eafdee7f48c3be8350a94eb6edd0bfb2af2c105df65787a77174f356c0317","dweb:/ipfs/QmY1j2adeeAhNpn6cUuthemxGCdLXHTfyMh9yTKsY4mZ2d"]},"contracts/8/libraries/Address.sol":{"keccak256":"0x004a443da2e1b4c87deee3d90ef5381969a550e72d14c04c51e329cccba5f320","license":"MIT","urls":["bzz-raw://12263d11c29caba329cf5871bb6d734e1c78e9123a9d98d43a03807a7ada4583","dweb:/ipfs/QmTttjMHcsXrnk6JzF6r3qK9JNuAB3Yp3KV6s7F3iTvhLt"]},"contracts/8/libraries/ChainConfig.sol":{"keccak256":"0xd1209ba067d7ba326cd15cdfe6fd0715911f1644f1ad8dc4c0d73f75c3473334","license":"MIT","urls":["bzz-raw://772925bb432d65a32d8fe20eae84fbadcc1e34e010a7c7d4900337e3ed6c9f1e","dweb:/ipfs/QmbJBNQtc7Fpk7trij4hU5tZJiVoBGidfiufa6v44TU2mS"]},"contracts/8/libraries/CommissionLib.sol":{"keccak256":"0x643bd59a29981c6681916d8e934b191cea55afd62f29b6e36fdc559c331e23fe","license":"MIT","urls":["bzz-raw://091f462610e1732997f4e1be0ac256a4ea2659d7ead92e8d1ae4f88bd2c5f5cf","dweb:/ipfs/QmYZvsLbEuq2bomSogSHVAcyefuETFzy9BFXLtRFUxhtse"]},"contracts/8/libraries/CommonLib.sol":{"keccak256":"0x1ba9c1ea51250b5de23e243d16e8a77c6931059fbab5e3fbd6cb94f2ee0cb3b4","license":"MIT","urls":["bzz-raw://3e8288d091f898fc4046bdbbbea8d7e4c2d33b76a0bea42088b145b1cc53e009","dweb:/ipfs/Qmbah9PF4S4SmE5ZsMWCQLmypqCFkLAsXHK4GN5TJjC9ws"]},"contracts/8/libraries/Constants.sol":{"keccak256":"0xa75fc32798397998145485da4fc6acd2f19d2c145e77ba5a9b111c25ec2df347","license":"MIT","urls":["bzz-raw://53168fcd9b174e70202496bf5bc282a459d6fb1e2ea9b7f26ff5546fd1a0d46c","dweb:/ipfs/QmZTcGvNcLB9nhTDXj5ehiQPJ8fvcaiKTeEy41ZeP1MnnV"]},"contracts/8/libraries/EthReceiver.sol":{"keccak256":"0x9f14897cf172b1ae722e8e6fce6c8d4a6199727b6918d530f33823e0b3331456","license":"MIT","urls":["bzz-raw://51f12d67113e4abbc62b76fdd38913bc98d4e0e0d7343ed35c9579af4d27e6cf","dweb:/ipfs/QmWewjv5mBaKSzAKZnxAnUtBpt7ERSy26xwJMat8ajE31P"]},"contracts/8/libraries/EventLib.sol":{"keccak256":"0xfaf2998524b6953f78628a0431088fcba659a4d5b5e21fa6c134f54eed421177","license":"MIT","urls":["bzz-raw://700edb01bea25dce86887bb6efc1eb86cff6874f2101366353303d3d7091c4be","dweb:/ipfs/QmSF53YdVuRJQfmxhjz4Xq6im2e9ySumqh74yEtb37hdUp"]},"contracts/8/libraries/ExtraDataLib.sol":{"keccak256":"0x2e2bf0b4149a02e0cfcdb3389c8c2a1bca09cd361a248f6cf8b1ff595fc51a83","license":"MIT","urls":["bzz-raw://a66d9df293c72eb224a997f940d60276862602047749ccf5307fdd726d9d387a","dweb:/ipfs/Qmd5unNhaPrebYjBaUZojS1GVqv5Kdmixbe7H6sogninj4"]},"contracts/8/libraries/PMMLib.sol":{"keccak256":"0xe9ca70104294965d1c6df7bf21df1b662debef55864fa9e26310ef120e123182","license":"MIT","urls":["bzz-raw://488112321a387c93ec1e2e24ef7284db5af965159145ab8f354b4d3d4575577d","dweb:/ipfs/QmatShYGr33UX6ZTK8QV8qgfZ5GZwMuNLSSnt26Mfdxv7x"]},"contracts/8/libraries/PausableModuleV2.sol":{"keccak256":"0xc1980d47b3524a45357e3c1e5deae2f5bbe89617b7e9821ad02adb86d5766164","license":"MIT","urls":["bzz-raw://eea5d9c6e2f66ee04029fb4bd11ee3e4536ff226e9ad338f77954d5cd4ada99b","dweb:/ipfs/QmPrQwT2Uqse1zTom5DgPSsTPqnsPEzDcTTYEaFNd327Pv"]},"contracts/8/libraries/RevertReasonForwarder.sol":{"keccak256":"0x12d542c0a07c83175bc927b2ecd77dd9cf9d113e1f6d242a9886920cdc84e004","license":"MIT","urls":["bzz-raw://0cda9f3b320ff838c7eaa579980203ab10d53ae56fc4b1b87e202a88a642f849","dweb:/ipfs/QmTVqFy9ADmp51CKR7wEif332Vh2FNjLZKY9KRVAtomzVT"]},"contracts/8/libraries/SafeERC20.sol":{"keccak256":"0x6fb5661c7d83a1394d05cd20d69ede4337ae8e7f68db40b4548f0656d112ed17","license":"MIT","urls":["bzz-raw://59bd76fd98e228d49f4f5172e033d4b7b0d89ca9e6bbcbea797d5da023b28124","dweb:/ipfs/QmY4Qg3U789ajRT5vyMLuuEK8x3zuPVzJoEymvtYzhLBaJ"]},"contracts/8/libraries/SafeMath.sol":{"keccak256":"0x71d16bf7d3101044d077f24e517d09d31d482830e807dc3b27c24926b0367b9f","license":"MIT","urls":["bzz-raw://292b9a002462c9402aa17b7740a41776cff5e16aa506bc3c138b1a3be39e9e39","dweb:/ipfs/QmUHUPA8k1vMYv4PG9t8BrVBngkp7HKQrG15QsYDAaVeUk"]},"contracts/8/libraries/TransferLib.sol":{"keccak256":"0x9c07c291096da3744297df10b6e2786cf37d8cd13cc5a60ea06284312df9bf79","license":"MIT","urls":["bzz-raw://729034f687391da9d2f169e59ee730ff371b125c96559761a2911d7a886c3a83","dweb:/ipfs/QmV9ZNiBHrortkp2626Tc8dwHh3f1ooFDTcNhVJSZ1C8ov"]},"contracts/8/libraries/TrimLib.sol":{"keccak256":"0x0bebfa439ba87881a4ba4aa0f79d686df2661fe694e19f1af926a814b0477cd9","license":"MIT","urls":["bzz-raw://e7e56783f89736c780e3caa9b7a6f612a61017b37af4d136a67be79b14eafa85","dweb:/ipfs/QmQyVHoLATm2L7sDz4YxodNfXvmCc7Z5gHkAqSgxQNYdms"]},"contracts/8/libraries/UniswapTokenInfoHelper.sol":{"keccak256":"0x01f1104c48d38499b6777ebf08d971e771c1ede88b2f1a6f7748f1e9ed58fecb","license":"MIT","urls":["bzz-raw://f28977162c3d06959b5bef9241ddb5d16ddc473b8a4eb5bf3fcc6185c8d9fd43","dweb:/ipfs/Qmcp1SGgFCFBhKkDMWG21HHCLqCzDmsxe5SaB4R2vV9poi"]},"contracts/8/router/DagRouter.sol":{"keccak256":"0x8530c6f0f392e650c1360662cc1c3df9ad9aab84e3d1eea0b7734218ab242cb6","license":"MIT","urls":["bzz-raw://28d49dc94b286b207c27422ac6851bda80fb52d1d576ceec4cf46e8db007c5c7","dweb:/ipfs/QmebtXDLz1pxQyfQphzjNuwokXxgxH21EQEKukcVqrgjiu"]},"contracts/8/router/SmartSwapRouter.sol":{"keccak256":"0x0e96ad6df4ee3697ee9bbb807bba00f4fb584b36acf2c5c3cd9ae643c9c2b608","license":"MIT","urls":["bzz-raw://8400278328b6e21952a94e43b701727612e7d9cd875c692b0735a704ad232fc6","dweb:/ipfs/QmRTafq87cYhK6Wqwk6gowJugQFGQTTQrq3LsZ45Vtj6B2"]},"contracts/8/router/SwapWrapRouter.sol":{"keccak256":"0x6e449e1aca977fb933a918cb0f49a69bb602be3f01055dfb2e877b6f2b99a65a","license":"MIT","urls":["bzz-raw://f14a3c364697a508c0a2c1936aa44dad4229a207688673dee66906664b6e1296","dweb:/ipfs/QmRgzev7cWwvi3fAdDPRK9ox8kYuSUMHLJtbm182VwfrVf"]},"contracts/8/router/UnxswapRouter.sol":{"keccak256":"0xa770963280bc94d5d23e5eafa4fb00c24b2fdc69a19f595201d7186f272ae3ee","license":"MIT","urls":["bzz-raw://2628c20acc77a77f07018a0b29b75a9bbbd9d283eca4b1c31714215051345842","dweb:/ipfs/Qmc3eVEfzSjRi1RVE9aGpz3EvLrFrZxbsaSDmViUoM8YWi"]},"contracts/8/router/UnxswapV3Router.sol":{"keccak256":"0x06891e81dc996f958a31283af909548540eec55942974111970ead978ae9efae","license":"MIT","urls":["bzz-raw://f4a93018bf5d04210913ede51ed570f72d2522465ee767b2b3262e91ba01b7c6","dweb:/ipfs/QmQ73bpv6BXMgZnVqfnkwDLgP24GoBEQHfMeQsTDLp4RyY"]},"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol":{"keccak256":"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1","license":"MIT","urls":["bzz-raw://41319e7f621f2dc3733511332c4fd032f8e32ad2aa7fd6f665c19741d9941a34","dweb:/ipfs/QmcYR3bd862GD1Bc7jwrU9bGxrhUu5na1oP964bDCu2id1"]}},"version":1},"storageLayout":{"types":{"t_bool":{"label":"bool","encoding":"inplace","numberOfBytes":"1"},"t_uint64":{"label":"uint64","encoding":"inplace","numberOfBytes":"8"},"t_address":{"label":"address","encoding":"inplace","numberOfBytes":"20"},"t_uint256":{"label":"uint256","encoding":"inplace","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"key":"t_address","label":"mapping(address => bool)","value":"t_bool","encoding":"mapping","numberOfBytes":"32"}},"storage":[{"slot":"0","type":"t_address","astId":2864,"label":"owner","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"0","type":"t_uint64","astId":2868,"label":"pauseUntil","offset":20,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"1","type":"t_mapping(t_address,t_bool)","astId":2873,"label":"reporters","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"2","type":"t_uint256","astId":8465,"label":"_status","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"}]},"transientStorageLayout":null,"userdoc":{"kind":"user","errors":{"NotOwner()":[{"notice":"Thrown when caller is not the owner"}],"NotPaused()":[{"notice":"Thrown when contract is not paused"}],"AlreadySet()":[{"notice":"Thrown when reporter state is already set"}],"NotReporter()":[{"notice":"Thrown when caller is not a reporter"}],"ZeroAddress()":[{"notice":"Thrown when zero address is provided"}],"AlreadyPaused()":[{"notice":"Thrown when contract is already paused"}],"AlreadyPausedByOwner()":[{"notice":"Thrown when contract is already paused by owner"}]},"events":{"OwnerPaused()":{"notice":"Emitted when contract is paused by owner"},"OwnerUnpaused()":{"notice":"Emitted when contract is unpaused by owner"},"OwnerChanged(address,address)":{"notice":"Emitted when ownership is transferred"},"ReporterUpdated(address,bool)":{"notice":"Emitted when a reporter is added or removed"},"ReporterPaused(address,uint64)":{"notice":"Emitted when contract is paused by reporter"}},"methods":{"owner()":{"notice":"Contract owner address"},"pause()":{"notice":"Pause the contract (until manually unpaused by owner)"},"unpause()":{"notice":"Unpause the contract"},"isPaused()":{"notice":"Check if the contract is currently paused"},"pauseUntil()":{"notice":"Pause state timestamp"},"pauseByReporter()":{"notice":"Pause the contract for 24 hours"},"reporters(address)":{"notice":"Mapping of reporter addresses"},"setReporter(address,bool)":{"notice":"Add or remove a reporter"},"swapWrap(uint256,uint256)":{"notice":"================================ swapWrap related ================================Executes a simple swap between ETH and WETH using encoded parameters."},"transferOwnership(address)":{"notice":"Transfer ownership to a new address"},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"================================ uniswapV3Callback ==============================callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"notice":"============================== uniswapV3Swap related ==============================Executes a swap using the Uniswap V3 protocol."},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"notice":"============================== unxswap related ==============================Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"notice":"Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"notice":"Executes a swap between ETH and WETH using structured base request parameters to a specified receiver."},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"notice":"Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"notice":"Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee."},"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"================================ dagSwap related ================================Executes a DAG swap to a specified receiver using structured base request parameters."},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"Executes a DAG swap to a specified receiver using structured base request parameters."},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"================================ smartSwap related ================================Executes a smart swap directly to a specified receiver address."},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"Executes a smart swap directly to a specified receiver address."}},"version":1},"devdoc":{"kind":"dev","errors":{"AlreadyPausedByOwner()":[{"details":"This error is thrown when owner tries to pause an already owner-paused contract"}]},"methods":{"pause()":{"details":"Only callable by the ownerSets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pauseReverts if contract is already paused by ownerOwner can override reporter pause (temporary pause) by calling this function"},"unpause()":{"details":"Only callable by the ownerResets pauseUntil to NOT_PAUSED, clearing both owner and reporter pausesReverts if contract is not pausedGas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause"},"isPaused()":{"details":"Returns true if block.timestamp < pauseUntil","returns":{"_0":"True if paused, false otherwise"}},"pauseByReporter()":{"details":"Only callable by a reporterReverts if contract is already pausedSets pauseUntil to block.timestamp + 24 hours"},"setReporter(address,bool)":{"params":{"added":"True to add, false to remove","reporter":"Reporter address to add or remove"},"details":"Only callable by the owner"},"swapWrap(uint256,uint256)":{"params":{"orderId":"Unique identifier for the swap order, facilitating tracking and reference.","rawdata":"Encoded data containing swap direction, transfer mode and amount information using bit masks."},"details":"This function supports bidirectional swaps between ETH and WETH with minimal gas overhead. The rawdata parameter encodes: - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH"},"transferOwnership(address)":{"params":{"newOwner":"New owner address"},"details":"Only callable by the current ownerEmits OwnerChanged event with previousOwner (current owner) and newOwner"},"uniswapV3SwapCallback(int256,int256,bytes)":{"details":"The first 32 bytes of data is a flag to identify which router to call"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"params":{"pools":"An array of pool identifiers used to define the swap route within Uniswap V3.","amount":"The amount of the source token to be swapped.","receiver":"The address that will receive the swap funds (encoded as uint256 with order ID mask).","minReturn":"The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage."},"returns":{"returnAmount":"The amount of tokens received after the completion of the swap."}},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"params":{"pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","amount":"The amount of the source token to be swapped.","srcToken":"The source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"params":{"pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","amount":"The amount of the source token to be swapped.","receiver":"The address where the swapped tokens will be sent.","srcToken":"The source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"params":{"orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline."},"details":"This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly. It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses."},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"params":{"pools":"An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"params":{"pools":"An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"paths":"An array of RouterPath structs defining the DAG swap route.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"paths":"An array of RouterPath structs defining the DAG swap route.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"batches":"Detailed routing information for executing the swap across different paths or protocols.","orderId":"Unique identifier for the swap order, facilitating tracking.","baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic).","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"batches":"Detailed routing information for executing the swap across different paths or protocols.","orderId":"Unique identifier for the swap order, facilitating tracking.","receiver":"Address to receive the output tokens from the swap.","baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic).","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}}},"version":1},"sourceIds":{"contracts/8/DexRouter.sol":{"id":0},"contracts/8/interfaces/IUni.sol":{"id":7},"contracts/8/interfaces/IWETH.sol":{"id":10},"contracts/8/libraries/PMMLib.sol":{"id":23},"contracts/8/router/DagRouter.sol":{"id":31},"contracts/8/interfaces/IERC20.sol":{"id":5},"contracts/8/interfaces/IUniV3.sol":{"id":8},"contracts/8/libraries/Address.sol":{"id":15},"contracts/8/libraries/TrimLib.sol":{"id":29},"contracts/8/libraries/EventLib.sol":{"id":21},"contracts/8/libraries/SafeMath.sol":{"id":27},"contracts/8/interfaces/IAdapter.sol":{"id":1},"contracts/8/libraries/CommonLib.sol":{"id":18},"contracts/8/libraries/Constants.sol":{"id":19},"contracts/8/libraries/SafeERC20.sol":{"id":26},"contracts/8/router/UnxswapRouter.sol":{"id":34},"contracts/8/interfaces/IDexRouter.sol":{"id":4},"contracts/8/libraries/ChainConfig.sol":{"id":16},"contracts/8/libraries/EthReceiver.sol":{"id":20},"contracts/8/libraries/TransferLib.sol":{"id":28},"contracts/8/router/SwapWrapRouter.sol":{"id":33},"contracts/8/libraries/ExtraDataLib.sol":{"id":22},"contracts/8/router/SmartSwapRouter.sol":{"id":32},"contracts/8/router/UnxswapV3Router.sol":{"id":35},"contracts/8/interfaces/IERC20Permit.sol":{"id":6},"contracts/8/libraries/CommissionLib.sol":{"id":17},"contracts/8/interfaces/IApproveProxy.sol":{"id":2},"contracts/8/interfaces/IDaiLikePermit.sol":{"id":3},"contracts/8/interfaces/permit2/IEIP712.sol":{"id":12},"contracts/8/libraries/PausableModuleV2.sol":{"id":24},"contracts/8/interfaces/permit2/IPermit2.sol":{"id":13},"contracts/8/libraries/RevertReasonForwarder.sol":{"id":25},"contracts/8/libraries/UniswapTokenInfoHelper.sol":{"id":30},"contracts/8/interfaces/IUniswapV3SwapCallback.sol":{"id":9},"contracts/8/interfaces/permit2/IAllowanceTransfer.sol":{"id":11},"contracts/8/interfaces/permit2/ISignatureTransfer.sol":{"id":14},"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol":{"id":36}},"additionalInput":null,"stdJsonInput":{"sources":{"contracts/8/DexRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"./libraries/EthReceiver.sol\";\nimport \"./libraries/PMMLib.sol\";\nimport \"./libraries/PausableModuleV2.sol\";\nimport \"./libraries/ExtraDataLib.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\nimport \"./interfaces/IDexRouter.sol\";\nimport \"./interfaces/IUniswapV3SwapCallback.sol\";\n\nimport \"./router/SmartSwapRouter.sol\";\nimport \"./router/DagRouter.sol\";\nimport \"./router/UnxswapRouter.sol\";\nimport \"./router/UnxswapV3Router.sol\";\nimport \"./router/SwapWrapRouter.sol\";\n\ncontract DexRouter is EthReceiver, IDexRouter, IUniswapV3SwapCallback, PausableModuleV2, ReentrancyGuard {\n\n    string public constant version = \"v1.0.10-rfq-anti-arbitrage\";\n\n    constructor(address _owner) PausableModuleV2(_owner) ReentrancyGuard() {}\n\n    /// ================================ smartSwap related ================================\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param pmmRequests PMM swap requests (currently used only for calldata length calculation, not for swap logic).\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function smartSwapByOrderId(\n        uint256 orderId,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        RouterPath[][] calldata batches,\n        PMMLib.PMMSwapRequest[] calldata pmmRequests\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, baseRequest, batchesAmount, batches, pmmRequests).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SmartSwapRouter.smartSwapTo(orderId, msg.sender, baseRequest, batchesAmount, batches, extraData);\n    }\n\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param receiver Address to receive the output tokens from the swap.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param pmmRequests PMM swap requests (currently used only for calldata length calculation, not for swap logic).\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function smartSwapTo(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        RouterPath[][] calldata batches,\n        PMMLib.PMMSwapRequest[] calldata pmmRequests\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, batchesAmount, batches, pmmRequests).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SmartSwapRouter.smartSwapTo(orderId, receiver, baseRequest, batchesAmount, batches, extraData);\n    }\n\n    /// ================================ dagSwap related ================================\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function dagSwapByOrderId(\n        uint256 orderId,\n        BaseRequest calldata baseRequest,\n        RouterPath[] calldata paths\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(orderId, baseRequest, paths).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return DagRouter.dagSwapTo(orderId, msg.sender, baseRequest, paths, extraData);\n    }\n\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function dagSwapTo(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        RouterPath[] calldata paths\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, paths).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return DagRouter.dagSwapTo(orderId, receiver, baseRequest, paths, extraData);\n    }\n\n    /// ============================== uniswapV3Swap related ==============================\n    /// @notice Executes a swap using the Uniswap V3 protocol.\n    /// @param receiver The address that will receive the swap funds (encoded as uint256 with order ID mask).\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.\n    /// @param pools An array of pool identifiers used to define the swap route within Uniswap V3.\n    /// @return returnAmount The amount of tokens received after the completion of the swap.\n    function uniswapV3SwapTo(\n        uint256 receiver,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(receiver, amount, minReturn, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapV3Router.uniswapV3SwapTo(receiver, amount, minReturn, pools, extraData);\n    }\n\n    /// @notice Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function uniswapV3SwapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        uint256[] calldata pools\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapV3Router.uniswapV3SwapToWithBaseRequest(orderId, receiver, baseRequest, pools, extraData);\n    }\n\n    /// ============================== unxswap related ==============================\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapByOrderId(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        bytes32[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(srcToken, amount, minReturn, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapTo(srcToken, amount, minReturn, msg.sender, pools, extraData);\n    }\n\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param receiver The address where the swapped tokens will be sent.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapTo(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        address receiver,\n        bytes32[] calldata pools\n    ) external payable nonReentrant whenNotPaused returns (uint256 returnAmount) {\n        uint256 swapDataLength = 4 + abi.encode(srcToken, amount, minReturn, receiver, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapTo(srcToken, amount, minReturn, receiver, pools, extraData);\n    }\n\n    /// @notice Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    function unxswapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest,\n        bytes32[] calldata pools\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n        returns (uint256 returnAmount)\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest, pools).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return UnxswapRouter.unxswapToWithBaseRequest(orderId, receiver, baseRequest, pools, extraData);\n    }\n\n    /// ================================ swapWrap related ================================\n    /// @notice Executes a simple swap between ETH and WETH using encoded parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param rawdata Encoded data containing swap direction, transfer mode and amount information using bit masks.\n    /// @dev This function supports bidirectional swaps between ETH and WETH with minimal gas overhead.\n    /// The rawdata parameter encodes:\n    /// - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH\n    function swapWrap(uint256 orderId, uint256 rawdata) external payable nonReentrant whenNotPaused {\n        uint256 swapDataLength = 4 + abi.encode(orderId, rawdata).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SwapWrapRouter.swapWrap(orderId, rawdata, extraData);\n    }\n\n    /// @notice Executes a swap between ETH and WETH using structured base request parameters to a specified receiver.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.\n    /// @dev This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly.\n    /// It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.\n    function swapWrapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        BaseRequest calldata baseRequest\n    )\n        external\n        payable\n        nonReentrant\n        whenNotPaused\n    {\n        uint256 swapDataLength = 4 + abi.encode(orderId, receiver, baseRequest).length;\n        IDexRouter.ExtraData memory extraData = ExtraDataLib.getDecodedExtraData(swapDataLength);\n        return SwapWrapRouter.swapWrapToWithBaseRequest(orderId, receiver, baseRequest, extraData);\n    }\n\n    /// ================================ uniswapV3Callback ==============================\n    /// @notice callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter\n    /// @dev The first 32 bytes of data is a flag to identify which router to call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external whenNotPaused override {\n        require(data.length >= 32, \"Invalid callback data\");\n        bytes32 flag = bytes32(data[:32]);\n        if (flag == V3_EXACT_IN_CALLBACK_FLAG) {\n            UnxswapV3Router.uniswapV3SwapCallback(amount0Delta, amount1Delta, data);\n        } else {\n            revert(\"Unknown V3 callback flag\");\n        }\n    }\n}\n"},"contracts/8/interfaces/IUni.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IUni {\n    function swapExactTokensForTokens(\n        uint256 amountIn,\n        uint256 amountOutMin,\n        address[] calldata path,\n        address to,\n        uint256 deadline\n    ) external returns (uint256[] memory amounts);\n\n    function swap(\n        uint256 amount0Out,\n        uint256 amount1Out,\n        address to,\n        bytes calldata data\n    ) external;\n\n    function getReserves()\n        external\n        view\n        returns (\n            uint112 reserve0,\n            uint112 reserve1,\n            uint32 blockTimestampLast\n        );\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    function sync() external;\n}\n"},"contracts/8/interfaces/IWETH.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IWETH {\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address account) external view returns (uint256);\n\n    function transfer(address recipient, uint256 amount)\n        external\n        returns (bool);\n\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256);\n\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    function transferFrom(\n        address src,\n        address dst,\n        uint256 wad\n    ) external returns (bool);\n\n    function deposit() external payable;\n\n    function withdraw(uint256 wad) external;\n}\n"},"contracts/8/libraries/PMMLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary PMMLib {\n\n  // ============ Struct ============\n  struct PMMSwapRequest {\n      uint256 pathIndex;\n      address payer;\n      address fromToken;\n      address toToken;\n      uint256 fromTokenAmountMax;\n      uint256 toTokenAmountMax;\n      uint256 salt;\n      uint256 deadLine;\n      bool isPushOrder;\n      bytes extension;\n      // address marketMaker;\n      // uint256 subIndex;\n      // bytes signature;\n      // uint256 source;  1byte type + 1byte bool（reverse） + 0...0 + 20 bytes address\n  }\n\n  struct PMMBaseRequest {\n    uint256 fromTokenAmount;\n    uint256 minReturnAmount;\n    uint256 deadLine;\n    bool fromNative;\n    bool toNative;\n  }\n\n  enum PMM_ERROR {\n      NO_ERROR,\n      INVALID_OPERATOR,\n      QUOTE_EXPIRED,\n      ORDER_CANCELLED_OR_FINALIZED,\n      REMAINING_AMOUNT_NOT_ENOUGH,\n      INVALID_AMOUNT_REQUEST,\n      FROM_TOKEN_PAYER_ERROR,\n      TO_TOKEN_PAYER_ERROR,\n      WRONG_FROM_TOKEN\n  }\n\n  event PMMSwap(\n    uint256 pathIndex,\n    uint256 subIndex,\n    uint256 errorCode\n  );\n\n  error PMMErrorCode(uint256 errorCode);\n\n}"},"contracts/8/router/DagRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary DagRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a DAG swap to a specified receiver using structured base request parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param paths An array of RouterPath structs defining the DAG swap route.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    function dagSwapTo(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest memory baseRequest,\n        IDexRouter.RouterPath[] calldata paths,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        require(paths.length > 0 && paths[0].assetTo.length > 0, \"paths must be > 0\");\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        receiver = receiver == address(0) ? msg.sender : receiver;\n\n        uint256 mode = paths[0].fromToken & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST || mode == _MODE_NO_TRANSFER,\n            \"invalid transfer mode\"\n        );\n        \n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, fromToken, baseRequest.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(baseRequest.toToken, receiver);\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) ? extraData.refundTo : msg.sender,\n            receiver: receiver,\n            toToken: baseRequest.toToken\n        });\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalFromTokenAmount = baseRequest.fromTokenAmount;\n\n        uint256 fromTokenCommissionAmount;\n        {\n            address onlyOneAssetTo = paths[0].assetTo.length == 1 ? paths[0].assetTo[0] : address(0); // Output edge of node0 is only one\n            (\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                fromTokenCommissionAmount\n            ) = TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(fromToken)) | mode,\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                onlyOneAssetTo,\n                extraData\n            );\n        }\n\n        {\n            uint256 balanceBefore;\n            (\n                swapCache.receiver,\n                balanceBefore\n            ) = CommissionLib.doCommissionFromToken(\n                    extraData.commissionInfo,\n                    swapCache,\n                    fromTokenCommissionAmount,\n                    extraData.trimInfo.hasTrim\n                );\n\n            _dagSwapInternal(\n                baseRequest,\n                paths,\n                swapCache\n            );\n\n            CommissionLib.doCommissionAndTrimToToken(\n                extraData.commissionInfo,\n                receiver,\n                balanceBefore,\n                baseRequest.toToken,\n                extraData.trimInfo\n            );\n        }\n\n        // check minReturnAmount\n        returnAmount =\n            CommonLib.getBalanceOf(baseRequest.toToken, receiver) -\n            returnAmount;\n        require(\n            returnAmount >= baseRequest.minReturnAmount,\n            \"Min return not reached\"\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (fromToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(fromToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        EventLib.emitOrderRecord(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken),\n            baseRequest.toToken,\n            tx.origin,\n            originalFromTokenAmount,\n            returnAmount\n        );\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice The fromTokenAmount will not must be greater than 0, cause for some protocols the fromTokenAmount needs to be 0 to skip token transfer like fourmeme. \n    function _dagSwapInternal(\n        IDexRouter.BaseRequest memory baseRequest,\n        IDexRouter.RouterPath[] calldata paths,\n        IDexRouter.SwapCache memory swapCache\n    ) private {\n        // 1. check and process ETH\n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n\n        address firstNodeToken = CommonLib.bytes32ToAddress(paths[0].fromToken);\n\n        // In order to deal with ETH/WETH transfer rules in a unified manner,\n        // we do not need to judge according to fromToken.\n        if (fromToken == _ETH) {\n            IWETH(_WETH).deposit{\n                value: baseRequest.fromTokenAmount\n            }();\n            require(firstNodeToken == _WETH, \"firstToken mismatch\");\n            require(swapCache.payer == address(this), \"payer must be router\");\n        } else {\n            require(firstNodeToken == fromToken, \"firstToken mismatch\");\n            require(msg.value == 0, \"value must be 0\");\n        }\n\n        // 2. execute dag swap\n        _exeDagSwap(swapCache, baseRequest.fromTokenAmount, baseRequest.toToken == _ETH, paths);\n\n        // 3. transfer tokens to receiver\n        TransferLib.transferTokenToUser(baseRequest.toToken, swapCache.receiver);\n    }\n\n    /// @notice The core logic to execute the DAG swap. For the first node, the payer should use passed value.\n    /// For the non-first node, the payer should always be address(this) cause the to address of the middle swap is address(this).\n    function _exeDagSwap(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 firstNodeBalance,\n        bool isToNative,\n        IDexRouter.RouterPath[] calldata paths\n    ) private {\n        uint256 nodeNum = paths.length;\n\n        // execute nodes\n        for (uint256 i = 0; i < nodeNum;) {\n            if (i != 0) { // reset payer for non-first node\n                swapCache.payer = address(this);\n            }\n\n            _exeNode(swapCache, firstNodeBalance, i, isToNative, paths[i], nodeNum);\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @notice The core logic to execute the each node\n    function _exeNode(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 nodeBalance,\n        uint256 nodeIndex,\n        bool isToNative,\n        IDexRouter.RouterPath calldata path,\n        uint256 nodeNum\n    ) private {\n        uint256 totalWeight;\n        uint256 accAmount;\n        address fromToken = CommonLib.bytes32ToAddress(path.fromToken);\n\n        require(\n            path.mixAdapters.length == path.rawData.length &&\n            path.mixAdapters.length == path.extraData.length &&\n            path.mixAdapters.length == path.assetTo.length,\n            \"path length mismatch\"\n        );\n\n        // to get the nodeBalance for non-first node, the balance of the first node is the original passed value\n        if (nodeIndex != 0) {\n            nodeBalance = CommonLib.getBalanceOf(fromToken, address(this));\n            require(nodeBalance > 0, \"node balance must be > 0\");\n        }\n\n        // execute edges\n        for (uint256 i = 0; i < path.mixAdapters.length;) {\n            uint256 inputIndex;\n            uint256 outputIndex;\n            uint256 weight;\n\n            // 1. get inputIndex, outputIndex, weight and verify\n            {\n                bytes32 rawData = bytes32(path.rawData[i]);\n                assembly {\n                    weight := shr(160, and(rawData, _WEIGHT_MASK))\n                    inputIndex := shr(184, and(rawData, _INPUT_INDEX_MASK))\n                    outputIndex := shr(176, and(rawData, _OUTPUT_INDEX_MASK))\n                }\n\n                require(inputIndex == nodeIndex, \"node inputIndex inconsistent\");\n                require(inputIndex < outputIndex && outputIndex <= nodeNum, \"node index out of range\");\n\n                totalWeight += weight;\n                if (i == path.mixAdapters.length - 1) {\n                    require(\n                        totalWeight == 10_000,\n                        \"totalWeight must be 10000\"\n                    );\n                }\n            }\n\n            // 2. transfer fromToken from payer to assetTo of edge\n            {\n                uint256 _fromTokenAmount;\n                if (i == path.mixAdapters.length - 1) {\n                    _fromTokenAmount = nodeBalance - accAmount;\n                } else {\n                    _fromTokenAmount = (nodeBalance * weight) / 10_000;\n                    accAmount += _fromTokenAmount;\n                }\n                if (_fromTokenAmount > 0) {\n                    TransferLib.transferInternal(\n                        swapCache.payer,\n                        path.assetTo[i],\n                        path.fromToken,\n                        _fromTokenAmount\n                    );\n                }\n            }\n\n            // 3. execute single swap\n            {\n                address to = address(this);\n                if (outputIndex == nodeNum && !isToNative) {\n                    to = swapCache.receiver;\n                }\n                address refundTo_ = swapCache.refundTo; // avoid stack too deep\n                _exeEdge(\n                    path.rawData[i],\n                    path.mixAdapters[i],\n                    path.extraData[i],\n                    to,\n                    refundTo_\n                );\n            }\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    function _exeEdge(\n        uint256 rawData,\n        address mixAdapter,\n        bytes memory extraData,\n        address to,\n        address refundTo\n    ) private {\n        bool reverse;\n        address poolAddress;\n        assembly {\n            poolAddress := and(rawData, _ADDRESS_MASK)\n            reverse := and(rawData, _REVERSE_MASK)\n        }\n\n        CommonLib.exeAdapter(\n            reverse,\n            mixAdapter,\n            to,\n            poolAddress,\n            extraData,\n            refundTo\n        );\n    }\n}"},"contracts/8/interfaces/IERC20.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC20 {\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 value\n    );\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    function name() external view returns (string memory);\n\n    function symbol() external view returns (string memory);\n\n    function decimals() external view returns (uint8);\n\n    function totalSupply() external view returns (uint256);\n\n    function balanceOf(address owner) external view returns (uint256);\n\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256);\n\n    function approve(address spender, uint256 value) external returns (bool);\n\n    function transfer(address to, uint256 value) external returns (bool);\n\n    function transferFrom(\n        address from,\n        address to,\n        uint256 value\n    ) external returns (bool);\n}\n"},"contracts/8/interfaces/IUniV3.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IUniV3 {\n    function swap(\n        address recipient,\n        bool zeroForOne,\n        int256 amountSpecified,\n        uint160 sqrtPriceLimitX96,\n        bytes calldata data\n    ) external returns (int256 amount0, int256 amount1);\n\n    function slot0()\n        external\n        view\n        returns (\n            uint160 sqrtPriceX96,\n            int24 tick,\n            uint16 observationIndex,\n            uint16 observationCardinality,\n            uint16 observationCardinalityNext,\n            uint8 feeProtocol,\n            bool unlocked\n        );\n\n    function token0() external view returns (address);\n\n    function token1() external view returns (address);\n\n    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6\n    /// @return The fee\n    function fee() external view returns (uint24);\n}\n"},"contracts/8/libraries/Address.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts\n        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned\n        // for accounts without code, i.e. `keccak256('')`\n        bytes32 codehash;\n        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            codehash := extcodehash(account)\n        }\n        return (codehash != accountHash && codehash != 0x0);\n    }\n\n    /**\n     * @dev Converts an `address` into `address payable`. Note that this is\n     * simply a type cast: the actual underlying value is not changed.\n     *\n     * _Available since v2.4.0._\n     */\n    function toPayable(address account)\n        internal\n        pure\n        returns (address payable)\n    {\n        return payable(account);\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     *\n     * _Available since v2.4.0._\n     */\n    function sendValue(address recipient, uint256 amount) internal {\n        require(\n            address(this).balance >= amount,\n            \"Address: insufficient balance\"\n        );\n\n        // solhint-disable-next-line avoid-call-value\n        (bool success, ) = recipient.call{value: amount, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n        require(\n            success,\n            \"Address: unable to send value, recipient may have reverted\"\n        );\n    }\n}\n"},"contracts/8/libraries/TrimLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\n\nlibrary TrimLib {\n    function validateTrimInfo(IDexRouter.TrimInfo memory trimInfo) internal pure {\n        if (!trimInfo.hasTrim) return;\n\n        // Validate trimRate and chargeRate\n        require(trimInfo.trimRate <= TRIM_RATE_LIMIT, \"error trim rate\");\n        require(trimInfo.chargeRate <= TRIM_DENOMINATOR_1E3, \"error charge rate\");\n\n        // Validate trim/charge recipient addresses to prevent accidental burns.\n        if (trimInfo.chargeRate < TRIM_DENOMINATOR_1E3) { // Not all trim is charged, so trimAddress should not be zero\n            require(trimInfo.trimAddress != address(0), \"Invalid trimAddress\");\n        }\n        if (trimInfo.chargeRate > 0) {\n            require(trimInfo.chargeAddress != address(0), \"Invalid chargeAddress\");\n        }\n    }\n}"},"contracts/8/libraries/EventLib.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../interfaces/IDexRouter.sol\";\n\n/// @title EventLib\n/// @notice The single source of truth for all DexRouter event definitions in this repository.\n/// @dev This library centralizes DexRouter events to ensure consistency across all contracts and libraries.\n///      Other contracts/router should use the emit functions provided here instead of defining events locally.\nlibrary EventLib {\n    /// ==============================================================\n    /// ========================= Events =============================\n    /// ==============================================================\n    event OrderRecord(\n        address fromToken,\n        address toToken,\n        address sender,\n        uint256 fromAmount,\n        uint256 returnAmount\n    );\n\n    event SwapOrderId(uint256 id);\n\n    event CommissionAndTrimInfo(\n        uint256 toBCommission, // 0 for no encoded commission data, 1 for no-toB commission, 2 for toB commission\n        uint256 toBTrim, // 0 for no encoded trim data, 1 for no-toB trim, 2 for toB trim\n        uint256 trimRate,\n        uint256 chargeRate\n    );\n\n    // @notice CommissionFromTokenRecord is emitted in assembly, commentted out for contract size saving\n    // event CommissionFromTokenRecord(\n    //     address fromTokenAddress,\n    //     uint256 commissionAmount,\n    //     address referrerAddress,\n    //     uint256 commissionRate\n    // );\n\n    // @notice CommissionToTokenRecord is emitted in assembly, commentted out for contract size saving\n    // event CommissionToTokenRecord(\n    //     address toTokenAddress,\n    //     uint256 commissionAmount,\n    //     address referrerAddress,\n    //     uint256 commissionRate\n    // );\n\n    // @notice PositiveSlippageTrimRecord is emitted in assembly, commentted out for contract size saving\n    // event PositiveSlippageTrimRecord(\n    //     address toTokenAddress,\n    //     uint256 trimAmount,\n    //     address trimAddress\n    // );\n\n    // @notice PositiveSlippageChargeRecord is emitted in assembly, commentted out for contract size saving\n    // event PositiveSlippageChargeRecord(\n    //     address toTokenAddress,\n    //     uint256 chargeAmount,\n    //     address chargeAddress\n    // );\n\n    /// ==============================================================\n    /// ====================== Emit Functions ========================\n    /// ==============================================================\n    function emitOrderRecord(\n        address fromToken,\n        address toToken,\n        address sender,\n        uint256 fromAmount,\n        uint256 returnAmount\n    ) internal {\n        emit OrderRecord(fromToken, toToken, sender, fromAmount, returnAmount);\n    }\n\n    function emitSwapOrderId(uint256 id) internal {\n        emit SwapOrderId(id);\n    }\n\n    function emitCommissionAndTrimInfoIfNeeded(IDexRouter.ExtraData memory extraData) internal {\n        if (extraData.commissionInfo.isFromTokenCommission || extraData.commissionInfo.isToTokenCommission || extraData.trimInfo.hasTrim) {\n            emit CommissionAndTrimInfo(\n                extraData.commissionInfo.toBCommission,\n                extraData.trimInfo.toBTrim,\n                extraData.trimInfo.trimRate,\n                extraData.trimInfo.chargeRate\n            );\n        }\n    }\n}"},"contracts/8/libraries/SafeMath.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary SafeMath {\n    uint256 constant WAD = 10**18;\n    uint256 constant RAY = 10**27;\n\n    function wad() public pure returns (uint256) {\n        return WAD;\n    }\n\n    function ray() public pure returns (uint256) {\n        return RAY;\n    }\n\n    function add(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 c = a + b;\n        require(c >= a, \"SafeMath: addition overflow\");\n\n        return c;\n    }\n\n    function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n        return sub(a, b, \"SafeMath: subtraction overflow\");\n    }\n\n    function sub(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b <= a, errorMessage);\n        uint256 c = a - b;\n\n        return c;\n    }\n\n    function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n        // benefit is lost if 'b' is also tested.\n        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n        if (a == 0) {\n            return 0;\n        }\n\n        uint256 c = a * b;\n        require(c / a == b, \"SafeMath: multiplication overflow\");\n\n        return c;\n    }\n\n    function div(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(a, b, \"SafeMath: division by zero\");\n    }\n\n    function div(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        // Solidity only automatically asserts when dividing by 0\n        require(b > 0, errorMessage);\n        uint256 c = a / b;\n        // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n\n        return c;\n    }\n\n    function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mod(a, b, \"SafeMath: modulo by zero\");\n    }\n\n    function mod(\n        uint256 a,\n        uint256 b,\n        string memory errorMessage\n    ) internal pure returns (uint256) {\n        require(b != 0, errorMessage);\n        return a % b;\n    }\n\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a <= b ? a : b;\n    }\n\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a >= b ? a : b;\n    }\n\n    function sqrt(uint256 a) internal pure returns (uint256 b) {\n        if (a > 3) {\n            b = a;\n            uint256 x = a / 2 + 1;\n            while (x < b) {\n                b = x;\n                x = (a / x + x) / 2;\n            }\n        } else if (a != 0) {\n            b = 1;\n        }\n    }\n\n    function wmul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mul(a, b) / WAD;\n    }\n\n    function wmulRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, b), WAD / 2) / WAD;\n    }\n\n    function rmul(uint256 a, uint256 b) internal pure returns (uint256) {\n        return mul(a, b) / RAY;\n    }\n\n    function rmulRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, b), RAY / 2) / RAY;\n    }\n\n    function wdiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(mul(a, WAD), b);\n    }\n\n    function wdivRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, WAD), b / 2) / b;\n    }\n\n    function rdiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        return div(mul(a, RAY), b);\n    }\n\n    function rdivRound(uint256 a, uint256 b) internal pure returns (uint256) {\n        return add(mul(a, RAY), b / 2) / b;\n    }\n\n    function wpow(uint256 x, uint256 n) internal pure returns (uint256) {\n        uint256 result = WAD;\n        while (n > 0) {\n            if (n % 2 != 0) {\n                result = wmul(result, x);\n            }\n            x = wmul(x, x);\n            n /= 2;\n        }\n        return result;\n    }\n\n    function rpow(uint256 x, uint256 n) internal pure returns (uint256) {\n        uint256 result = RAY;\n        while (n > 0) {\n            if (n % 2 != 0) {\n                result = rmul(result, x);\n            }\n            x = rmul(x, x);\n            n /= 2;\n        }\n        return result;\n    }\n\n    function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {\n        uint256 quotient = div(a, b);\n        uint256 remainder = a - quotient * b;\n        if (remainder > 0) {\n            return quotient + 1;\n        } else {\n            return quotient;\n        }\n    }\n}\n"},"contracts/8/interfaces/IAdapter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\npragma abicoder v2;\n\ninterface IAdapter {\n    function sellBase(\n        address to,\n        address pool,\n        bytes memory data\n    ) external;\n\n    function sellQuote(\n        address to,\n        address pool,\n        bytes memory data\n    ) external;\n}\n"},"contracts/8/libraries/CommonLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./SafeERC20.sol\";\nimport \"../interfaces/IAdapter.sol\";\nimport \"../interfaces/IApproveProxy.sol\";\n\nlibrary CommonLib {\n\n    function getBalanceOf(\n        address token,\n        address user\n    ) internal view returns (uint256 amount) {\n        assembly {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            switch eq(token, _ETH)\n            case 1 {\n                amount := balance(user)\n            }\n            default {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x24))\n                mstore(\n                    freePtr,\n                    0x70a0823100000000000000000000000000000000000000000000000000000000\n                ) //balanceOf\n                mstore(add(freePtr, 0x04), user)\n                let success := staticcall(gas(), token, freePtr, 0x24, 0, 0x20)\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x00000015206765742062616c616e63654f66206661696c656400000000000000,\n                        0x59\n                    ) // \"get balanceOf failed\"\n                }\n                amount := mload(0x00)\n            }\n        }\n    }\n\n    function validateDeadline(uint256 deadLine) internal view {\n        require(deadLine >= block.timestamp, \"Route: expired\");\n    }\n\n    /// @dev Appends dexRouterCaller at -64 and refundTo at -32.\n    function exeAdapter(\n        bool reverse,\n        address adapter,\n        address to,\n        address poolAddress,\n        bytes memory moreinfo,\n        address refundTo\n    ) internal {\n        if (reverse) {\n            (bool s, bytes memory res) = address(adapter).call(\n                abi.encodePacked(\n                    abi.encodeWithSelector(\n                        IAdapter.sellQuote.selector,\n                        to,\n                        poolAddress,\n                        moreinfo\n                    ),\n                    DEX_ROUTER_CALLER_MARKER + uint(uint160(msg.sender)),\n                    ORIGIN_PAYER + uint(uint160(refundTo))\n                )\n            );\n            if (!s) {\n                _revert(res);\n            }\n        } else {\n            (bool s, bytes memory res) = address(adapter).call(\n                abi.encodePacked(\n                    abi.encodeWithSelector(\n                        IAdapter.sellBase.selector,\n                        to,\n                        poolAddress,\n                        moreinfo\n                    ),\n                    DEX_ROUTER_CALLER_MARKER + uint(uint160(msg.sender)),\n                    ORIGIN_PAYER + uint(uint160(refundTo))\n                )\n            );\n            if (!s) {\n                _revert(res);\n            }\n        }\n    }\n\n    /// @notice Converts a uint256 value into an address.\n    /// @param param The uint256 value to be converted.\n    /// @return result The address obtained from the conversion.\n    /// @dev This function is used to extract an address from a uint256,\n    /// typically used when dealing with low-level data operations or when addresses are packed into larger data types.\n    function bytes32ToAddress(\n        uint256 param\n    ) internal pure returns (address result) {\n        assembly {\n            result := and(param, _ADDRESS_MASK)\n        }\n    }\n\n    // ================================ Private Functions ================================\n    /**\n     * @dev Reverts with returndata if present. Otherwise reverts with \"FailedCall\".\n     * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/c64a1edb67b6e3f4a15cca8909c9482ad33a02b0/contracts/utils/Address.sol#L135-L149\n     */\n    function _revert(bytes memory returndata) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            assembly (\"memory-safe\") {\n                revert(add(returndata, 0x20), mload(returndata))\n            }\n        } else {\n            revert(\"adaptor call failed\");\n        }\n    }\n}\n"},"contracts/8/libraries/Constants.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// Per-chain constants are generated into ChainConfig.sol (gitignored) and\n// re-exported transitively to every importer of Constants.sol.\nimport \"./ChainConfig.sol\";\n\n// =============================================================================\n// ============================ ETH Address Constants ==========================\n// =============================================================================\naddress constant _ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n// =============================================================================\n// ======================= Universal Masks And Flags ===========================\n// =============================================================================\nuint256 constant _ADDRESS_MASK =\n    0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;\nuint256 constant _REVERSE_MASK =\n    0x8000000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _ORDER_ID_MASK =\n    0xffffffffffffffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _WEIGHT_MASK =\n    0x00000000000000000000ffff0000000000000000000000000000000000000000;\nuint256 constant _CALL_GAS_LIMIT = 5000;\nuint256 constant ORIGIN_PAYER =\n    0x3ca20afc2ccc0000000000000000000000000000000000000000000000000000;\n// Marker for the DexRouter caller tail word appended before ORIGIN_PAYER.\nuint256 constant DEX_ROUTER_CALLER_MARKER =\n    0x3ca20afc2ddd0000000000000000000000000000000000000000000000000000;\n// Exact-match mask for marker validation.\nuint256 constant MARKER_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant SWAP_AMOUNT =\n    0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\nuint256 constant _WETH_MASK =\n    0x4000000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _ONE_FOR_ZERO_MASK = 1 << 255; // Mask for identifying if the swap is one-for-zero\nuint256 constant _WETH_UNWRAP_MASK = 1 << 253; // Mask for identifying if WETH should be unwrapped to ETH\n\n// =============================================================================\n// ===================== Transfer Mode Masks and Flags =========================\n// =============================================================================\nuint256 constant _MODE_LEGACY =\n    0x0000000000000000000000000000000000000000000000000000000000000000; // 0b000 in [bit251, bit250, bit249]\nuint256 constant _MODE_PERMIT2_ALLOWANCE =\n    0x0200000000000000000000000000000000000000000000000000000000000000; // 0b001 in [bit251, bit250, bit249]\nuint256 constant _MODE_PERMIT2_SIGNATURE =\n    0x0600000000000000000000000000000000000000000000000000000000000000; // 0b011 in [bit251, bit250, bit249]\nuint256 constant _MODE_BY_INVEST =\n    0x0400000000000000000000000000000000000000000000000000000000000000; // 0b010 in [bit251, bit250, bit249]\nuint256 constant _MODE_NO_TRANSFER =\n    0x0800000000000000000000000000000000000000000000000000000000000000; // 0b100 in [bit251, bit250, bit249]\nuint256 constant _MODE_DIRECT =\n    0x0A00000000000000000000000000000000000000000000000000000000000000; // 0b101 in [bit251, bit250, bit249]\nuint256 constant _TRANSFER_MODE_MASK =\n    0x0E00000000000000000000000000000000000000000000000000000000000000; // 0b111 in [bit251, bit250, bit249]\n\n// =============================================================================\n// ============================== DAG Swap Masks ===============================\n// =============================================================================\nuint256 constant _INPUT_INDEX_MASK =\n    0x0000000000000000ff0000000000000000000000000000000000000000000000;\nuint256 constant _OUTPUT_INDEX_MASK =\n    0x000000000000000000ff00000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ======================= Commission Masks and Flags ==========================\n// =============================================================================\nuint256 constant _COMMISSION_RATE_MASK =\n    0x000000000000ffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _COMMISSION_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION =\n    0x3ca20afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION =\n    0x3ca20afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION_DUAL =\n    0x22220afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION_DUAL =\n    0x22220afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant FROM_TOKEN_COMMISSION_MULTIPLE =\n    0x88880afc2aaa0000000000000000000000000000000000000000000000000000;\nuint256 constant TO_TOKEN_COMMISSION_MULTIPLE =\n    0x88880afc2bbb0000000000000000000000000000000000000000000000000000;\nuint256 constant _COMMISSION_LENGTH_MASK =\n    0x00ff000000000000000000000000000000000000000000000000000000000000;\nuint256 constant _TO_B_COMMISSION_MASK =\n    0x8000000000000000000000000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ============================= Trim Masks and Flags ==========================\n// =============================================================================\nuint256 constant _TRIM_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK =\n    0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;\nuint256 constant _TRIM_RATE_MASK =\n    0x000000000000ffffffffffff0000000000000000000000000000000000000000;\nuint256 constant _TO_B_TRIM_MASK =\n    0x0000000000008000000000000000000000000000000000000000000000000000;\nuint256 constant TRIM_FLAG =\n    0x7777777711110000000000000000000000000000000000000000000000000000;\nuint256 constant TRIM_DUAL_FLAG =\n    0x7777777722220000000000000000000000000000000000000000000000000000;\n\n// =============================================================================\n// ======================== Permit2 Info Masks and Flags =======================\n// =============================================================================\nuint256 constant _PERMIT2_INFO_FLAG_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant _PERMIT2_INFO_AMOUNT_LENGTH_MASK =\n    0x000000000000ff00000000000000000000000000000000000000000000000000;\nuint256 constant _PERMIT2_INFO_NONCE_MASK =\n    0x0000000000000000000000000000000000000000000000000000ffffffffffff;\nuint256 constant _PERMIT2_INFO_DEADLINE_MASK =\n    0x0000000000000000000000000000000000000000ffffffffffff000000000000;\nuint256 constant _PERMIT2_INFO_SIGNATURE_V_MASK =\n    0x00000000000000000000000000000000000000ff000000000000000000000000;\nuint256 constant PERMIT2_INFO_SIG65_FLAG =\n    0x92527fff1a650000000000000000000000000000000000000000000000000000; // bytes5(keccak256(\"Permit2Info\")) + 0x65\nuint256 constant PERMIT2_INFO_SIG64_FLAG =\n    0x92527fff1a640000000000000000000000000000000000000000000000000000; // bytes5(keccak256(\"Permit2Info\")) + 0x64\n\n// =============================================================================\n// ============================= RefundTo Masks and Flags ======================\n// =============================================================================\nuint256 constant _REFUND_TO_MASK =\n    0xffffffffffff0000000000000000000000000000000000000000000000000000;\nuint256 constant REFUND_TO_ADDRESS_FLAG =\n    0xac3a7da8b1c60000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"RefundTo\"))\n\n// =============================================================================\n// ==================== UniswapV3 Callback Flags ===============================\n// =============================================================================\nbytes32 constant V3_EXACT_IN_CALLBACK_FLAG = 0x97d5390607e40000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"V3ExactInCallback\"))\nbytes32 constant V3_EXACT_OUT_CALLBACK_FLAG = 0xae25331d0e6e0000000000000000000000000000000000000000000000000000; // bytes6(keccak256(\"V3ExactOutCallback\"))\n\n// =============================================================================\n// ============================= Universal Values ==============================\n// =============================================================================\nuint256 constant MIN_COMMISSION_MULTIPLE_NUM = 3; // min referrer num for multiple commission\nuint256 constant MAX_COMMISSION_MULTIPLE_NUM = 8; // max referrer num for multiple commission\nuint256 constant COMMISSION_RATE_LIMIT = 30000000; // 3%\nuint256 constant COMMISSION_DENOMINATOR_1E9 = 10 ** 9;\nuint256 constant NO_TO_B_MODE = 1; // value for no-toB commission and no-toB trim when related encoded calldata exists\nuint256 constant TO_B_MODE = 2; // value for toB commission and toB trim when related encoded calldata exists\nuint256 constant WAD = 10 ** 18;\nuint256 constant TRIM_RATE_LIMIT = 100;\nuint256 constant TRIM_DENOMINATOR_1E3 = 1000;\n// =============================================================================\n// ==================== Network-Specific Constants =============================\n// =============================================================================\n// NATIVE_TOKEN_TRANSFER_GAS_LIMIT, _WETH, _APPROVE_PROXY, _PERMIT2 and _FF_FACTORY\n// are per-chain values. They live in ChainConfig.sol (generated per deploy by\n// scripts/deploy/gen-chainconfig.js, gitignored) and are re-exported via the import above.\n"},"contracts/8/libraries/SafeERC20.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./SafeMath.sol\";\nimport \"./Address.sol\";\nimport \"./RevertReasonForwarder.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IERC20Permit.sol\";\nimport \"../interfaces/IDaiLikePermit.sol\";\n\n// File @1inch/solidity-utils/contracts/libraries/SafeERC20.sol@v2.1.1\n\nlibrary SafeERC20 {\n    error SafeTransferFailed();\n    error SafeTransferFromFailed();\n    error ForceApproveFailed();\n    error SafeIncreaseAllowanceFailed();\n    error SafeDecreaseAllowanceFailed();\n    error SafePermitBadLength();\n\n    // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract\n    function safeTransferFrom(IERC20 token, address from, address to, uint256 amount) internal {\n        bytes4 selector = token.transferFrom.selector;\n        bool success;\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            mstore(add(data, 0x04), from)\n            mstore(add(data, 0x24), to)\n            mstore(add(data, 0x44), amount)\n            success := call(gas(), token, 0, data, 100, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n        if (!success) revert SafeTransferFromFailed();\n    }\n\n    // Ensures method do not revert or return boolean `true`, admits call to non-smart-contract\n    function safeTransfer(IERC20 token, address to, uint256 value) internal {\n        if (!_makeCall(token, token.transfer.selector, to, value)) {\n            revert SafeTransferFailed();\n        }\n    }\n\n    function safeApprove(IERC20 token, address spender, uint256 value) internal {\n        forceApprove(token, spender, value);\n    }\n\n    // If `approve(from, to, amount)` fails, try to `approve(from, to, 0)` before retry\n    function forceApprove(IERC20 token, address spender, uint256 value) internal {\n        if (!_makeCall(token, token.approve.selector, spender, value)) {\n            if (!_makeCall(token, token.approve.selector, spender, 0) ||\n                !_makeCall(token, token.approve.selector, spender, value))\n            {\n                revert ForceApproveFailed();\n            }\n        }\n    }\n\n    \n\n    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 allowance = token.allowance(address(this), spender);\n        if (value > type(uint256).max - allowance) revert SafeIncreaseAllowanceFailed();\n        forceApprove(token, spender, allowance + value);\n    }\n\n    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n        uint256 allowance = token.allowance(address(this), spender);\n        if (value > allowance) revert SafeDecreaseAllowanceFailed();\n        forceApprove(token, spender, allowance - value);\n    }\n\n    function safePermit(IERC20 token, bytes calldata permit) internal {\n        bool success;\n        if (permit.length == 32 * 7) {\n            success = _makeCalldataCall(token, IERC20Permit.permit.selector, permit);\n        } else if (permit.length == 32 * 8) {\n            success = _makeCalldataCall(token, IDaiLikePermit.permit.selector, permit);\n        } else {\n            revert SafePermitBadLength();\n        }\n        if (!success) RevertReasonForwarder.reRevert();\n    }\n\n    function _makeCall(IERC20 token, bytes4 selector, address to, uint256 amount) private returns(bool success) {\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            mstore(add(data, 0x04), to)\n            mstore(add(data, 0x24), amount)\n            success := call(gas(), token, 0, data, 0x44, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n    }\n\n    function _makeCalldataCall(IERC20 token, bytes4 selector, bytes calldata args) private returns(bool success) {\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let len := add(4, args.length)\n            let data := mload(0x40)\n\n            mstore(data, selector)\n            calldatacopy(add(data, 0x04), args.offset, args.length)\n            success := call(gas(), token, 0, data, len, 0x0, 0x20)\n            if success {\n                switch returndatasize()\n                case 0 { success := gt(extcodesize(token), 0) }\n                default { success := and(gt(returndatasize(), 31), eq(mload(0), 1)) }\n            }\n        }\n    }\n}\n\n\n"},"contracts/8/router/UnxswapRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/UniswapTokenInfoHelper.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/ExtraDataLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\n\nlibrary UnxswapRouter {\n    uint256 private constant _IS_TOKEN0_TAX =\n        0x1000000000000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _IS_TOKEN1_TAX =\n        0x2000000000000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _CLAIM_TOKENS_CALL_SELECTOR_32 =\n        0x0a5ea46600000000000000000000000000000000000000000000000000000000;\n    uint256 private constant _TRANSFER_DEPOSIT_SELECTOR =\n        0xa9059cbbd0e30db0000000000000000000000000000000000000000000000000;\n    uint256 private constant _SWAP_GETRESERVES_SELECTOR =\n        0x022c0d9f0902f1ac000000000000000000000000000000000000000000000000;\n    uint256 private constant _BALANCEOF_TOKEN0_SELECTOR =\n        0x70a082310dfe1681000000000000000000000000000000000000000000000000;\n    uint256 private constant _BALANCEOF_TOKEN1_SELECTOR =\n        0x70a08231d21220a7000000000000000000000000000000000000000000000000;\n    uint256 private constant _WITHDRAW_SELECTOR =\n        0x2e1a7d4d00000000000000000000000000000000000000000000000000000000;\n\n    uint256 private constant _NUMERATOR_MASK =\n        0x0000000000000000ffffffff0000000000000000000000000000000000000000;\n\n    uint256 private constant _DENOMINATOR = 1_000_000_000;\n    uint256 private constant _NUMERATOR_OFFSET = 160;\n\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.\n    ///         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param srcToken The source token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\n    /// @param receiver The address where the swapped tokens will be sent.\n    /// @param pools An array of pool identifiers to specify the swap route, optimizing for best rates.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function facilitates direct swaps using Unxswap, allowing users to specify custom swap routes and ensuring that the output is sent to a predetermined address.\n    ///      It is designed for scenarios where the user wants to directly receive the tokens in their wallet or another contract.\n    function unxswapTo(\n        uint256 srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        address receiver,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) public returns (uint256 returnAmount) {\n        EventLib.emitSwapOrderId((srcToken & _ORDER_ID_MASK) >> 160);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        // validate token info\n        (address fromToken, address toToken) = UniswapTokenInfoHelper.getUnxswapTokenInfo(msg.value > 0, pools);\n        address srcTokenAddr = CommonLib.bytes32ToAddress(srcToken);\n        require(\n            (srcTokenAddr == fromToken) || (srcTokenAddr == address(0) && fromToken == _ETH),\n            \"unxswap: token mismatch\"\n        );\n        \n        return\n            _unxswapTo(\n                fromToken,\n                toToken,\n                amount,\n                minReturn,\n                msg.sender,\n                receiver,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    /// It supports both ETH and ERC20 token swaps, with automatic WETH wrapping/unwrapping as needed.\n    /// The function verifies that toToken matches the expected output token from the last pool in the route.\n    function unxswapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address fromToken, address toToken) = UniswapTokenInfoHelper.getUnxswapTokenInfo(msg.value > 0, pools);\n\n        // validate fromToken and toToken from baseRequest\n        address fromTokenAddr = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        require((fromTokenAddr == fromToken) || (fromTokenAddr == address(0) && fromToken == _ETH), \"unxswap: fromToken mismatch\");\n        require((baseRequest.toToken == toToken) || (baseRequest.toToken == address(0) && toToken == _ETH), \"unxswap: toToken mismatch\");\n\n        return\n            _unxswapTo(\n                fromToken,\n                toToken,\n                baseRequest.fromTokenAmount,\n                baseRequest.minReturnAmount,\n                msg.sender,\n                receiver,\n                pools,\n                extraData\n            );\n    }\n\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If srcToken is ETH, srcToken needs to be 0xEeee for commission validation and _unxswapInternal.\n    function _unxswapTo(\n        address srcToken,\n        address toToken,\n        uint256 amount,\n        uint256 minReturn,\n        address payer,\n        address receiver,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) internal returns (uint256 returnAmount) {\n        receiver = receiver == address(0) ? msg.sender : receiver;\n\n        uint256 mode = uint256(pools[0]) & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST,\n            \"invalid transfer mode\"\n        );\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, srcToken, toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(toToken, receiver);\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: payer,\n            refundTo: (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) ? extraData.refundTo : msg.sender,\n            receiver: receiver,\n            toToken: toToken\n        });\n        \n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalAmount = amount;\n\n        // Handle Permit2Signature mode and fromToken commission\n        uint256 fromTokenCommissionAmount;\n        (swapCache.payer, amount, fromTokenCommissionAmount) =\n            TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(srcToken)) | mode,\n                swapCache.payer,\n                amount,\n                CommonLib.bytes32ToAddress(uint256(pools[0])), // onlyOneAssetTo\n                extraData\n            );\n        \n        _doUnxswap(\n            swapCache,\n            srcToken,\n            amount,\n            pools,\n            extraData,\n            fromTokenCommissionAmount\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (srcToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(srcToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        // check minReturnAmount\n        returnAmount = CommonLib.getBalanceOf(toToken, receiver) - returnAmount;\n        require(\n            returnAmount >= minReturn,\n            \"Min return not reached\"\n        );\n\n        EventLib.emitOrderRecord(\n            srcToken,\n            toToken,\n            tx.origin,\n            originalAmount,\n            returnAmount\n        );\n\n        return returnAmount;\n    }\n\n    function _doUnxswap(\n        IDexRouter.SwapCache memory swapCache,\n        address srcToken,\n        uint256 amount,\n        bytes32[] calldata pools,\n        IDexRouter.ExtraData memory extraData,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                extraData.trimInfo.hasTrim\n            );\n\n        _unxswapInternal(\n            IERC20(srcToken),\n            amount,\n            pools,\n            swapCache.payer,\n            middleReceiver\n        );\n\n        CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            swapCache.receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n    }\n\n    /// @notice Performs the internal logic for executing a swap using the Unxswap protocol.\n    /// @param srcToken The token to be swapped.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param pools The array of pool identifiers that define the swap route.\n    /// @param payer The address of the entity providing the source tokens for the swap.\n    /// @param receiver The address that will receive the tokens after the swap.\n    /// @return returnAmount The amount of tokens received from the swap.\n    /// @dev This internal function encapsulates the core logic of the Unxswap token swap process. It is meant to be called by other external functions that set up the required parameters. The actual interaction with the Unxswap pools and the token transfer mechanics are implemented here.\n    function _unxswapInternal(\n        IERC20 srcToken,\n        uint256 amount,\n        bytes32[] calldata pools,\n        address payer,\n        address receiver\n    ) private returns (uint256 returnAmount) {\n        assembly {\n            function revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _getTokenAddr(emptyPtr, pair, selector) -> token {\n                mstore(emptyPtr, selector)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x0000001067657420746f6b656e206661696c6564000000000000000000000000,\n                        0x54\n                    ) // \"get token failed\"\n                }\n                token := mload(0x00)\n            }\n            function _getBalanceOfToken0(emptyPtr, pair) -> token0, balance0 {\n                mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x00000012746f6b656e302063616c6c206661696c656400000000000000000000,\n                        0x56\n                    ) // \"token0 call failed\"\n                }\n                token0 := mload(0x00)\n                mstore(add(0x04, emptyPtr), pair)\n                if iszero(\n                    staticcall(gas(), token0, emptyPtr, 0x24, 0x00, 0x20)\n                ) {\n                    revertWithReason(\n                        0x0000001562616c616e63654f662063616c6c206661696c656400000000000000,\n                        0x59\n                    ) // \"balanceOf call failed\"\n                }\n                balance0 := mload(0x00)\n            }\n            function _getBalanceOfToken1(emptyPtr, pair) -> token1, balance1 {\n                mstore(emptyPtr, _BALANCEOF_TOKEN1_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x04,\n                        0x00,\n                        0x20\n                    )\n                ) {\n                    revertWithReason(\n                        0x00000012746f6b656e312063616c6c206661696c656400000000000000000000,\n                        0x56\n                    ) // \"token1 call failed\"\n                }\n                token1 := mload(0x00)\n                mstore(add(0x04, emptyPtr), pair)\n                if iszero(\n                    staticcall(gas(), token1, emptyPtr, 0x24, 0x00, 0x20)\n                ) {\n                    revertWithReason(\n                        0x0000001562616c616e63654f662063616c6c206661696c656400000000000000,\n                        0x59\n                    ) // \"balanceOf call failed\"\n                }\n                balance1 := mload(0x00)\n            }\n\n            function swap(\n                emptyPtr,\n                swapAmount,\n                pair,\n                reversed,\n                isToken0Tax,\n                isToken1Tax,\n                numerator,\n                dst\n            ) -> ret {\n                mstore(emptyPtr, _SWAP_GETRESERVES_SELECTOR)\n                if iszero(\n                    staticcall(\n                        gas(),\n                        pair,\n                        add(0x04, emptyPtr),\n                        0x4,\n                        0x00,\n                        0x40\n                    )\n                ) {\n                    // we only need the first 0x40 bytes, no need timestamp info\n                    revertWithReason(\n                        0x0000001472657365727665732063616c6c206661696c65640000000000000000,\n                        0x58\n                    ) // \"reserves call failed\"\n                }\n                let reserve0 := mload(0x00)\n                let reserve1 := mload(0x20)\n\n                switch reversed\n                case 0 {\n                    //swap token0 for token1\n                    if isToken0Tax {\n                        let token0, balance0 := _getBalanceOfToken0(\n                            emptyPtr,\n                            pair\n                        )\n                        swapAmount := sub(balance0, reserve0)\n                    }\n                }\n                default {\n                    //swap token1 for token0\n                    if isToken1Tax {\n                        let token1, balance1 := _getBalanceOfToken1(\n                            emptyPtr,\n                            pair\n                        )\n                        swapAmount := sub(balance1, reserve1)\n                    }\n                    let temp := reserve0\n                    reserve0 := reserve1\n                    reserve1 := temp\n                }\n\n                ret := mul(swapAmount, numerator)\n                ret := div(\n                    mul(ret, reserve1),\n                    add(ret, mul(reserve0, _DENOMINATOR))\n                )\n                mstore(emptyPtr, _SWAP_GETRESERVES_SELECTOR)\n                switch reversed\n                case 0 {\n                    mstore(add(emptyPtr, 0x04), 0)\n                    mstore(add(emptyPtr, 0x24), ret)\n                }\n                default {\n                    mstore(add(emptyPtr, 0x04), ret)\n                    mstore(add(emptyPtr, 0x24), 0)\n                }\n                mstore(add(emptyPtr, 0x44), dst)\n                mstore(add(emptyPtr, 0x64), 0x80)\n                mstore(add(emptyPtr, 0x84), 0)\n                if iszero(call(gas(), pair, 0, emptyPtr, 0xa4, 0, 0)) {\n                    revertWithReason(\n                        0x00000010737761702063616c6c206661696c6564000000000000000000000000,\n                        0x54\n                    ) // \"swap call failed\"\n                }\n            }\n\n            // ========== Transfer Helper Functions ==========\n            function _sendToken(token, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x44))\n                mstore(\n                    freePtr,\n                    0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                ) // transfer\n                mstore(add(freePtr, 0x04), to)\n                mstore(add(freePtr, 0x24), amt)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x44,\n                    0,\n                    0x20\n                )\n                if and(\n                    iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                    success\n                ) {\n                    success := iszero(\n                        or(iszero(extcodesize(token)), returndatasize())\n                    )\n                }\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001c207472616e7366657220746f6b656e2072656665726572206661696c,\n                        0x60\n                    ) // \"transfer token referer fail\"\n                }\n            }\n            function _claimToken(token, _payer, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    _CLAIM_TOKENS_CALL_SELECTOR_32\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amt)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            function _transferTokenDirect(token, from, to, amt) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amt)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n            function _transferTokenPermit2Allowance(token, from, to, amt) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amt) {\n                    revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amt)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n            function _transferTokenWithMode(token, _payer, rawPair, amt) {\n                if gt(amt, 0) {\n                    let mode := and(rawPair, _TRANSFER_MODE_MASK)\n\n                    // _payer has been set to address(this), means the token has been transferred to address(this).\n                    if eq(_payer, address()) {\n                        _sendToken(token, and(rawPair, _ADDRESS_MASK), amt)\n                    }\n                    // _payer != address(this) && _payer != address(0), means the token has not been transferred yet.\n                    if iszero(or(eq(_payer, address()), eq(_payer, 0))) {\n                        switch mode\n                        case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                            _transferTokenDirect(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                            _transferTokenPermit2Allowance(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                            _claimToken(token, _payer, and(rawPair, _ADDRESS_MASK), amt)\n                        }\n                        default {\n                            revertWithReason(\n                                0x00000015696e76616c6964207472616e73666572206d6f646500000000000000,\n                                0x59\n                            ) // \"invalid transfer mode\"\n                        }\n                    }\n                }\n            }\n            // ========== End Transfer Helper Functions ==========\n\n            let poolsOffset\n            let poolsEndOffset\n            {\n                let len := pools.length\n                poolsOffset := pools.offset //\n                poolsEndOffset := add(poolsOffset, mul(len, 32))\n\n                if eq(len, 0) {\n                    revertWithReason(\n                        0x000000b656d70747920706f6f6c73000000000000000000000000000000000000,\n                        0x4e\n                    ) // \"empty pools\"\n                }\n            }\n            let emptyPtr := mload(0x40)\n            let rawPair := calldataload(poolsOffset)\n            \n            switch eq(_ETH, srcToken)\n            case 1 {\n                // ========== ETH Transfer ==========\n                // require callvalue() >= amount, lt: if x < y return 1，else return 0\n                if eq(lt(callvalue(), amount), 1) {\n                    revertWithReason(\n                        0x00000011696e76616c6964206d73672e76616c75650000000000000000000000,\n                        0x55\n                    ) // \"invalid msg.value\"\n                }\n\n                mstore(emptyPtr, _TRANSFER_DEPOSIT_SELECTOR)\n                if iszero(\n                    call(gas(), _WETH, amount, add(emptyPtr, 0x04), 0x4, 0, 0)\n                ) {\n                    revertWithReason(\n                        0x000000126465706f73697420455448206661696c656400000000000000000000,\n                        0x56\n                    ) // \"deposit ETH failed\"\n                }\n                mstore(add(0x04, emptyPtr), and(rawPair, _ADDRESS_MASK))\n                mstore(add(0x24, emptyPtr), amount)\n                if iszero(call(gas(), _WETH, 0, emptyPtr, 0x44, 0, 0x20)) {\n                    revertWithReason(\n                        0x000000147472616e736665722057455448206661696c65640000000000000000,\n                        0x58\n                    ) // \"transfer WETH failed\"\n                }\n            }\n            default {\n                // ========== ERC20 Transfer ==========\n                if callvalue() {\n                    revertWithReason(\n                        0x00000011696e76616c6964206d73672e76616c75650000000000000000000000,\n                        0x55\n                    ) // \"invalid msg.value\"\n                }\n\n                // For PERMIT2_SIGNATURE mode: token already transferred via permitTransferFrom, no need to transfer\n                // Other modes: transfer token to the address specified in the rawPair\n                _transferTokenWithMode(srcToken, payer, rawPair, amount)\n            }\n\n            returnAmount := amount\n\n            for {\n                let i := add(poolsOffset, 0x20)\n            } lt(i, poolsEndOffset) {\n                i := add(i, 0x20)\n            } {\n                let nextRawPair := calldataload(i)\n\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    and(nextRawPair, _ADDRESS_MASK)\n                )\n\n                rawPair := nextRawPair\n            }\n            let toToken\n            switch and(rawPair, _WETH_MASK)\n            case 0 {\n                let beforeAmount\n                switch and(rawPair, _REVERSE_MASK)\n                case 0 {\n                    if and(rawPair, _IS_TOKEN1_TAX) {\n                        mstore(emptyPtr, _BALANCEOF_TOKEN1_SELECTOR)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                and(rawPair, _ADDRESS_MASK),\n                                add(0x04, emptyPtr),\n                                0x04,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000012746f6b656e312063616c6c206661696c656400000000000000000000,\n                                0x56\n                            ) // \"token1 call failed\"\n                        }\n                        toToken := mload(0)\n                        mstore(add(0x04, emptyPtr), receiver)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                toToken,\n                                emptyPtr,\n                                0x24,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000015746f6b656e312062616c616e6365206661696c656400000000000000,\n                                0x59\n                            ) // \"token1 balance failed\"\n                        }\n                        beforeAmount := mload(0)\n                    }\n                }\n                default {\n                    if and(rawPair, _IS_TOKEN0_TAX) {\n                        mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                and(rawPair, _ADDRESS_MASK),\n                                add(0x04, emptyPtr),\n                                0x04,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000012746f6b656e302063616c6c206661696c656400000000000000000000,\n                                0x56\n                            ) // \"token0 call failed\"\n                        }\n                        toToken := mload(0)\n                        mstore(add(0x04, emptyPtr), receiver)\n                        if iszero(\n                            staticcall(\n                                gas(),\n                                toToken,\n                                emptyPtr,\n                                0x24,\n                                0x00,\n                                0x20\n                            )\n                        ) {\n                            revertWithReason(\n                                0x00000015746f6b656e302062616c616e6365206661696c656400000000000000,\n                                0x56\n                            ) // \"token0 balance failed\"\n                        }\n                        beforeAmount := mload(0)\n                    }\n                }\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    receiver\n                )\n                if gt(toToken, 0x0) {\n                    mstore(emptyPtr, _BALANCEOF_TOKEN0_SELECTOR)\n                    mstore(add(0x04, emptyPtr), receiver)\n                    if iszero(\n                        staticcall(gas(), toToken, emptyPtr, 0x24, 0x00, 0x20)\n                    ) {\n                        revertWithReason(\n                            0x000000146765742062616c616e63654f66206661696c65640000000000000000,\n                            0x58\n                        ) // \"get balanceOf failed\"\n                    }\n                    returnAmount := sub(mload(0), beforeAmount)\n                }\n            }\n            default {\n                toToken := _ETH\n                returnAmount := swap(\n                    emptyPtr,\n                    returnAmount,\n                    and(rawPair, _ADDRESS_MASK),\n                    and(rawPair, _REVERSE_MASK),\n                    and(rawPair, _IS_TOKEN0_TAX),\n                    and(rawPair, _IS_TOKEN1_TAX),\n                    shr(_NUMERATOR_OFFSET, and(rawPair, _NUMERATOR_MASK)),\n                    address()\n                )\n\n                // Directly call WETH.withdraw(returnAmount) instead of using WNativeRelayer\n                mstore(emptyPtr, _WITHDRAW_SELECTOR)\n                mstore(add(emptyPtr, 0x04), returnAmount)\n                if iszero(\n                    call(gas(), _WETH, 0, emptyPtr, 0x24, 0, 0)\n                ) {\n                    revertWithReason(\n                        0x00000013574554482077697468647261772066616c6c6564000000000000000000,\n                        0x57\n                    ) // \"WETH withdraw failed\"\n                }\n                \n                // Send ETH to receiver, skip when receiver is this contract.\n                if iszero(eq(receiver, address())) {\n                    if iszero(call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, receiver, returnAmount, 0, 0, 0, 0)) {\n                        revertWithReason(\n                            0x000000137472616e7366657220455448206661696c6564000000000000000000,\n                            0x57\n                        ) // \"transfer ETH failed\"\n                    }\n                }\n            }\n\n        }\n    }\n}"},"contracts/8/interfaces/IDexRouter.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IDexRouter {\n    /// =============================================================\n    /// ======================= Structs =============================\n    /// =============================================================\n    struct BaseRequest {\n        uint256 fromToken;\n        address toToken;\n        uint256 fromTokenAmount;\n        uint256 minReturnAmount;\n        uint256 deadLine;\n    }\n\n    struct RouterPath {\n        address[] mixAdapters;\n        address[] assetTo;\n        uint256[] rawData;\n        bytes[] extraData;\n        uint256 fromToken;\n    }\n\n    struct CommissionInfo {\n        bool isFromTokenCommission; //0x00\n        bool isToTokenCommission; //0x20\n        uint256 tokenWithMode; // 0x40, if isToTokenCommission, tokenWithMode is only the token address, otherwise tokenWithMode is the token address with mode encoded in high bits\n        uint256 toBCommission; // 0x60, 0 for no encoded commission data, 1 for no-toB commission, 2 for toB commission\n        uint256 commissionLength; // 0x80\n        uint256 commissionRate; // 0xa0\n        address referrerAddress; // 0xc0\n        uint256 commissionRate2; // 0xe0\n        address referrerAddress2; // 0x100\n        uint256 commissionRate3; // 0x120\n        address referrerAddress3; // 0x140\n        uint256 commissionRate4; // 0x160\n        address referrerAddress4; // 0x180\n        uint256 commissionRate5; // 0x1a0\n        address referrerAddress5; // 0x1c0\n        uint256 commissionRate6; // 0x1e0\n        address referrerAddress6; // 0x200\n        uint256 commissionRate7; // 0x220\n        address referrerAddress7; // 0x240\n        uint256 commissionRate8; // 0x260\n        address referrerAddress8; // 0x280\n    }\n\n    struct TrimInfo {\n        bool hasTrim; // 0x00\n        uint256 trimRate; // 0x20\n        address trimAddress; // 0x40\n        uint256 toBTrim; // 0x60, 0 for no encoded trim data, 1 for no-toB trim, 2 for toB trim\n        uint256 expectAmountOut; // 0x80\n        uint256 chargeRate; // 0xa0\n        address chargeAddress; // 0xc0\n    }\n\n    struct Permit2Info {\n        address owner; // 0x00\n        uint256 nonce; // 0x20\n        uint256 deadline; // 0x40\n        bytes signature; // 0x60\n        uint256[] amounts; // 0x80\n    }\n\n    struct ExtraData {\n        CommissionInfo commissionInfo;\n        TrimInfo trimInfo;\n        Permit2Info permit2Info;\n        address refundTo;\n    }\n\n    struct SwapCache {\n        address payer;\n        address refundTo;\n        address receiver;\n        address toToken;\n    }\n\n    struct AfterSwapParams {\n        CommissionInfo commissionInfo;\n        uint256 consumeAmount;\n        uint256 targetTokenBefore;\n        address srcToken;\n        address toToken;\n        address receiver;\n        address payer;\n        uint256 mode;\n        uint256 fromTokenCommissionAmount;\n    }\n\n    struct ExactOutSwapCache {\n        uint256 amountOut;\n        uint256 maxConsume;\n        address payer;\n    }\n}"},"contracts/8/libraries/ChainConfig.sol":{"content":"/// SPDX-License-Identifier: MIT\n// AUTO-GENERATED — DO NOT EDIT BY HAND. This file is gitignored.\n// Per-chain constants for the current deploy target. Regenerated per deploy by\n// scripts/deploy/gen-chainconfig.js, or seeded with defaults by scripts/deploy/ensure-chainconfig.js.\npragma solidity ^0.8.0;\n\n// Target chain this config was generated for. DeployDexRouter.s.sol asserts\n// block.chainid == _EXPECTED_CHAIN_ID to prevent deploying with the wrong chain's config.\nuint256 constant _EXPECTED_CHAIN_ID = 1;\n\nuint256 constant NATIVE_TOKEN_TRANSFER_GAS_LIMIT = 100000;\naddress constant _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;\naddress constant _APPROVE_PROXY = 0x70cBb871E8f30Fc8Ce23609E9E0Ea87B6b222F58;\naddress constant _PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;\n// Uniswap V3 CREATE2 prefix: 0xff ++ factory(20 bytes) ++ 11-byte zero padding.\nbytes32 constant _FF_FACTORY = 0xff1F98431c8aD98523631AE4a59f267346ea31F9840000000000000000000000;\n// DexRouter owner (constructor arg in DeployDexRouter.s.sol). Per-chain, REQUIRED in\n// deployed/<chain>/base.js owner (no default). NOT baked into any value/routing path.\naddress constant _OWNER = 0xAcE2B3E7c752d5deBca72210141d464371b3B9b1;\n"},"contracts/8/libraries/EthReceiver.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Base contract with common payable logics\nabstract contract EthReceiver {\n  receive() external payable {\n    // solhint-disable-next-line avoid-tx-origin\n    require(msg.sender != tx.origin, \"ETH deposit rejected\");\n  }\n}\n"},"contracts/8/libraries/TransferLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"./SafeERC20.sol\";\nimport \"./CommissionLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IWETH.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/permit2/IPermit2.sol\";\nimport \"../interfaces/permit2/ISignatureTransfer.sol\";\nimport \"../interfaces/IApproveProxy.sol\";\n\n/// @title Library to handle multi transfer modes including Permit2.\nlibrary TransferLib {\n    /// @notice Handle Permit2Signature mode and fromTokenCommission mainly.\n    /// @param fromTokenWithMode The fromToken with mode encoded in high bits.\n    /// @param payer The address of the payer.\n    /// @param inputAmount The inputAmount of the fromToken.\n    /// @param onlyOneAssetTo The address of the only one assetTo. If the assetTo is more than one, it should be set to address(0).\n    /// @param extraData The extra data, only commissionInfo and permit2Info are used.\n    /// @return The new payer, new inputAmount, and fromTokenCommissionAmount. The new payer can be (1) original payer, (2) address(this), or (3) address(0).\n    ///         The address(0) means the fromToken has been paid and no need to pay later.\n    /// @dev  Since the permitTransferFrom can only be called once in a transaction, this function is designed to handle multiple scenarios and call permitTransferFrom if necessary.\n    function handlePermit2SigModeWithCommission(\n        uint256 fromTokenWithMode,\n        address payer,\n        uint256 inputAmount,\n        address onlyOneAssetTo,\n        IDexRouter.ExtraData memory extraData\n    ) internal returns (address, uint256, uint256) {\n        uint256 mode = fromTokenWithMode & _TRANSFER_MODE_MASK;\n        address token = CommonLib.bytes32ToAddress(fromTokenWithMode);\n        uint256 totalRate = 0;\n        uint256 fromTokenCommissionAmount = 0;\n\n        // For _MODE_BY_INVEST mode, the inputAmount is already the token balance according to agreement, and fromToken can not be ETH, commission is not allowed.\n        if (mode == _MODE_BY_INVEST) {\n            require(token != _ETH, \"Invalid source token\");\n            return (address(this), inputAmount, 0);\n        }\n\n        if (extraData.commissionInfo.isFromTokenCommission) {\n            totalRate = CommissionLib.calculateTotalRate(extraData.commissionInfo);\n            fromTokenCommissionAmount = inputAmount * totalRate / (COMMISSION_DENOMINATOR_1E9 - totalRate);\n        }\n\n        if (token == _ETH) {\n            require(mode == _MODE_LEGACY, \"ETH as fromToken is not allowed for non-legacy mode\");\n            return (address(this), inputAmount, fromTokenCommissionAmount);\n        }\n\n        // For other modes (not _MODE_PERMIT2_SIGNATURE), return the original payer, inputAmount, and calculated fromTokenCommissionAmount.\n        if (mode != _MODE_PERMIT2_SIGNATURE) {\n            return (payer, inputAmount, fromTokenCommissionAmount);\n        }\n\n        require(inputAmount + fromTokenCommissionAmount <= type(uint160).max, \"amount too large\");\n\n        // For _MODE_PERMIT2_SIGNATURE mode, the owner is constrained to router's msg.sender for now, but it still need to be encoded in the permit2Info calldata for future compatibility.\n        // But we use payer instead of msg.sender here, because all passed in payer is router's msg.sender and for UnxswapV3ExactOutRouter the msg.sender got here is not router's msg.sender but pool address.\n        require(extraData.permit2Info.owner == payer, \"permit2Info owner mismatch\");\n\n        // For _MODE_PERMIT2_SIGNATURE mode, token needs to be claimed to address `to` by calling permitTransferFrom. And the address `to` needs to be set according to the situation.\n        // For following 2 situations, the address `to` should be set to address(this):\n        // 1. onlyOneAssetTo=address(0): means the swap method needs the swapToken to be claimed to address(this).\n        // 2. isFromTokenCommission=true && toBCommission=TO_B_MODE: means the fromToken needs to be claimed to address(this) and then transfer commission to referrers.\n        // And when isFromTokenCommission=true && toBCommission=NO_TO_B_MODE, the commission needs to be transferred to referrers immediately.\n        address to;\n        uint256 toBCommission = extraData.commissionInfo.toBCommission;\n        // Get the address `to` according to the situation.\n        if (onlyOneAssetTo == address(0) || (extraData.commissionInfo.isFromTokenCommission && toBCommission == TO_B_MODE)) {\n            to = address(this);\n        } else {\n            to = onlyOneAssetTo;\n        }\n\n        _executePermitTransferFrom(\n            inputAmount,\n            fromTokenCommissionAmount,\n            token,\n            to,\n            totalRate,\n            extraData\n        );\n\n        if (to == address(this)) {\n            // Get balance of token because the token has been claimed to address(this).\n            uint256 balance = CommonLib.getBalanceOf(token, address(this));\n\n            // Calculate the inputAmount and fromTokenCommissionAmount according to the mode.\n            if (extraData.commissionInfo.isFromTokenCommission && toBCommission == TO_B_MODE) { // For Permit2Signature mode && ToB mode, the inputAmount and fromTokenCommissionAmount need to be calculated.\n                inputAmount = inputAmount * balance / (inputAmount + fromTokenCommissionAmount);\n                fromTokenCommissionAmount = balance - inputAmount;\n                return (address(this), inputAmount, fromTokenCommissionAmount); \n            } else { // For other situations (NoToB mode or no fromTokenCommission), the new inputAmount is the balance.\n                return (address(this), balance, fromTokenCommissionAmount);\n            }\n        } else {\n            return (address(0), inputAmount, fromTokenCommissionAmount);\n        }\n    }\n\n    /// @notice Private function to execute permitTransferFrom.\n    function _executePermitTransferFrom(\n        uint256 inputAmount,\n        uint256 fromTokenCommissionAmount,\n        address token,\n        address to,\n        uint256 totalRate,\n        IDexRouter.ExtraData memory extraData\n    ) private {\n        IDexRouter.CommissionInfo memory commissionInfo = extraData.commissionInfo;\n        // Get permitTransferFrom parameters\n        uint256 permitLength;\n        if (commissionInfo.isFromTokenCommission && commissionInfo.toBCommission == NO_TO_B_MODE) {\n            permitLength = commissionInfo.commissionLength + 1;\n        } else {\n            permitLength = 1;\n        }\n        require(permitLength == extraData.permit2Info.amounts.length, \"permit2Info amount length mismatch\");\n\n        // Execute permitTransferFrom\n        ISignatureTransfer.PermitBatchTransferFrom memory permitBatchTransferFrom = ISignatureTransfer.PermitBatchTransferFrom({\n            permitted: new ISignatureTransfer.TokenPermissions[](permitLength),\n            nonce: extraData.permit2Info.nonce,\n            deadline: extraData.permit2Info.deadline\n        });\n        ISignatureTransfer.SignatureTransferDetails[] memory transferDetails = new ISignatureTransfer.SignatureTransferDetails[](permitLength);\n        if (permitLength == 1) { // Generate permit params with permit2 array length = 1\n            permitBatchTransferFrom.permitted[0] = ISignatureTransfer.TokenPermissions({\n                token: token,\n                amount: extraData.permit2Info.amounts[0]\n            });\n            transferDetails[0] = ISignatureTransfer.SignatureTransferDetails({\n                to: to,\n                requestedAmount: inputAmount + fromTokenCommissionAmount\n            });\n        } else { // Generate permit params with permit2 array length > 1 (fromTokenCommission with NoToB mode)\n            for (uint256 i = 0; i < permitLength; ++i) {\n                permitBatchTransferFrom.permitted[i] = ISignatureTransfer.TokenPermissions({\n                    token: token,\n                    amount: extraData.permit2Info.amounts[i]\n                });\n            }\n            // transferDetails[0] is swap part, and the rest are commission parts.\n            transferDetails[0] = ISignatureTransfer.SignatureTransferDetails({\n                to: to,\n                requestedAmount: inputAmount\n            });\n            uint256 accumulatedAmount = 0;\n            for (uint256 i = 0; i < permitLength - 1; ++i) {\n                uint256 commissionRate;\n                address referrerAddress;\n                assembly (\"memory-safe\") {\n                    referrerAddress := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    commissionRate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                }\n                uint256 commissionAmount;\n                if (i == permitLength - 2) {\n                    commissionAmount = fromTokenCommissionAmount - accumulatedAmount;\n                } else {\n                    commissionAmount = fromTokenCommissionAmount * commissionRate / totalRate;\n                    accumulatedAmount += commissionAmount;\n                }\n                transferDetails[i + 1] = ISignatureTransfer.SignatureTransferDetails({\n                    to: referrerAddress,\n                    requestedAmount: commissionAmount\n                });\n            }\n        }\n\n        IPermit2(_PERMIT2).permitTransferFrom(permitBatchTransferFrom, transferDetails, extraData.permit2Info.owner, extraData.permit2Info.signature);\n    }\n\n    /// @notice Transfers tokens internally within the contract.\n    /// @param payer The address of the payer.\n    /// @param to The address of the receiver.\n    /// @param fromTokenWithMode FromToken with mode encoded in high bits\n    /// @param amount The amount of tokens to be transferred.\n    /// @dev Handles the transfer of ERC20 tokens.\n    function transferInternal(\n        address payer,\n        address to,\n        uint256 fromTokenWithMode,\n        uint256 amount\n    ) internal {\n        if (payer == to) {\n            return;\n        }\n\n        address token = address(uint160(fromTokenWithMode & _ADDRESS_MASK));\n        uint256 mode = fromTokenWithMode & _TRANSFER_MODE_MASK;\n\n        // For modes other than _MODE_NO_TRANSFER, payer needs to be checked. If the payer is address(this), the transfer logic is same.\n        // If mode is _MODE_BY_INVEST, the payer passed in must be address(this).\n        if (mode != _MODE_NO_TRANSFER) {\n            if (payer == address(this)) {\n                SafeERC20.safeTransfer(IERC20(token), to, amount);\n            } else {\n                if (mode == _MODE_DIRECT) {\n                    SafeERC20.safeTransferFrom(IERC20(token), payer, to, amount);\n                } else if (mode == _MODE_PERMIT2_ALLOWANCE) {\n                    require(amount <= type(uint160).max, \"amount too large\");\n                    IPermit2(_PERMIT2).transferFrom(payer, to, uint160(amount), token);\n                } else if (mode == _MODE_PERMIT2_SIGNATURE) {\n                    /// @notice The permitTransferFrom should not be called here, and if payer is not reset to address(this), the payer must be address(0).\n                    require(payer == address(0), \"permitTransferFrom must be called before\");\n                } else if (mode == _MODE_LEGACY) {\n                    IApproveProxy(_APPROVE_PROXY).claimTokens(token, payer, to, amount);\n                } else {\n                    revert(\"invalid transfer mode\");\n                }\n            }\n        }\n        // For _MODE_NO_TRANSFER mode, do nothing.\n    }\n\n    /// @notice Transfers the specified token to the user.\n    /// @param token The address of the token to be transferred.\n    /// @param to The address of the receiver.\n    /// @dev Handles the withdrawal of tokens to the user, converting WETH to ETH if necessary.\n    function transferTokenToUser(address token, address to) internal {\n        if (token == _ETH) {\n            uint256 wethBal = CommonLib.getBalanceOf(_WETH, address(this));\n            if (wethBal > 0) {\n                IWETH(_WETH).withdraw(wethBal);\n            }\n            if (to != address(this)) {\n                uint256 ethBal = address(this).balance;\n                if (ethBal > 0) {\n                    (bool success, ) = payable(to).call{value: ethBal, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n                    require(success, \"transfer native token failed\");\n                }\n            }\n        } else {\n            if (to != address(this)) {\n                uint256 bal = CommonLib.getBalanceOf(token, address(this));\n                if (bal > 0) {\n                    SafeERC20.safeTransfer(IERC20(token), to, bal);\n                }\n            }\n        }\n    }\n\n    /// @notice Refunds the specified token to the refundTo address.\n    /// @param token The address of the token to be refunded.\n    /// @param refundTo The address of the receiver.\n    /// @dev Handles the refund of tokens to the refundTo address.\n    function refundToken(address token, address refundTo) internal {\n        if (token == _ETH) {\n            if (refundTo != address(this)) {\n                uint256 ethBal = address(this).balance;\n                if (ethBal > 0) {\n                    (bool success, ) = payable(refundTo).call{value: ethBal, gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT}(\"\");\n                    require(success, \"refund native token failed\");\n                }\n            }\n        } else {\n            uint256 bal = CommonLib.getBalanceOf(token, address(this));\n            if (bal > 0) {\n                SafeERC20.safeTransfer(IERC20(token), refundTo, bal);\n            }\n        }\n    }\n}"},"contracts/8/router/SwapWrapRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\n\nlibrary SwapWrapRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a simple swap between ETH and WETH using encoded parameters.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param rawdata Encoded data containing swap direction, transfer mode and amount information using bit masks.\n    /// @param extraData Additional data encoded in calldata.\n    /// @dev This function supports bidirectional swaps between ETH and WETH with minimal gas overhead.\n    /// The rawdata parameter encodes:\n    /// - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH\n    function swapWrap(uint256 orderId, uint256 rawdata, IDexRouter.ExtraData memory extraData) public {\n        bool reversed;\n        uint128 amount;\n        uint256 mode;\n        assembly {\n            reversed := and(rawdata, _REVERSE_MASK)\n            amount := and(rawdata, SWAP_AMOUNT)\n            mode := and(rawdata, _TRANSFER_MODE_MASK)\n        }\n        _swapWrap(orderId, msg.sender, reversed, amount, mode, extraData);\n    }\n\n    /// @notice Executes a swap between ETH and WETH using structured base request parameters to a specified receiver.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.\n    /// @param extraData Additional data encoded in calldata.\n    /// @dev This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly.\n    /// It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.\n    function swapWrapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n\n        bool reversed;\n        address fromTokenAddr = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        if (fromTokenAddr == _ETH && baseRequest.toToken == _WETH) {\n            reversed = false;\n        } else if (fromTokenAddr == _WETH && baseRequest.toToken == _ETH) {\n            reversed = true;\n        } else {\n            revert(\"SwapWrap: invalid token pair\");\n        }\n\n        _swapWrap(orderId, receiver == address(0) ? msg.sender : receiver, reversed, baseRequest.fromTokenAmount, baseRequest.fromToken & _TRANSFER_MODE_MASK, extraData);\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice For commission validation, ETH needs to be 0xEeee.\n    function _swapWrap(\n        uint256 orderId,\n        address receiver,\n        bool reversed,\n        uint256 amount,\n        uint256 mode,\n        IDexRouter.ExtraData memory extraData\n    ) private {\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        require(amount > 0, \"amount must be > 0\");\n        require(mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE, \"invalid transfer mode\");\n\n        require(!extraData.trimInfo.hasTrim, \"trim is not supported in swapWrap\");\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, reversed ? _WETH : _ETH, reversed ? _ETH : _WETH, mode);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: receiver,\n            toToken: reversed ? _ETH : _WETH\n        });\n\n        uint256 fromTokenCommissionAmount;\n        (\n            swapCache.payer, \n            amount, \n            fromTokenCommissionAmount\n        ) = TransferLib.handlePermit2SigModeWithCommission(\n            reversed ? (mode | uint256(uint160(_WETH))) : (mode | uint256(uint160(_ETH))),\n            swapCache.payer,\n            amount,\n            address(0),\n            extraData\n        );\n\n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                false // extraData.trimInfo.hasTrim\n            );\n\n        if (reversed) {\n            require(msg.value == 0, \"value must be 0\");\n            TransferLib.transferInternal(\n                swapCache.payer,\n                address(this),\n                mode | uint256(uint160(_WETH)),\n                amount\n            );\n            IWETH(_WETH).withdraw(amount);\n            if (middleReceiver != address(this)) {\n                // Invariant: `middleReceiver != address(this)` implies no toToken commission and no trim\n                (bool success, ) = payable(middleReceiver).call{\n                    value: amount,\n                    gas: NATIVE_TOKEN_TRANSFER_GAS_LIMIT\n                }(\"\");\n                require(success, \"transfer native token failed\");\n            }\n        } else {\n            require(msg.value >= amount + fromTokenCommissionAmount, \"value not enough\");\n            IWETH(_WETH).deposit{value: amount}();\n            if (middleReceiver != address(this)) {\n                SafeERC20.safeTransfer(IERC20(_WETH), middleReceiver, amount);\n            }\n        }\n        // emit return amount should be the amount after commission\n        uint256 toTokenCommissionAndTrimAmount = CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n\n        // Refund unused fromToken\n        if (!reversed) {\n            TransferLib.refundToken(_ETH, swapCache.refundTo);\n        }\n\n        EventLib.emitOrderRecord(\n            reversed ? _WETH : _ETH,\n            swapCache.toToken,\n            tx.origin,\n            amount,\n            amount - toTokenCommissionAndTrimAmount\n        );\n    }\n}"},"contracts/8/libraries/ExtraDataLib.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"./EventLib.sol\";\n\n/*\n * To decode extra data encoded in calldata and parse to structs\n *\n * The extra data is appended after swapData in calldata, and parsed from the end (right to left).\n * All extra data fields are optional and can be omitted if not needed.\n *\n * Calldata Layout (from left to right):\n * ┌──────────┬────────┬──────────┬────────────┬──────────┬────────────┬────────────┐\n * │ swapData │ (memo) │ refundTo │ permit2Info│ trimInfo │ commission │ raw suffix │\n * │ N bytes  │ opt.   │  0/32 B  │   0/M B    │ 0/64/96 B│   0/K B    │  (0..N B)  │\n * └──────────┴────────┴──────────┴────────────┴──────────┴────────────┴────────────┘\n *                      ←─── Extra Data (anchored at endPoints[0]) ───→↑            ↑\n *                                                               endPoints[0]  calldatasize()\n *\n *   - `raw suffix` unstructured trailing bytes (e.g. ERC-8021 transaction-attribution data) that\n *                  may be appended by wallets, aggregators, or front-ends. The scan ignores them.\n *\n * Parsing Order (from right to left, anchored at endPoints[0]):\n * 1. commissionInfo  - Commission/referrer fee configuration (0, 64, 96, or more bytes depending on referrer count)\n * 2. trimInfo        - Trim/surplus handling configuration (0, 64, or 96 bytes)\n * 3. permit2Info     - Permit2 signature data for token approval (0 or variable bytes)\n * 4. refundTo        - Address to receive leftover tokens only for ByInvest mode (0 or 32 bytes)\n*/\n\nlibrary ExtraDataLib {\n    /// @dev Update EXTRA_DATA_TYPE_NUM when adding new extra calldata\n    uint8 internal constant EXTRA_DATA_TYPE_NUM = 4;\n\n    /// @notice Decode extra data and get structs with swapData boundary check\n    /// @param swapDataLength The length of swapData (4 bytes selector + ABI encoded parameters)\n    function getDecodedExtraData(uint256 swapDataLength) internal view returns (IDexRouter.ExtraData memory extraData) {\n        // calldatasize() may extend past the real ExtraData when an external suffix\n        // (e.g. ERC-8021 attribution data) has been appended. _getExtraDataEndPointAndLength\n        // performs a 32-byte aligned backward scan, bounded below by swapDataLength, to recover\n        // the true right edge and writes it into endPoints[0], which then anchors all subsequent\n        // parsing.\n        (uint256[] memory endPoints, uint256[] memory lengths) = _getExtraDataEndPointAndLength(swapDataLength);\n\n        // Validate extraData boundaries against the swapData lower bound.\n        _validateExtraDataBoundaries(endPoints, lengths, swapDataLength);\n\n        extraData = IDexRouter.ExtraData({\n            commissionInfo: _parseCommissionInfo(endPoints[0], lengths[0]),\n            trimInfo: _parseTrimInfo(endPoints[1], lengths[1]),\n            permit2Info: _parsePermit2Info(endPoints[2], lengths[2]),\n            refundTo: _parseRefundTo(endPoints[3], lengths[3])\n        });\n\n        return extraData;\n    }\n\n    // ================================ Private Functions ================================\n    /// @notice Get endPoints and lengths of each extra calldata bytes32.\n    /// @param swapDataLength Lower bound for the scan — anything before this offset is swapData\n    ///                       and cannot contain ExtraData, so the scan stops there.\n    /// @return endPoints The right edge (in calldata bytes) of each region, indexed by type.\n    ///                   endPoints[0] is the right edge of all ExtraData, located via a 32-byte\n    ///                   aligned backward flag scan; it equals calldatasize() when no trailing\n    ///                   suffix has been appended.\n    /// @return lengths   The number of 32-byte words occupied by each region.\n    function _getExtraDataEndPointAndLength(uint256 swapDataLength) private pure returns (\n        uint256[] memory endPoints,\n        uint256[] memory lengths\n    ) {\n        endPoints = new uint256[](EXTRA_DATA_TYPE_NUM);\n        lengths = new uint256[](EXTRA_DATA_TYPE_NUM);\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // Locate the right edge of ExtraData via backward 32-byte aligned flag scan, bounded\n            // below by swapDataLength — bytes before that are guaranteed swapData and cannot hold\n            // ExtraData, so flag-like patterns accidentally living in ABI params are never read.\n            // Initial value strips non-aligned trailing bytes (the external suffix);\n            // if no flag is found, parsing degenerates to \"no ExtraData\" (every length is 0).\n            let endPoint := sub(calldatasize(), mod(sub(calldatasize(), 4), 0x20))\n            for { let scanPos := endPoint } gt(scanPos, swapDataLength) { scanPos := sub(scanPos, 0x20) } {\n                // All four flag masks share the value 0xffffffffffff000…0, so one mask fits all.\n                let flagMasked := and(calldataload(sub(scanPos, 0x20)), _COMMISSION_FLAG_MASK)\n                if or(\n                    or(\n                        or(\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION), eq(flagMasked, TO_TOKEN_COMMISSION)),\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION_DUAL), eq(flagMasked, TO_TOKEN_COMMISSION_DUAL))\n                        ),\n                        or(\n                            or(eq(flagMasked, FROM_TOKEN_COMMISSION_MULTIPLE), eq(flagMasked, TO_TOKEN_COMMISSION_MULTIPLE)),\n                            or(eq(flagMasked, TRIM_FLAG), eq(flagMasked, TRIM_DUAL_FLAG))\n                        )\n                    ),\n                    or(\n                        or(eq(flagMasked, PERMIT2_INFO_SIG65_FLAG), eq(flagMasked, PERMIT2_INFO_SIG64_FLAG)),\n                        eq(flagMasked, REFUND_TO_ADDRESS_FLAG)\n                    )\n                ) {\n                    endPoint := scanPos\n                    break\n                }\n            }\n\n            // Get commission data bytes32 endPoint and length (anchor: endPoint)\n            let commissionData := calldataload(sub(endPoint, 0x20))\n            let flag := and(commissionData, _COMMISSION_FLAG_MASK)\n            let referrerNum := 0\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION),\n                eq(flag, TO_TOKEN_COMMISSION)\n            ) {\n                referrerNum := 1\n            }\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION_DUAL),\n                eq(flag, TO_TOKEN_COMMISSION_DUAL)\n            ) {\n                referrerNum := 2\n            }\n            if or(\n                eq(flag, FROM_TOKEN_COMMISSION_MULTIPLE),\n                eq(flag, TO_TOKEN_COMMISSION_MULTIPLE)\n            ) {\n                commissionData := calldataload(sub(endPoint, 0x40))\n                referrerNum := shr(240, and(commissionData, _COMMISSION_LENGTH_MASK))\n                if or(lt(referrerNum, MIN_COMMISSION_MULTIPLE_NUM), gt(referrerNum, MAX_COMMISSION_MULTIPLE_NUM)) {\n                    _revertWithReason(\n                        0x0000001520696e76616c6964207265666572726572206e756d00000000000000,\n                        0x59\n                    ) // \"invalid referrer num\"\n                }\n            }\n            let length := 0\n            if gt(referrerNum, 0) {\n                length := add(referrerNum, 1) // bytes32 length for commission is referrerNum + 1 if referrerNum > 0\n            }\n            mstore(add(endPoints, 0x20), endPoint) // commission data endPoint\n            mstore(add(lengths, 0x20), length) // commission data length\n            \n            // Get trim data bytes32 endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for trim data\n            let trimData := calldataload(sub(endPoint, 0x20))\n            flag := and(trimData, _TRIM_FLAG_MASK)\n            length := 0 // refresh length to 0 for trim data\n            if eq(flag, TRIM_FLAG) {\n                length := 2\n            }\n            if eq(flag, TRIM_DUAL_FLAG) {\n                length := 3\n            }\n            mstore(add(endPoints, 0x40), endPoint) // trim data endPoint\n            mstore(add(lengths, 0x40), length) // trim data length\n\n            // Get permit2Info data endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for permit2Info data\n            let permit2InfoData := calldataload(sub(endPoint, 0x20))\n            flag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            length := 0 // refresh length to 0 for permit2Info data\n            if or(\n                eq(flag, PERMIT2_INFO_SIG65_FLAG),\n                eq(flag, PERMIT2_INFO_SIG64_FLAG)\n            ) {\n                let amountLength := shr(200, and(permit2InfoData, _PERMIT2_INFO_AMOUNT_LENGTH_MASK))\n                length := add(amountLength, 4) \n            }\n            mstore(add(endPoints, 0x60), endPoint) // permit2Info data endPoint\n            mstore(add(lengths, 0x60), length) // permit2Info data length\n\n            // Get refundTo data endPoint and length\n            endPoint := sub(endPoint, mul(length, 0x20)) // refresh endPoint for refundTo data\n            let refundToData := calldataload(sub(endPoint, 0x20))\n            length := 0 // refresh length to 0 for refundTo data\n            if eq(and(refundToData, _REFUND_TO_MASK), REFUND_TO_ADDRESS_FLAG) {\n                length := 1\n            }\n            mstore(add(endPoints, 0x80), endPoint) // refundTo data endPoint\n            mstore(add(lengths, 0x80), length) // refundTo data length\n        }\n\n        return (endPoints, lengths);\n    }\n\n    /// @notice Validate extraData boundaries to ensure no overlap with swapData and between regions.\n    /// @param endPoints   Array of end points for each extraData region. endPoints[0] is the scan\n    ///                    anchor (right edge of all ExtraData) produced by the backward flag scan.\n    /// @param lengths     Array of lengths (in 32-byte units) for each extraData region.\n    /// @param swapDataLength The length of swapData (4 bytes selector + ABI encoded parameters).\n    /// @dev endPoints[0] is guaranteed (4 + 32*K)-aligned because it is either `aligned` (computed\n    ///      by stripping non-aligned trailing bytes) or the position of an aligned flag word.\n    function _validateExtraDataBoundaries(\n        uint256[] memory endPoints,\n        uint256[] memory lengths,\n        uint256 swapDataLength\n    ) private pure {\n        // Check 1: Each extraData region must be consecutive (no overlaps or gaps)\n        for (uint256 i = 0; i < EXTRA_DATA_TYPE_NUM - 1; ++i) {\n            require(endPoints[i + 1] == endPoints[i] - lengths[i] * 32, \"ExtraData regions not consecutive\");\n        }\n\n        // Check 2: Last region's startPoint must be >= swapDataLength (no overlap with swapData)\n        require(endPoints[EXTRA_DATA_TYPE_NUM - 1] - lengths[EXTRA_DATA_TYPE_NUM - 1] * 32 >= swapDataLength, \"ExtraData overlaps with swapData\");\n    }\n\n    /// @notice Parse commissionInfo\n    function _parseCommissionInfo(uint256 endPoint, uint256 length) private pure returns (IDexRouter.CommissionInfo memory commissionInfo) {\n        if (length == 0) {\n            return commissionInfo;\n        }\n        uint256 referrerNum = length - 1; // referrerNum is calculated in getExtraDataEndPointAndLength() function\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            let commissionData := calldataload(sub(endPoint, 0x20))\n            let flag := and(commissionData, _COMMISSION_FLAG_MASK)\n            mstore(\n                commissionInfo,\n                or(\n                    or(\n                        eq(flag, FROM_TOKEN_COMMISSION),\n                        eq(flag, FROM_TOKEN_COMMISSION_DUAL)\n                    ),\n                    eq(flag, FROM_TOKEN_COMMISSION_MULTIPLE)\n                )\n            ) // isFromTokenCommission\n            mstore(\n                add(0x20, commissionInfo),\n                or(\n                    or(\n                        eq(flag, TO_TOKEN_COMMISSION),\n                        eq(flag, TO_TOKEN_COMMISSION_DUAL)\n                    ),\n                    eq(flag, TO_TOKEN_COMMISSION_MULTIPLE)\n                )\n            ) // isToTokenCommission\n            mstore(\n                add(0xa0, commissionInfo),\n                shr(160, and(commissionData, _COMMISSION_RATE_MASK))\n            ) // 1st commissionRate\n            mstore(\n                add(0xc0, commissionInfo),\n                and(commissionData, _ADDRESS_MASK)\n            ) // 1st referrerAddress\n            commissionData := calldataload(sub(endPoint, 0x40))\n            let toBCommission := NO_TO_B_MODE // default toBCommission is 1 for no-toB commission when commissionData exists\n            if gt(and(commissionData, _TO_B_COMMISSION_MASK), 0) {\n                toBCommission := TO_B_MODE // toB commission value when commissionData exists\n            }\n            mstore(\n                add(0x60, commissionInfo),\n                toBCommission //toBCommission\n            )\n            mstore(\n                add(0x40, commissionInfo),\n                and(commissionData, _ADDRESS_MASK) //token\n            )\n            mstore(add(0x80, commissionInfo), referrerNum) //commissionLength\n\n            if gt(referrerNum, 1) {\n                for { let i := 1 } lt(i, referrerNum) { i := add(i, 1) } {\n                    commissionData := calldataload(sub(endPoint, add(0x40, mul(i, 0x20))))\n                    let flag2 := and(commissionData, _COMMISSION_FLAG_MASK)\n                    if iszero(eq(flag, flag2)) {\n                        _revertWithReason(\n                            0x0000001820696e76616c696420636f6d6d697373696f6e20666c616700000000,\n                            0x5c\n                        ) // \"invalid commission flag\"\n                    }\n                    mstore(\n                        add(add(0xa0, commissionInfo), mul(i, 0x40)), // 0xa0: commissionRate0, 0xa0 + 0x40 * i: i-th commissionRate\n                        shr(160, and(commissionData, _COMMISSION_RATE_MASK))\n                    ) //i-th commissionRate\n                    mstore(\n                        add(add(0xc0, commissionInfo), mul(i, 0x40)), // 0xc0: referrerAddress0, 0xc0 + 0x40 * i: i-th referrerAddress\n                        and(commissionData, _ADDRESS_MASK)\n                    ) //i-th referrerAddress\n                }\n            }\n        }\n        return commissionInfo;\n    }\n\n    /// @notice Parse trimInfo\n    function _parseTrimInfo(uint256 endPoint, uint256 length) private pure returns (IDexRouter.TrimInfo memory trimInfo) {\n        if (length == 0) {\n            return trimInfo;\n        }\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // get first bytes32 of trim data\n            let trimData := calldataload(sub(endPoint, 0x20))\n            let trimFlag := and(trimData, _TRIM_FLAG_MASK)\n            let hasTrim := or(\n                eq(trimFlag, TRIM_FLAG),\n                eq(trimFlag, TRIM_DUAL_FLAG)\n            )\n            mstore(\n                trimInfo,\n                hasTrim\n            ) // hasTrim\n            switch eq(hasTrim, 1)\n            case 1{\n                mstore(\n                    add(0x20, trimInfo),\n                    shr(160, and(trimData, _TRIM_RATE_MASK))\n                ) // trimRate\n                mstore(\n                    add(0x40, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // trimAddress\n                // get second bytes32 of trim data\n                trimData := calldataload(sub(endPoint, 0x40))\n                let flag := and(trimData, _TRIM_FLAG_MASK)\n                if iszero(eq(trimFlag, flag)) {\n                    _revertWithReason(\n                        0x0000001220696e76616c6964207472696d20666c616700000000000000000000,\n                        0x56\n                    ) // \"invalid trim flag\"\n                }\n                let toBTrim := NO_TO_B_MODE // default toBTrim is 1 for no-toB trim when trimData exists\n                if gt(and(trimData, _TO_B_TRIM_MASK), 0) {\n                    toBTrim := TO_B_MODE // toB trim value when trimData exists\n                }\n                mstore(\n                    add(0x60, trimInfo),\n                    toBTrim //toBTrim\n                )\n                mstore(\n                    add(0x80, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // expectAmountOut\n            }\n            default {\n                mstore(add(0x20, trimInfo), 0) // trimRate\n                mstore(add(0x40, trimInfo), 0) // trimAddress\n                mstore(add(0x60, trimInfo), 0) // toBTrim\n                mstore(add(0x80, trimInfo), 0) // expectAmountOut\n            }\n            switch eq(trimFlag, TRIM_DUAL_FLAG)\n            case 1 {\n                // get third bytes32 of trim data\n                trimData := calldataload(sub(endPoint, 0x60))\n                let flag := and(trimData, _TRIM_FLAG_MASK)\n                if iszero(eq(trimFlag, flag)) {\n                    _revertWithReason(\n                        0x0000001220696e76616c6964207472696d20666c616700000000000000000000,\n                        0x56\n                    ) // \"invalid trim flag\"\n                }\n                mstore(\n                    add(0xa0, trimInfo),\n                    shr(160, and(trimData, _TRIM_RATE_MASK))\n                ) // chargeRate\n                mstore(\n                    add(0xc0, trimInfo),\n                    and(trimData, _TRIM_EXPECT_AMOUNT_OUT_OR_ADDRESS_MASK)\n                ) // chargeAddress\n            }\n            default {\n                mstore(add(0xa0, trimInfo), 0) // chargeRate\n                mstore(add(0xc0, trimInfo), 0) // chargeAddress\n            }\n        }\n        return trimInfo;\n    }\n\n    /// @notice Parse permit2Info\n    function _parsePermit2Info(uint256 endPoint, uint256 length) private view returns (IDexRouter.Permit2Info memory permit2Info) {\n        if (length == 0) {\n            return permit2Info;\n        }\n        // Since length == amountLength + 4, so here when length != 0, the length of permit2Info.amounts is length - 4.\n        permit2Info.amounts = new uint256[](length - 4);\n        uint256 permit2InfoFlag;\n        uint256[] memory permit2SignatureCache = new uint256[](3); // signature r, signature s, signature v\n        assembly (\"memory-safe\") {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            // get first bytes32 of permit2Info\n            let permit2InfoData := calldataload(sub(endPoint, 0x20))\n            permit2InfoFlag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            // The first permit2InfoFlag has been verified in getExtraDataEndPointAndLength() function\n            let amountLength := sub(length, 4)\n            mstore(permit2Info, and(permit2InfoData, _ADDRESS_MASK)) // owner\n\n            // get second bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x40))\n            let flag := and(permit2InfoData, _PERMIT2_INFO_FLAG_MASK)\n            if iszero(eq(permit2InfoFlag, flag)) {\n                _revertWithReason(\n                    0x0000001920696e76616c6964207065726d697432496e666f20666c6167000000,\n                    0x5d\n                ) // \"invalid permit2Info flag\"\n            }\n            mstore(add(permit2Info, 0x20), and(permit2InfoData, _PERMIT2_INFO_NONCE_MASK)) // nonce\n            mstore(add(permit2Info, 0x40), shr(48, and(permit2InfoData, _PERMIT2_INFO_DEADLINE_MASK))) // deadline\n            if eq(permit2InfoFlag, PERMIT2_INFO_SIG65_FLAG) {\n                mstore(add(permit2SignatureCache, 0x60), shr(96, and(permit2InfoData, _PERMIT2_INFO_SIGNATURE_V_MASK))) // signature v\n            }\n            // get third bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x60))\n            mstore(add(permit2SignatureCache, 0x20), permit2InfoData) // signature r\n            // get fourth bytes32 of permit2Info\n            permit2InfoData := calldataload(sub(endPoint, 0x80))\n            mstore(add(permit2SignatureCache, 0x40), permit2InfoData) // signature s\n            // get all amounts\n            let amountsPosition := mload(add(permit2Info, 0x80))\n            for { let i := 0 } lt(i, amountLength) { i := add(i, 1) } {\n                permit2InfoData := calldataload(sub(endPoint, add(0xa0, mul(i, 0x20))))\n                mstore(add(amountsPosition, mul(add(i, 1), 0x20)), permit2InfoData) // permit2Info.amounts[i]\n            }\n        }\n        if (permit2InfoFlag == PERMIT2_INFO_SIG65_FLAG) {\n            permit2Info.signature = abi.encodePacked(bytes32(permit2SignatureCache[0]), bytes32(permit2SignatureCache[1]), bytes1(uint8(permit2SignatureCache[2])));\n        } else if (permit2InfoFlag == PERMIT2_INFO_SIG64_FLAG) {\n            permit2Info.signature = abi.encodePacked(bytes32(permit2SignatureCache[0]), bytes32(permit2SignatureCache[1]));\n        }\n\n        return permit2Info;\n    }\n\n    /// @notice Parse refundTo\n    function _parseRefundTo(uint256 endPoint, uint256 length) private pure returns (address refundTo) {\n        if (length == 0) {\n            return address(0);\n        }\n        assembly (\"memory-safe\") {\n            let refundToData := calldataload(sub(endPoint, 0x20))\n            refundTo := and(refundToData, _ADDRESS_MASK)\n        }\n        return refundTo;\n    }\n}"},"contracts/8/router/SmartSwapRouter.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../libraries/PMMLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\nimport \"../interfaces/IWETH.sol\";\n\n\nlibrary SmartSwapRouter {\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a smart swap directly to a specified receiver address.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking.\n    /// @param receiver Address to receive the output tokens from the swap.\n    /// @param baseRequest Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\n    /// @param batchesAmount Array indicating amounts for each batch in the swap, allowing for split operations.\n    /// @param batches Detailed routing information for executing the swap across different paths or protocols.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function enables users to perform token swaps with complex routing directly to a specified address,\n    /// optimizing for best returns and accommodating specific trading strategies.\n    function smartSwapTo(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        uint256[] calldata batchesAmount,\n        IDexRouter.RouterPath[][] calldata batches,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n        return\n            _smartSwapTo(\n                IDexRouter.SwapCache({\n                    payer: msg.sender,\n                    refundTo: msg.sender,\n                    receiver: receiver == address(0) ? msg.sender : receiver,\n                    toToken: baseRequest.toToken\n                }),\n                baseRequest,\n                batchesAmount,\n                batches,\n                extraData\n            );\n    }\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If fromToken or toToken is ETH, the address needs to be 0xEeee. And for commission validation, ETH needs to be 0xEeee.\n    function _smartSwapTo(\n        IDexRouter.SwapCache memory swapCache,\n        IDexRouter.BaseRequest memory baseRequest,\n        uint256[] memory batchesAmount,\n        IDexRouter.RouterPath[][] memory batches,\n        IDexRouter.ExtraData memory extraData\n    ) private returns (uint256 returnAmount) {\n        uint256 mode = batches[0][0].fromToken & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST || mode == _MODE_NO_TRANSFER,\n            \"invalid transfer mode\"\n        );\n        \n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, fromToken, baseRequest.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        if (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) {\n            swapCache.refundTo = extraData.refundTo;\n        }\n\n        // Stash the receiver's toToken balanceBefore in returnAmount; it is replaced by the actual delta after the swap.\n        returnAmount = CommonLib.getBalanceOf(baseRequest.toToken, swapCache.receiver);\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalFromTokenAmount = baseRequest.fromTokenAmount;\n\n        uint256 fromTokenCommissionAmount;\n        {\n            address onlyOneAssetTo = (batches.length == 1 && batches[0][0].assetTo.length == 1)\n                ? batches[0][0].assetTo[0]\n                : address(0);\n            (\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                fromTokenCommissionAmount\n            ) = TransferLib.handlePermit2SigModeWithCommission(\n                uint256(uint160(fromToken)) | mode,\n                swapCache.payer,\n                baseRequest.fromTokenAmount,\n                onlyOneAssetTo,\n                extraData\n            );\n        }\n\n        {\n            (\n                address middleReceiver,\n                uint256 balanceBefore\n            ) = CommissionLib.doCommissionFromToken(\n                    extraData.commissionInfo,\n                    swapCache,\n                    fromTokenCommissionAmount,\n                    extraData.trimInfo.hasTrim\n                );\n\n            _smartSwapInternal(\n                baseRequest,\n                batchesAmount,\n                batches,\n                swapCache,\n                middleReceiver\n            );\n\n            CommissionLib.doCommissionAndTrimToToken(\n                extraData.commissionInfo,\n                swapCache.receiver,\n                balanceBefore,\n                baseRequest.toToken,\n                extraData.trimInfo\n            );\n        }\n\n        // Refund unused fromToken\n        if (fromToken == _ETH) {\n            TransferLib.refundToken(_ETH, swapCache.refundTo); // In case of  msg.value > fromTokenAmount, the unused ETH will be refunded to refundTo\n            TransferLib.refundToken(_WETH, swapCache.refundTo); // In case of fromTokenAmount > sum of batchesAmount, the unused WETH will be refunded to refundTo\n        } else {\n            TransferLib.refundToken(fromToken, swapCache.refundTo); // In case of fromTokenAmount > sum of batchesAmount, the unused fromToken will be refunded to refundTo\n        }\n\n        // check minReturnAmount\n        returnAmount =\n            CommonLib.getBalanceOf(baseRequest.toToken, swapCache.receiver) -\n            returnAmount;\n        require(\n            returnAmount >= baseRequest.minReturnAmount,\n            \"Min return not reached\"\n        );\n\n        EventLib.emitOrderRecord(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken),\n            baseRequest.toToken,\n            tx.origin,\n            originalFromTokenAmount,\n            returnAmount\n        );\n    }\n\n    /// @notice Executes a complex swap based on provided parameters and paths.\n    /// @param baseRequest Basic swap details including tokens, amounts, and deadline.\n    /// @param batchesAmount Amounts for each swap batch.\n    /// @param batches Detailed swap paths for execution.\n    /// @param swapCache Provides payer and refundTo; swapCache.receiver is unused here.\n    /// @param receiver Hop output recipient (middleReceiver when commission/trim is active).\n    function _smartSwapInternal(\n        IDexRouter.BaseRequest memory baseRequest,\n        uint256[] memory batchesAmount,\n        IDexRouter.RouterPath[][] memory batches,\n        IDexRouter.SwapCache memory swapCache,\n        address receiver\n    ) private {\n        // 1. transfer from token in\n        address fromToken = CommonLib.bytes32ToAddress(baseRequest.fromToken);\n\n        // In order to deal with ETH/WETH transfer rules in a unified manner,\n        // we do not need to judge according to fromToken.\n        if (fromToken == _ETH) {\n            IWETH(_WETH).deposit{\n                value: baseRequest.fromTokenAmount\n            }();\n            require(CommonLib.bytes32ToAddress(batches[0][0].fromToken) == _WETH, \"firstToken mismatch\");\n            require(swapCache.payer == address(this), \"payer must be router\");\n        } else {\n            require(CommonLib.bytes32ToAddress(batches[0][0].fromToken) == fromToken, \"firstToken mismatch\");\n            require(msg.value == 0, \"value must be 0\");\n        }\n\n        // 2. check total batch amount\n        {\n            // avoid stack too deep\n            uint256 totalBatchAmount;\n            for (uint256 i = 0; i < batchesAmount.length; ) {\n                totalBatchAmount += batchesAmount[i];\n                unchecked {\n                    ++i;\n                }\n            }\n            // payer == address(0) signals that fromTokenAmount has been transferred\n            // directly to the pool via permit2 signature. The unused portion cannot\n            // be refunded in this case (funds are already in the pool, where adapters\n            // settle by balanceOf), so require exact match to prevent silent over-swap.\n            if (swapCache.payer == address(0)) {\n                require(\n                    totalBatchAmount == baseRequest.fromTokenAmount,\n                    \"Route: total batch amount must equal fromTokenAmount\"\n                );\n            } else {\n                require(\n                    totalBatchAmount <= baseRequest.fromTokenAmount,\n                    \"Route: total batch amount should be <= fromTokenAmount\"\n                );\n            }\n        }\n\n        // 4. execute batch\n        // check length, fix DRW-02: LACK OF LENGTH CHECK ON BATATCHES\n        require(batchesAmount.length == batches.length, \"length mismatch\");\n        for (uint256 i = 0; i < batches.length; ) {\n            if (i > 0) {\n                require(batches[i][0].fromToken == batches[0][0].fromToken, \"Inconsistent fromToken across batches\");\n            }\n\n            // execute hop, if the whole swap replacing by pmm fails, the funds will return to dexRouter\n            _exeHop(\n                swapCache.payer,\n                swapCache.refundTo,\n                receiver,\n                baseRequest.toToken == _ETH,\n                batchesAmount[i],\n                batches[i]\n            );\n            unchecked {\n                ++i;\n            }\n        }\n\n        // 5. transfer tokens to user\n        TransferLib.transferTokenToUser(baseRequest.toToken, receiver);\n    }\n\n    /// @notice Executes a series of swaps or operations defined by a set of routing paths, potentially across different protocols or pools.\n    /// @param payer The address providing the tokens for the swap.\n    /// @param receiver The address receiving the output tokens.\n    /// @param isToNative Indicates whether the final asset should be converted to the native blockchain asset (e.g., ETH).\n    /// @param batchAmount The total amount of the input token to be swapped.\n    /// @param hops An array of RouterPath structures, each defining a segment of the swap route.\n    /// @dev This function manages complex swap routes that might involve multiple hops through different liquidity pools or swapping protocols.\n    /// It iterates through the provided `hops`, executing each segment of the route in sequence.\n    function _exeHop(\n        address payer,\n        address refundTo,\n        address receiver,\n        bool isToNative,\n        uint256 batchAmount,\n        IDexRouter.RouterPath[] memory hops\n    ) private {\n        address fromToken = CommonLib.bytes32ToAddress(hops[0].fromToken);\n\n        // execute hop\n        uint256 hopLength = hops.length;\n        for (uint256 i = 0; i < hopLength; ) {\n            if (i > 0) {\n                fromToken = CommonLib.bytes32ToAddress(hops[i].fromToken);\n                batchAmount = CommonLib.getBalanceOf(fromToken, address(this));\n                payer = address(this);\n            }\n\n            address to = address(this);\n            if (i == hopLength - 1 && !isToNative) {\n                to = receiver;\n            }\n\n            // 3.2 execute forks\n            _exeForks(payer, refundTo, to, batchAmount, hops[i]);\n\n            unchecked {\n                ++i;\n            }\n        }\n    }\n\n    /// @notice Executes multiple adapters for a transaction pair.\n    /// @param payer The address of the payer.\n    /// @param to The address of the receiver.\n    /// @param batchAmount The amount to be transferred in each batch.\n    /// @param path The routing path for the swap.\n    /// @dev It includes checks for the total weight of the paths and executes the swapping through the adapters.\n    function _exeForks(\n        address payer,\n        address refundTo,\n        address to,\n        uint256 batchAmount,\n        IDexRouter.RouterPath memory path\n    ) private {\n        uint256 totalWeight;\n        uint256 accAmount;\n        for (uint256 i = 0; i < path.mixAdapters.length; ++i) {\n            bytes32 rawData = bytes32(path.rawData[i]);\n            address poolAddress;\n            bool reverse;\n            {\n                uint256 weight;\n                assembly {\n                    poolAddress := and(rawData, _ADDRESS_MASK)\n                    reverse := and(rawData, _REVERSE_MASK)\n                    weight := shr(160, and(rawData, _WEIGHT_MASK))\n                }\n                totalWeight += weight;\n                if (i == path.mixAdapters.length - 1) {\n                    require(\n                        totalWeight == 10_000,\n                        \"totalWeight must be 10000\"\n                    );\n                }\n\n                uint256 _fromTokenAmount;\n                if (i == path.mixAdapters.length - 1) {\n                    _fromTokenAmount = batchAmount - accAmount;\n                } else {\n                    _fromTokenAmount = (batchAmount * weight) / 10_000;\n                    accAmount += _fromTokenAmount;\n                }\n                if (_fromTokenAmount > 0) {\n                    TransferLib.transferInternal(\n                        payer,\n                        path.assetTo[i],\n                        path.fromToken,\n                        _fromTokenAmount\n                    );\n                }\n            }\n\n            CommonLib.exeAdapter(\n                reverse,\n                path.mixAdapters[i],\n                to,\n                poolAddress,\n                path.extraData[i],\n                refundTo\n            );\n        }\n    }\n}"},"contracts/8/router/UnxswapV3Router.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Constants.sol\";\nimport \"../libraries/EventLib.sol\";\nimport \"../libraries/UniswapTokenInfoHelper.sol\";\nimport \"../libraries/CommonLib.sol\";\nimport \"../libraries/CommissionLib.sol\";\nimport \"../libraries/TrimLib.sol\";\nimport \"../libraries/TransferLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\nimport \"../interfaces/IERC20.sol\";\n\nlibrary UnxswapV3Router {\n    using Address for address payable;\n\n    bytes32 private constant _POOL_INIT_CODE_HASH =\n        0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; // Pool init code hash\n    // _FF_FACTORY is maintained centrally in Constants.sol (injected per-chain by gen-chainconfig).\n    // concatenation of token0(), token1() fee(), transfer() and claimTokens() selectors\n    bytes32 private constant _SELECTORS =\n        0x0dfe1681d21220a7ddca3f43a9059cbb0a5ea466000000000000000000000000;\n    // concatenation of withdraw(uint),transfer()\n    bytes32 private constant _SELECTORS2 =\n        0x2e1a7d4da9059cbb000000000000000000000000000000000000000000000000;\n    bytes32 private constant _SELECTORS3 =\n        0xa9059cbb70a08231000000000000000000000000000000000000000000000000;\n    uint160 private constant _MIN_SQRT_RATIO = 4_295_128_739 + 1;\n    uint160 private constant _MAX_SQRT_RATIO =\n        1_461_446_703_485_210_103_287_273_052_203_988_822_378_723_970_342 - 1;\n    bytes32 private constant _SWAP_SELECTOR =\n        0x128acb0800000000000000000000000000000000000000000000000000000000; // Swap function selector\n    uint256 private constant _INT256_MAX =\n        0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; // Maximum int256\n    uint256 private constant _INT256_MIN =\n        0x8000000000000000000000000000000000000000000000000000000000000000; // Minimum int256\n\n    // ================================================================================\n    // ============================== Public Functions ================================\n    // ================================================================================\n    /// @notice Executes a swap using the Uniswap V3 protocol.\n    /// @param receiver The address that will receive the swap funds (encoded as uint256 with order ID mask).\n    /// @param amount The amount of the source token to be swapped.\n    /// @param minReturn The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.\n    /// @param pools An array of pool identifiers used to define the swap route within Uniswap V3.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The amount of tokens received after the completion of the swap.\n    /// @dev This function wraps and unwraps ETH as required, ensuring the transaction only accepts non-zero `msg.value` for ETH swaps. It invokes `_uniswapV3Swap` to execute the actual swap and handles commission post-swap.\n    function uniswapV3SwapTo(\n        uint256 receiver,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) public returns (uint256 returnAmount) {\n        EventLib.emitSwapOrderId((receiver & _ORDER_ID_MASK) >> 160);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address srcToken, address toToken) = UniswapTokenInfoHelper.getUniswapV3TokenInfo(msg.value > 0, pools);\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: CommonLib.bytes32ToAddress(receiver),\n            toToken: toToken\n        });\n        return\n            _uniswapV3SwapTo(\n                swapCache,\n                srcToken,\n                amount,\n                minReturn,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee.\n    /// @param orderId Unique identifier for the swap order, facilitating tracking and reference.\n    /// @param receiver The address that will receive the swapped tokens.\n    /// @param baseRequest Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\n    /// @param pools An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.\n    /// @param extraData Additional data encoded in calldata.\n    /// @return returnAmount The total amount of destination tokens received from the swap.\n    /// @dev This function validates token compatibility with the provided pool route and ensures proper swap execution.\n    /// It supports both ETH and ERC20 token swaps, with automatic WETH wrapping/unwrapping as needed.\n    /// The function verifies that fromToken matches the first pool and toToken matches the last pool in the route.\n    function uniswapV3SwapToWithBaseRequest(\n        uint256 orderId,\n        address receiver,\n        IDexRouter.BaseRequest calldata baseRequest,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    )\n        public\n        returns (uint256 returnAmount)\n    {\n        CommonLib.validateDeadline(baseRequest.deadLine);\n        EventLib.emitSwapOrderId(orderId);\n        EventLib.emitCommissionAndTrimInfoIfNeeded(extraData);\n\n        (address srcToken, address toToken) = UniswapTokenInfoHelper.getUniswapV3TokenInfo(msg.value > 0, pools);\n\n        // validate fromToken and toToken from baseRequest\n        require(\n            CommonLib.bytes32ToAddress(baseRequest.fromToken) == srcToken && baseRequest.toToken == toToken,\n            \"uniswapV3: token mismatch\"\n        );\n\n        IDexRouter.SwapCache memory swapCache = IDexRouter.SwapCache({\n            payer: msg.sender,\n            refundTo: msg.sender,\n            receiver: receiver,\n            toToken: toToken\n        });\n        return\n            _uniswapV3SwapTo(\n                swapCache,\n                srcToken,\n                baseRequest.fromTokenAmount,\n                baseRequest.minReturnAmount,\n                pools,\n                extraData\n            );\n    }\n\n    /// @notice Callback function invoked by Uniswap V3 pools during a swap.\n    /// @param amount0Delta The change in token0 balance (positive means the contract must pay token0).\n    /// @param amount1Delta The change in token1 balance (positive means the contract must pay token1).\n    /// @dev This function is called by the Uniswap V3 pool after executing a swap. It handles the payment of tokens to the pool.\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata /*data*/\n    ) public {\n        _uniswapV3SwapCallback(amount0Delta, amount1Delta);\n    }\n\n\n    // ================================================================================\n    // ============================== Private Functions ===============================\n    // ================================================================================\n    /// @notice If srcToken or toToken is ETH, the address needs to be 0xEeee. And for commission validation, ETH needs to be 0xEeee.\n    function _uniswapV3SwapTo(\n        IDexRouter.SwapCache memory swapCache,\n        address srcToken,\n        uint256 amount,\n        uint256 minReturn,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData\n    ) private returns (uint256 returnAmount) {\n        swapCache.receiver = swapCache.receiver == address(0) ? msg.sender : swapCache.receiver;\n\n        uint256 mode = pools[0] & _TRANSFER_MODE_MASK;\n        require(\n            mode == _MODE_LEGACY || mode == _MODE_DIRECT || mode == _MODE_PERMIT2_ALLOWANCE || mode == _MODE_PERMIT2_SIGNATURE || mode == _MODE_BY_INVEST,\n            \"invalid transfer mode\"\n        );\n\n        if (mode == _MODE_BY_INVEST && extraData.refundTo != address(0)) {\n            swapCache.refundTo = extraData.refundTo;\n        }\n\n        CommissionLib.validateCommissionInfo(extraData.commissionInfo, srcToken, swapCache.toToken, mode);\n        TrimLib.validateTrimInfo(extraData.trimInfo);\n        extraData.commissionInfo.tokenWithMode = mode | extraData.commissionInfo.tokenWithMode;\n\n        returnAmount = CommonLib.getBalanceOf(swapCache.toToken, swapCache.receiver);\n\n        // Snapshot for OrderRecord only; not for swap math.\n        uint256 originalAmount = amount;\n\n        uint256 fromTokenCommissionAmount;\n        (\n            swapCache.payer,\n            amount,\n            fromTokenCommissionAmount\n        ) = TransferLib.handlePermit2SigModeWithCommission(\n            uint256(uint160(srcToken)) | mode,\n            swapCache.payer,\n            amount,\n            address(0),\n            extraData\n        );\n\n        _doUniswapV3Swap(\n            swapCache,\n            amount,\n            pools,\n            extraData,\n            fromTokenCommissionAmount\n        );\n\n        // check minReturnAmount\n        returnAmount = CommonLib.getBalanceOf(swapCache.toToken, swapCache.receiver) - returnAmount;\n        require(\n            returnAmount >= minReturn,\n            \"Min return not reached\"\n        );\n\n        // Refund unused fromToken. If fromToken is not ETH or mode is not ByInvest, no need to refund cause all `fromTokenAmount` will be used.\n        if (srcToken == _ETH || mode == _MODE_BY_INVEST) {\n            TransferLib.refundToken(srcToken, swapCache.refundTo); // In case of msg.value > fromTokenAmount or actual transfer amount > fromTokenAmount in ByInvest mode, the unused fromToken will be refunded to refundTo\n        }\n\n        EventLib.emitOrderRecord(\n            srcToken,\n            swapCache.toToken,\n            tx.origin,\n            originalAmount,\n            returnAmount\n        );\n    }\n\n    function _doUniswapV3Swap(\n        IDexRouter.SwapCache memory swapCache,\n        uint256 amount,\n        uint256[] calldata pools,\n        IDexRouter.ExtraData memory extraData,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        \n        (\n            address middleReceiver,\n            uint256 balanceBefore\n        ) = CommissionLib.doCommissionFromToken(\n                extraData.commissionInfo,\n                swapCache,\n                fromTokenCommissionAmount,\n                extraData.trimInfo.hasTrim\n            );\n\n        _uniswapV3Swap(\n            swapCache.payer,\n            payable(middleReceiver),\n            swapCache.refundTo,\n            amount,\n            pools\n        );\n\n        CommissionLib.doCommissionAndTrimToToken(\n            extraData.commissionInfo,\n            swapCache.receiver,\n            balanceBefore,\n            swapCache.toToken,\n            extraData.trimInfo\n        );\n    }\n\n    /// @notice Conducts a swap using the Uniswap V3 protocol internally within the contract.\n    /// @param payer The address of the account providing the tokens for the swap.\n    /// @param receiver The address that will receive the tokens after the swap.\n    /// @param refundTo The address to refund the unused tokens to.\n    /// @param amount The amount of the source token to be swapped.\n    /// @param pools An array of pool identifiers defining the swap route within Uniswap V3.\n    /// @return returnAmount The amount of tokens received from the swap.\n    /// @dev This internal function encapsulates the core logic for executing swaps on Uniswap V3. It is intended to be used by other functions in the contract that prepare and pass the necessary parameters.\n    ///      The function handles the swapping process, ensuring that the minimum return is met and managing the transfer of tokens.\n    function _uniswapV3Swap(\n        address payer,\n        address payable receiver,\n        address refundTo,\n        uint256 amount,\n        uint256[] calldata pools\n    ) internal returns (uint256 returnAmount) {\n        assembly {\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _makeSwap(_receiver, _payer, _refundTo, _pool, _amount, _transferMode)\n                -> _returnAmount\n            {\n                if lt(_INT256_MAX, _amount) {\n                    mstore(\n                        0,\n                        0xb3f79fd000000000000000000000000000000000000000000000000000000000\n                    ) //SafeCastToInt256Failed()\n                    revert(0, 4)\n                }\n                let freePtr := mload(0x40)\n                let zeroForOne := eq(and(_pool, _ONE_FOR_ZERO_MASK), 0)\n\n                let poolAddr := and(_pool, _ADDRESS_MASK)\n                switch zeroForOne\n                case 1 {\n                    mstore(freePtr, _SWAP_SELECTOR)\n                    let paramPtr := add(freePtr, 4)\n                    mstore(paramPtr, _receiver)\n                    mstore(add(paramPtr, 0x20), true)\n                    mstore(add(paramPtr, 0x40), _amount)\n                    mstore(add(paramPtr, 0x60), _MIN_SQRT_RATIO)\n                    mstore(add(paramPtr, 0x80), 0xa0)\n                    mstore(add(paramPtr, 0xa0), 128)                    // data.length = 128 (0x80)\n                    mstore(add(paramPtr, 0xc0), V3_EXACT_IN_CALLBACK_FLAG)  // data[0] = flag\n                    mstore(add(paramPtr, 0xe0), _payer)                 // data[1] = payer\n                    mstore(add(paramPtr, 0x100), _refundTo)             // data[2] = refundTo\n                    mstore(add(paramPtr, 0x120), _transferMode)         // data[3] = transferMode\n                    let success := call(\n                        gas(),\n                        poolAddr,\n                        0,\n                        freePtr,\n                        0x144,\n                        0,\n                        0\n                    )\n                    if iszero(success) {\n                        revert(0, 32)\n                    }\n                    returndatacopy(0, 32, 32) // only copy _amount1   MEM[0:] <= RETURNDATA[32:32+32]\n                }\n                default {\n                    mstore(freePtr, _SWAP_SELECTOR)\n                    let paramPtr := add(freePtr, 4)\n                    mstore(paramPtr, _receiver)\n                    mstore(add(paramPtr, 0x20), false)\n                    mstore(add(paramPtr, 0x40), _amount)\n                    mstore(add(paramPtr, 0x60), _MAX_SQRT_RATIO)\n                    mstore(add(paramPtr, 0x80), 0xa0)\n                    mstore(add(paramPtr, 0xa0), 128)                    // data.length = 128 (0x80)\n                    mstore(add(paramPtr, 0xc0), V3_EXACT_IN_CALLBACK_FLAG)  // data[0] = flag\n                    mstore(add(paramPtr, 0xe0), _payer)                 // data[1] = payer\n                    mstore(add(paramPtr, 0x100), _refundTo)             // data[2] = refundTo\n                    mstore(add(paramPtr, 0x120), _transferMode)         // data[3] = transferMode\n                    let success := call(\n                        gas(),\n                        poolAddr,\n                        0,\n                        freePtr,\n                        0x144,\n                        0,\n                        0\n                    )\n                    if iszero(success) {\n                        revert(0, 32)\n                    }\n                    returndatacopy(0, 0, 32) // only copy _amount0   MEM[0:] <= RETURNDATA[0:0+32]\n                }\n                _returnAmount := mload(0)\n                if lt(_returnAmount, _INT256_MIN) {\n                    mstore(\n                        0,\n                        0x88c8ee9c00000000000000000000000000000000000000000000000000000000\n                    ) //SafeCastToUint256Failed()\n                    revert(0, 4)\n                }\n                _returnAmount := add(1, not(_returnAmount)) // -a = ~a + 1\n            }\n            function _wrapWeth(_amount) {\n                // require callvalue() >= amount, lt: if x < y return 1，else return 0\n                if eq(lt(callvalue(), _amount), 1) {\n                    mstore(\n                        0,\n                        0x1841b4e100000000000000000000000000000000000000000000000000000000\n                    ) // InvalidMsgValue()\n                    revert(0, 4)\n                }\n\n                let success := call(gas(), _WETH, _amount, 0, 0, 0, 0) //进入fallback逻辑\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001357455448206465706f736974206661696c6564000000000000000000,\n                        87\n                    ) //WETH deposit failed\n                }\n            }\n            function _unWrapWeth(_receiver, _amount) {\n                let freePtr := mload(0x40)\n\n                // withdraw WETH to ETH\n                mstore(freePtr, _SELECTORS2) // withdraw(uint256) selector (first 4 bytes)\n                mstore(add(freePtr, 4), _amount)\n                let success := call(gas(), _WETH, 0, freePtr, 36, 0, 0)\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001477697468647261772077657468206661696c65640000000000000000,\n                        88\n                    ) // withdraw weth failed\n                }\n                // send ETH to receiver, skip when target is this contract.\n                if iszero(eq(_receiver, address())) {\n                    success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, _receiver, _amount, 0, 0, 0, 0)\n                    if iszero(success) {\n                        _revertWithReason(\n                            0x0000001173656e64206574686572206661696c65640000000000000000000000,\n                            85\n                        ) // send ether failed\n                    }\n                }\n            }\n            function _token0(_pool) -> token0 {\n                let freePtr := mload(0x40)\n                mstore(freePtr, _SELECTORS)\n                let success := staticcall(gas(), _pool, freePtr, 0x4, 0, 0)\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001167657420746f6b656e30206661696c65640000000000000000000000,\n                        85\n                    ) // get token0 failed\n                }\n                returndatacopy(0, 0, 32)\n                token0 := mload(0)\n            }\n            function _token1(_pool) -> token1 {\n                let freePtr := mload(0x40)\n                mstore(freePtr, _SELECTORS)\n                let success := staticcall(\n                    gas(),\n                    _pool,\n                    add(freePtr, 4),\n                    0x4,\n                    0,\n                    0\n                )\n                if iszero(success) {\n                    _revertWithReason(\n                        0x0000001167657420746f6b656e31206661696c65640000000000000000000000,\n                        84\n                    ) // get token1 failed\n                }\n                returndatacopy(0, 0, 32)\n                token1 := mload(0)\n            }\n\n            let firstPoolStart\n            let lastPoolStart\n\n            {\n                let len := pools.length\n                firstPoolStart := pools.offset //\n                lastPoolStart := sub(add(firstPoolStart, mul(len, 32)), 32)\n\n                if eq(len, 0) {\n                    mstore(\n                        0,\n                        0x67e7c0f600000000000000000000000000000000000000000000000000000000\n                    ) // EmptyPools()\n                    revert(0, 4)\n                }\n                \n            }\n\n            {\n                let wrapWeth := gt(callvalue(), 0)\n                if wrapWeth {\n                    _wrapWeth(amount)\n                    payer := address()\n                }\n            }\n\n            for {\n                let i := firstPoolStart\n            } lt(i, lastPoolStart) {\n                i := add(i, 32)\n            } {\n                amount := _makeSwap(\n                    address(),\n                    payer,\n                    refundTo,\n                    calldataload(i),\n                    amount,\n                    and(calldataload(firstPoolStart), _TRANSFER_MODE_MASK)\n                )\n                payer := address()\n            }\n            {\n                let unwrapWeth := gt(\n                    and(calldataload(lastPoolStart), _WETH_UNWRAP_MASK),\n                    0\n                ) // pools[lastIndex] & _WETH_UNWRAP_MASK > 0\n\n                // last one or only one\n                switch unwrapWeth\n                case 1 {\n                    returnAmount := _makeSwap(\n                        address(),\n                        payer,\n                        refundTo,\n                        calldataload(lastPoolStart),\n                        amount,\n                        and(calldataload(lastPoolStart), _TRANSFER_MODE_MASK)\n                    )\n                    _unWrapWeth(receiver, returnAmount)\n                }\n                case 0 {\n                    returnAmount := _makeSwap(\n                        receiver,\n                        payer,\n                        refundTo,\n                        calldataload(lastPoolStart),\n                        amount,\n                        and(calldataload(lastPoolStart), _TRANSFER_MODE_MASK)\n                    )\n                }\n            }\n\n        }\n    }\n\n    function _uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta\n    ) private {\n        assembly {\n            // solhint-disable-line no-inline-assembly\n            function reRevert() {\n                returndatacopy(0, 0, returndatasize())\n                revert(0, returndatasize())\n            }\n            function getBalanceAndTransfer(emptyPtr, token) {\n                mstore(emptyPtr, _SELECTORS3)\n                mstore(add(8, emptyPtr), address())\n                if iszero(\n                    staticcall(gas(), token, add(4, emptyPtr), 36, 0, 32)\n                ) {\n                    reRevert()\n                }\n                let amount := mload(0)\n                if gt(amount, 0) {\n                    let refundTo := calldataload(196) // offset adjusted for flag: 164 + 32 = 196\n                    mstore(add(4, emptyPtr), refundTo)\n                    mstore(add(36, emptyPtr), amount)\n                    validateERC20Transfer(\n                        call(gas(), token, 0, emptyPtr, 0x44, 0, 0x20)\n                    )\n                }\n            }\n\n            function validateERC20Transfer(status) {\n                if iszero(status) {\n                    reRevert()\n                }\n                let success := or(\n                    iszero(returndatasize()), // empty return data\n                    and(gt(returndatasize(), 31), eq(mload(0), 1)) // true in return data\n                )\n                if iszero(success) {\n                    mstore(\n                        0,\n                        0xf27f64e400000000000000000000000000000000000000000000000000000000\n                    ) // ERC20TransferFailed()\n                    revert(0, 4)\n                }\n            }\n\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n\n            function _transferTokenDirect(token, from, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n\n            function _transferTokenPermit2Allowance(token, from, to, amount) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amount) {\n                    _revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n\n            function _claimToken(token, _payer, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    0x0a5ea46600000000000000000000000000000000000000000000000000000000\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amount)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            \n            function _transferTokenWithMode(token, mode, _payer, to, amount) {\n                if gt(amount, 0) {\n                    switch mode\n                    case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                        _transferTokenDirect(token, _payer, to, amount)\n                    }\n                    case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                        _transferTokenPermit2Allowance(token, _payer, to, amount)\n                    }\n                    case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                        _claimToken(token, _payer, to, amount)\n                    }\n                    default {\n                        _revertWithReason(\n                            0x00000015696e76616c6964207472616e73666572206d6f646500000000000000,\n                            0x59\n                        ) // \"invalid transfer mode\"\n                    }\n                }\n            }\n\n            let emptyPtr := mload(0x40)\n            let resultPtr := add(emptyPtr, 21) // 0x15 = _FF_FACTORY size\n\n\n            // Store token0/token1/fee at emptyPtr+32 to avoid overwriting\n            // Solidity's free memory pointer at 0x40\n            let hashBase := add(emptyPtr, 32)\n\n            mstore(emptyPtr, _SELECTORS)\n            // token0\n            if iszero(staticcall(gas(), caller(), emptyPtr, 4, hashBase, 32)) {\n                reRevert()\n            }\n            //token1\n            if iszero(\n                staticcall(gas(), caller(), add(emptyPtr, 4), 4, add(hashBase, 32), 32)\n            ) {\n                reRevert()\n            }\n            // fee\n            if iszero(\n                staticcall(gas(), caller(), add(emptyPtr, 8), 4, add(hashBase, 64), 32)\n            ) {\n                reRevert()\n            }\n\n            let token\n            let amount\n            switch sgt(amount0Delta, 0)\n            case 1 {\n                token := mload(hashBase)\n                amount := amount0Delta\n            }\n            default {\n                token := mload(add(hashBase, 32))\n                amount := amount1Delta\n            }\n            // let salt := keccak256(hashBase, 96)\n            mstore(emptyPtr, _FF_FACTORY)\n            mstore(resultPtr, keccak256(hashBase, 96)) // Compute the inner hash in-place\n            mstore(add(resultPtr, 32), _POOL_INIT_CODE_HASH)\n            let pool := and(keccak256(emptyPtr, 85), _ADDRESS_MASK)\n            if iszero(eq(pool, caller())) {\n                // if xor(pool, caller()) {\n                mstore(\n                    0,\n                    0xb2c0272200000000000000000000000000000000000000000000000000000000\n                ) // BadPool()\n                revert(0, 4)\n            }\n\n            // Calldata layout after adding flag:\n            // offset 132: data[0] = flag (32 bytes) - skipped by DexRouter\n            // offset 164: data[1] = payer (32 bytes)\n            // offset 196: data[2] = refundTo (32 bytes)\n            // offset 228: data[3] = transferMode (32 bytes)\n            let payer := calldataload(164)        // 132 + 32 = 164 (skip flag)\n            let transferMode := calldataload(228) // 164 + 64 = 228\n            mstore(emptyPtr, _SELECTORS)\n            switch eq(payer, address())\n            case 1 {\n                // token.safeTransfer(msg.sender,amount)\n                mstore(add(emptyPtr, 0x10), caller())\n                mstore(add(emptyPtr, 0x30), amount)\n                validateERC20Transfer(\n                    call(gas(), token, 0, add(emptyPtr, 0x0c), 0x44, 0, 0x20)\n                )\n                getBalanceAndTransfer(emptyPtr, token)\n            }\n            default {\n                // payer is not address(this), use transferMode\n                _transferTokenWithMode(token, transferMode, payer, caller(), amount)\n            }\n        }\n    }\n}"},"contracts/8/interfaces/IERC20Permit.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens,\n     * given `owner`'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"contracts/8/libraries/CommissionLib.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Constants.sol\";\nimport \"./CommonLib.sol\";\nimport \"../interfaces/IDexRouter.sol\";\n\nlibrary CommissionLib {\n    /// @notice swapCache.refundTo is not used in this function.\n    function doCommissionFromToken(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        IDexRouter.SwapCache memory swapCache,\n        uint256 fromTokenCommissionAmount,\n        bool hasTrim\n    ) internal returns (address middleReceiver, uint256 balanceBefore) {\n        if (commissionInfo.isToTokenCommission || hasTrim) {\n            middleReceiver = address(this);\n            balanceBefore = CommonLib.getBalanceOf(swapCache.toToken, address(this));\n        } else {\n            middleReceiver = swapCache.receiver;\n        }\n\n        if (commissionInfo.isFromTokenCommission) {\n            _doCommissionFromTokenInternal(commissionInfo, swapCache.payer, fromTokenCommissionAmount);\n        }\n    }\n\n    /// @notice For ERC20 fromToken non-toB commission with PERMIT2_SIGNATURE mode, the commission token has been transferred to referrers earlier than here.\n    ///         So for this situation, only need to emit event.\n    function _doCommissionFromTokenInternal(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address payer,\n        uint256 fromTokenCommissionAmount\n    ) private {\n        assembly (\"memory-safe\") {\n            // https://github.com/Vectorized/solady/blob/701406e8126cfed931645727b274df303fbcd94d/src/utils/FixedPointMathLib.sol#L595\n            function _mulDiv(x, y, d) -> z {\n                z := mul(x, y)\n                // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`.\n                if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) {\n                    mstore(0x00, 0xad251c27) // `MulDivFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := div(z, d)\n            }\n            function _safeSub(x, y) -> z {\n                if lt(x, y) {\n                    mstore(0x00, 0x46e72d03) // `SafeSubFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := sub(x, y)\n            }\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _sendETH(to, amount) {\n                if and(gt(amount, 0), iszero(eq(to, address()))) {\n                    let success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, to, amount, 0, 0, 0, 0)\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x0000001c20636f6d6d697373696f6e2077697468206574686572206572726f72,\n                            0x60\n                        ) // \"commission with ether error\"\n                    }\n                }\n            }\n            function _claimToken(token, _payer, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84))\n                mstore(\n                    freePtr,\n                    0x0a5ea46600000000000000000000000000000000000000000000000000000000\n                ) // claimTokens\n                mstore(add(freePtr, 0x04), token)\n                mstore(add(freePtr, 0x24), _payer)\n                mstore(add(freePtr, 0x44), to)\n                mstore(add(freePtr, 0x64), amount)\n                let success := call(\n                    gas(),\n                    _APPROVE_PROXY,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001420636c61696d20746f6b656e73206661696c65640000000000000000,\n                        0x58\n                    ) // \"claim tokens failed\"\n                }\n            }\n            function _sendToken(token, to, amount) {\n                if gt(amount, 0) {\n                    let freePtr := mload(0x40)\n                    mstore(0x40, add(freePtr, 0x44))\n                    mstore(\n                        freePtr,\n                        0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                    ) // transfer\n                    mstore(add(freePtr, 0x04), to)\n                    mstore(add(freePtr, 0x24), amount)\n                    let success := call(\n                        gas(),\n                        token,\n                        0,\n                        freePtr,\n                        0x44,\n                        0,\n                        0x20\n                    )\n                    if and(\n                        iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                        success\n                    ) {\n                        success := iszero(\n                            or(iszero(extcodesize(token)), returndatasize())\n                        )\n                    }\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x0000001c207472616e7366657220746f6b656e2072656665726572206661696c,\n                            0x60\n                        ) // \"transfer token referer fail\"\n                    }\n                }\n            }\n            function _getBalanceOfToken(token) -> tokenBalance {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x24))\n                mstore(\n                    freePtr,\n                    0x70a0823100000000000000000000000000000000000000000000000000000000\n                ) // balanceOf\n                // get token balance of address(this)\n                mstore(add(freePtr, 0x4), address())\n                let success := staticcall(\n                    gas(),\n                    token,\n                    freePtr,\n                    0x24,\n                    0,\n                    0x20\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x00000015206765742062616c616e63654f66206661696c656400000000000000,\n                        0x59\n                    ) // \"get balanceOf failed\"\n                }\n                tokenBalance := mload(0x00)\n            }\n            function _emitCommissionFromToken(token, amount, referrer, rate) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x80))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), amount)\n                mstore(add(freePtr, 0x40), referrer)\n                mstore(add(freePtr, 0x60), rate)\n                log1(\n                    freePtr,\n                    0x80,\n                    0xcd5eae9d9d0b96532bd1b7dbf6628ce436b2af735829087a03c548439f8bf850\n                ) //emit CommissionFromTokenRecord(address,uint256,address,uint256)\n            }\n            function _transferTokenDirect(token, from, to, amount) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x64)) // calldata size == 0x64\n                mstore(\n                    freePtr,\n                    0x23b872dd00000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint256)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                let success := call(\n                    gas(),\n                    token,\n                    0,\n                    freePtr,\n                    0x64,\n                    0,\n                    0x20\n                )\n                if and(\n                    iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                    success\n                ) {\n                    success := iszero(\n                        or(iszero(extcodesize(token)), returndatasize())\n                    )\n                }\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001b207472616e7366657220746f6b656e20646972656374206661696c00,\n                        0x5f\n                    ) // \"transfer token direct fail\"\n                }\n            }\n            function _transferTokenPermit2Allowance(token, from, to, amount) {\n                // Check if amount exceeds uint160 max\n                if shr(160, amount) {\n                    _revertWithReason(\n                        0x0000001120616d6f756e7420746f6f206c617267650000000000000000000000,\n                        0x55\n                    ) // \"amount too large\"\n                }\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x84)) // calldata size == 0x84\n                mstore(\n                    freePtr,\n                    0x36c7851600000000000000000000000000000000000000000000000000000000\n                ) // transferFrom(address,address,uint160,address)\n                mstore(add(freePtr, 0x04), from)\n                mstore(add(freePtr, 0x24), to)\n                mstore(add(freePtr, 0x44), amount)\n                mstore(add(freePtr, 0x64), token)\n                let success := call(\n                    gas(),\n                    _PERMIT2,\n                    0,\n                    freePtr,\n                    0x84,\n                    0,\n                    0\n                )\n                if eq(success, 0) {\n                    _revertWithReason(\n                        0x0000001c7065726d69743220616c6c6f77616e6365207472616e73206661696c,\n                        0x60\n                    ) // \"permit2 allowance trans fail\"\n                }\n            }\n            function _transferTokenWithMode(token, mode, _payer, to, amount) {\n                if gt(amount, 0) {\n                    // _payer has been set to address(this), means the token has been transferred to address(this).\n                    if eq(_payer, address()) {\n                        _sendToken(token, to, amount)\n                    }\n                    // _payer != address(this) && _payer != address(0), means the token has not been transferred yet.\n                    if iszero(or(eq(_payer, address()), eq(_payer, 0))) {\n                        switch mode\n                        case 0x0A00000000000000000000000000000000000000000000000000000000000000 { // _MODE_DIRECT\n                            _transferTokenDirect(token, _payer, to, amount)\n                        }\n                        case 0x0200000000000000000000000000000000000000000000000000000000000000 { // _MODE_PERMIT2_ALLOWANCE\n                            _transferTokenPermit2Allowance(token, _payer, to, amount)\n                        }\n                        case 0x0000000000000000000000000000000000000000000000000000000000000000 { // _MODE_LEGACY\n                            _claimToken(token, _payer, to, amount)\n                        }\n                        default {\n                            _revertWithReason(\n                                0x0000001520696e76616c6964207472616e73666572206d6f6465000000000000,\n                                0x5a\n                            ) // \"invalid transfer mode\"\n                        }\n                    }\n                }\n            }\n\n            let tokenWithMode := mload(add(commissionInfo, 0x40))\n            let mode := and(tokenWithMode, _TRANSFER_MODE_MASK)\n            let token := and(tokenWithMode, _ADDRESS_MASK)\n            let toBCommission := mload(add(commissionInfo, 0x60))\n            let totalRate := 0\n            let referrerNum := mload(add(commissionInfo, 0x80))\n            for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                totalRate := add(totalRate, rate)\n            }\n            if eq(token, _ETH) { // commission token is ETH, the process is same between no toB mode and toB mode\n                let sendAmount := 0\n                for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                    let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                    let referrer := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    let amount\n                    switch eq(i, sub(referrerNum, 1))\n                    case 1 {\n                        amount := sub(fromTokenCommissionAmount, sendAmount)\n                    }\n                    default {\n                        amount := _mulDiv(fromTokenCommissionAmount, rate, totalRate)\n                        sendAmount := add(sendAmount, amount)\n                    }\n                    _sendETH(referrer, amount)\n                    _emitCommissionFromToken(_ETH, amount, referrer, rate)\n                }\n            }\n            if iszero(eq(token, _ETH)) {\n                if and(eq(toBCommission, TO_B_MODE), eq(mode, _MODE_PERMIT2_SIGNATURE)) { // ToB mode && transferMode == _MODE_PERMIT2_SIGNATURE, the token should have been claimed to address(this)\n                    // require(payer == address(), \"invalid payer\");\n                    if iszero(eq(payer, address())) {\n                        _revertWithReason(\n                            0x0000000e20696e76616c69642070617965720000000000000000000000000000,\n                            0x52\n                        ) // \"invalid payer\"\n                    }\n                }\n                // ToB mode && transferMode != _MODE_PERMIT2_SIGNATURE, the token needs to be claimed from payer to address(this) first\n                if and(eq(toBCommission, TO_B_MODE), iszero(eq(mode, _MODE_PERMIT2_SIGNATURE))) {\n                    _transferTokenWithMode(token, mode, payer, address(), fromTokenCommissionAmount)\n                    payer := address()\n                    fromTokenCommissionAmount := _getBalanceOfToken(token)\n                }\n\n                // For ToC mode && transferMode == _MODE_PERMIT2_SIGNATURE, the commission has already been transferred via Permit2 batch transfer.\n                // In this case, we only need to emit events, not transfer again.\n                let skipTransfer := and(eq(toBCommission, NO_TO_B_MODE), eq(mode, _MODE_PERMIT2_SIGNATURE))\n\n                // Execute the transfer to referrers (or just emit events if skipTransfer is true)\n                let sendAmount := 0\n                for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                    let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                    let referrer := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n                    let amount\n                    switch eq(i, sub(referrerNum, 1))\n                    case 1 {\n                        amount := sub(fromTokenCommissionAmount, sendAmount)\n                    }\n                    default {\n                        amount := _mulDiv(fromTokenCommissionAmount, rate, totalRate)\n                        sendAmount := add(sendAmount, amount)\n                    }\n\n                    // Only transfer if not in PERMIT2_SIGNATURE && ToC mode case\n                    if iszero(skipTransfer) {\n                        _transferTokenWithMode(token, mode, payer, referrer, amount)\n                    }\n                    _emitCommissionFromToken(token, amount, referrer, rate)\n                }\n            }\n        }\n    }\n\n    function doCommissionAndTrimToToken(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address receiver,\n        uint256 balanceBefore,\n        address toToken,\n        IDexRouter.TrimInfo memory trimInfo\n    ) internal returns (uint256 totalAmount) {\n        if (!commissionInfo.isToTokenCommission && !trimInfo.hasTrim) {\n            return 0;\n        }\n        uint256 balanceAfter = CommonLib.getBalanceOf(toToken, address(this));\n        assembly (\"memory-safe\") {\n            // https://github.com/Vectorized/solady/blob/701406e8126cfed931645727b274df303fbcd94d/src/utils/FixedPointMathLib.sol#L595\n            function _mulDiv(x, y, d) -> z {\n                z := mul(x, y)\n                // Equivalent to `require(d != 0 && (y == 0 || x <= type(uint256).max / y))`.\n                if iszero(mul(or(iszero(x), eq(div(z, x), y)), d)) {\n                    mstore(0x00, 0xad251c27) // `MulDivFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := div(z, d)\n            }\n            function _safeSub(x, y) -> z {\n                if lt(x, y) {\n                    mstore(0x00, 0x46e72d03) // `SafeSubFailed()`.\n                    revert(0x1c, 0x04)\n                }\n                z := sub(x, y)\n            }\n            function _revertWithReason(m, len) {\n                mstore(\n                    0,\n                    0x08c379a000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(\n                    0x20,\n                    0x0000002000000000000000000000000000000000000000000000000000000000\n                )\n                mstore(0x40, m)\n                revert(0, len)\n            }\n            function _sendETH(to, amount) {\n                if and(gt(amount, 0), iszero(eq(to, address()))) {\n                    let success := call(NATIVE_TOKEN_TRANSFER_GAS_LIMIT, to, amount, 0, 0, 0, 0)\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x000000122073656e64206574686572206661696c656400000000000000000000,\n                            0x56\n                        ) // \"send ether failed\"\n                    }\n                }\n            }\n            function _sendToken(token, to, amount) {\n                if gt(amount, 0) {\n                    let freePtr := mload(0x40)\n                    mstore(0x40, add(freePtr, 0x44))\n                    mstore(\n                        freePtr,\n                        0xa9059cbb00000000000000000000000000000000000000000000000000000000\n                    ) // transfer\n                    mstore(add(freePtr, 0x04), to)\n                    mstore(add(freePtr, 0x24), amount)\n                    let success := call(\n                        gas(),\n                        token,\n                        0,\n                        freePtr,\n                        0x44,\n                        0,\n                        0x20\n                    )\n                    if and(\n                        iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))),\n                        success\n                    ) {\n                        success := iszero(\n                            or(iszero(extcodesize(token)), returndatasize())\n                        )\n                    }\n                    if eq(success, 0) {\n                        _revertWithReason(\n                            0x00000016207472616e7366657220746f6b656e206661696c6564000000000000,\n                            0x5a\n                        ) // \"transfer token failed\"\n                    }\n                }\n            }\n            function _emitCommissionToToken(token, amount, referrer, rate) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x80))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), amount)\n                mstore(add(freePtr, 0x40), referrer)\n                mstore(add(freePtr, 0x60), rate)\n                log1(\n                    freePtr,\n                    0x80,\n                    0x3cfb523a4c38d88561dd3bf04805a31715c8b5fc468a03b8d684356f360dea99\n                ) //emit CommissionToTokenRecord(address,uint256,address,uint256)\n            }\n            function _emitPositiveSlippageTrimRecord(token, trimAmount, trimAddress) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x60))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), trimAmount)\n                mstore(add(freePtr, 0x40), trimAddress)\n                log1(\n                    freePtr,\n                    0x60,\n                    0x7bec7d55a62a7a7b8068f1533e2a3bbf727b3e2e57f30c576fe159da60e09a65\n                ) // emit PositiveSlippageTrimRecord(address,uint256,address)\n            }\n            function _emitPositiveSlippageChargeRecord(token, chargeAmount, chargeAddress) {\n                let freePtr := mload(0x40)\n                mstore(0x40, add(freePtr, 0x60))\n                mstore(freePtr, token)\n                mstore(add(freePtr, 0x20), chargeAmount)\n                mstore(add(freePtr, 0x40), chargeAddress)\n                log1(\n                    freePtr,\n                    0x60,\n                    0xfd08115c8e43d2a49d95ee18d7f69b8bbac60bd368c73cf22d30664a22a0626d\n                ) // emit PositiveSlippageChargeRecord(address,uint256,address)\n            }\n            function _processCommission(commissionInfo_, toToken_, inputAmount) -> commissionAmount {\n                let referrerNum := mload(add(commissionInfo_, 0x80)) // commissionInfo.referrerNum\n                commissionAmount := 0\n                switch eq(toToken_, _ETH)\n                case 1 { // commission token is ETH\n                    for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                        let rate := mload(add(commissionInfo_, add(0xa0, mul(i, 0x40))))\n                        let amount := _mulDiv(inputAmount, rate, COMMISSION_DENOMINATOR_1E9)\n                        let referrer := mload(add(commissionInfo_, add(0xc0, mul(i, 0x40))))\n                        _sendETH(referrer, amount)\n                        _emitCommissionToToken(_ETH, amount, referrer, rate)\n                        commissionAmount := add(commissionAmount, amount)\n                    }\n                }\n                default { // commission token is ERC20\n                    for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                        let rate := mload(add(commissionInfo_, add(0xa0, mul(i, 0x40))))\n                        let amount := _mulDiv(inputAmount, rate, COMMISSION_DENOMINATOR_1E9)\n                        let referrer := mload(add(commissionInfo_, add(0xc0, mul(i, 0x40))))\n                        _sendToken(toToken_, referrer, amount)\n                        _emitCommissionToToken(toToken_, amount, referrer, rate)\n                        commissionAmount := add(commissionAmount, amount)\n                    }\n                }\n            } \n            function _processTrim(trimInfo_, toToken_, inputAmount) -> trimAmount {\n                let trimRate := mload(add(trimInfo_, 0x20)) // trimInfo.trimRate\n                let chargeRate := mload(add(trimInfo_, 0xa0)) // trimInfo.chargeRate\n\n                // uint256 trimAmount = inputAmount - trimInfo.expectAmountOut;\n                let expectAmountOut := mload(add(trimInfo_, 0x80)) // trimInfo.expectAmountOut\n                trimAmount := sub(inputAmount, expectAmountOut)\n                // uint256 allowedMaxTrimAmount = inputAmount * trimInfo.trimRate / TRIM_DENOMINATOR_1E3;\n                let allowedMaxTrimAmount := _mulDiv(inputAmount, trimRate, TRIM_DENOMINATOR_1E3)\n                // trimAmount = min(trimAmount, allowedMaxTrimAmount)\n                if gt(trimAmount, allowedMaxTrimAmount) {\n                    trimAmount := allowedMaxTrimAmount\n                }\n\n                // send token and emit events\n                // actualChargeAmount = trimAmount * chargeRate / TRIM_DENOMINATOR_1E3\n                let actualChargeAmount := _mulDiv(trimAmount, chargeRate, TRIM_DENOMINATOR_1E3)\n                // actualTrimAmount = trimAmount - actualChargeAmount\n                let actualTrimAmount := sub(trimAmount, actualChargeAmount)\n                switch eq(toToken_, _ETH)\n                case 1 { // commission token is ETH\n                    let trimAddress := mload(add(trimInfo_, 0x40)) // trimInfo.trimAddress\n                    _sendETH(trimAddress, actualTrimAmount)\n                    _emitPositiveSlippageTrimRecord(_ETH, actualTrimAmount, trimAddress)\n\n                    let chargeAddress := mload(add(trimInfo_, 0xc0)) // trimInfo.chargeAddress\n                    _sendETH(chargeAddress, actualChargeAmount)\n                    _emitPositiveSlippageChargeRecord(_ETH, actualChargeAmount, chargeAddress)\n                }\n                case 0 { // commission token is ERC20\n                    let trimAddress := mload(add(trimInfo_, 0x40)) // trimInfo.trimAddress\n                    _sendToken(toToken_, trimAddress, actualTrimAmount)\n                    _emitPositiveSlippageTrimRecord(toToken_, actualTrimAmount, trimAddress)\n\n                    let chargeAddress := mload(add(trimInfo_, 0xc0)) // trimInfo.chargeAddress\n                    _sendToken(toToken_, chargeAddress, actualChargeAmount)\n                    _emitPositiveSlippageChargeRecord(toToken_, actualChargeAmount, chargeAddress)\n                }\n            }\n\n            // require(balanceAfter > balanceBefore, \"invalid balance after\");\n            if or(gt(balanceBefore, balanceAfter), eq(balanceAfter, balanceBefore)) {\n                _revertWithReason(\n                    0x0000001620696e76616c69642062616c616e6365206166746572000000000000,\n                    0x5a\n                ) // \"invalid balance after\"\n            }\n            let inputAmount := sub(balanceAfter, balanceBefore)\n\n            // process commission\n            let flag := mload(add(commissionInfo, 0x20)) // commissionInfo.isToTokenCommission\n            if gt(flag, 0) { // commissionInfo.isToTokenCommission == True\n                let commissionAmount := _processCommission(commissionInfo, toToken, inputAmount)\n                inputAmount := sub(inputAmount, commissionAmount)\n                totalAmount := commissionAmount\n            }\n\n            // process trim\n            flag := mload(add(trimInfo, 0x00)) // trimInfo.hasTrim\n            let expectAmountOut := mload(add(trimInfo, 0x80)) // trimInfo.expectAmountOut\n            if and(gt(flag, 0), gt(inputAmount, expectAmountOut)) { // trimInfo.hasTrim == True && inputAmount > trimInfo.expectAmountOut\n                let trimAmount := _processTrim(trimInfo, toToken, inputAmount)\n                inputAmount := sub(inputAmount, trimAmount)\n                totalAmount := add(totalAmount, trimAmount)\n            }\n\n            // transfer toToken to receiver\n            switch eq(toToken, _ETH)\n            case 1 {\n                _sendETH(shr(96, shl(96, receiver)), inputAmount)\n            }\n            default {\n                _sendToken(toToken, shr(96, shl(96, receiver)), inputAmount)\n            }\n        }\n    }\n\n    function validateCommissionInfo(\n        IDexRouter.CommissionInfo memory commissionInfo,\n        address fromToken,\n        address toToken,\n        uint256 mode\n    ) internal pure {\n        if (mode == _MODE_NO_TRANSFER && commissionInfo.isFromTokenCommission) {\n            revert(\"From commission not support for NO_TRANSFER mode\");\n        }\n\n        if (mode == _MODE_BY_INVEST && (commissionInfo.isFromTokenCommission || commissionInfo.isToTokenCommission)) {\n            revert(\"Commission not support for BY_INVEST mode\");\n        }\n\n        if (fromToken == toToken) {\n            revert(\"Invalid tokens\");\n        }\n\n        if (commissionInfo.isFromTokenCommission && commissionInfo.isToTokenCommission) {\n            revert(\"Invalid commission direction\");\n        }\n\n        address token = CommonLib.bytes32ToAddress(commissionInfo.tokenWithMode);\n        require(\n            (commissionInfo.isFromTokenCommission && token == fromToken)\n                || (commissionInfo.isToTokenCommission && token == toToken)\n                || (!commissionInfo.isFromTokenCommission && !commissionInfo.isToTokenCommission),\n            \"Invalid commission info\"\n        );\n\n        uint256 totalRate = calculateTotalRate(commissionInfo);\n        require(totalRate <= COMMISSION_RATE_LIMIT, \"Invalid commission rate\");\n\n        // Validate referrer addresses are not zero\n        for (uint256 i = 0; i < commissionInfo.commissionLength; ++i) {\n            address referrerAddress;\n            assembly (\"memory-safe\") {\n                referrerAddress := mload(add(commissionInfo, add(0xc0, mul(i, 0x40))))\n            }\n            require(referrerAddress != address(0), \"Invalid referrer address\");\n        }\n    }\n\n    function calculateTotalRate(IDexRouter.CommissionInfo memory commissionInfo) internal pure returns (uint256 totalRate) {\n        assembly (\"memory-safe\") {\n            let referrerNum := mload(add(commissionInfo, 0x80))\n            for { let i := 0 } lt(i, referrerNum) { i := add(i, 1) } {\n                let rate := mload(add(commissionInfo, add(0xa0, mul(i, 0x40))))\n                totalRate := add(totalRate, rate)\n            }\n        }\n    }\n}"},"contracts/8/interfaces/IApproveProxy.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IApproveProxy {\n    function isAllowedProxy(address _proxy) external view returns (bool);\n\n    function claimTokens(\n        address token,\n        address who,\n        address dest,\n        uint256 amount\n    ) external;\n\n    function tokenApprove() external view returns (address);\n    function addProxy(address) external;\n}\n"},"contracts/8/interfaces/IDaiLikePermit.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Interface for DAI-style permits\ninterface IDaiLikePermit {\n    function permit(\n        address holder,\n        address spender,\n        uint256 nonce,\n        uint256 expiry,\n        bool allowed,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n}\n"},"contracts/8/interfaces/permit2/IEIP712.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IEIP712 {\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"},"contracts/8/libraries/PausableModuleV2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/**\n * @title PausableModuleV2 - Lightweight pause control module\n * @notice Abstract contract providing pause functionality with Owner and Reporter roles\n * @dev This is a gas-optimized implementation with zero external dependencies\n *      Storage optimization: address owner and uint64 pauseUntil are packed into the same slot\n */\nabstract contract PausableModuleV2 {\n    // ============ Constant Variables ============\n\n    /// @notice Zero address constant used for address validation\n    address private constant ZERO_ADDRESS = address(0);\n\n    /// @notice Value indicating contract is not paused\n    /// @dev Using 1 instead of 0 for gas optimization (avoids expensive zero->non-zero SSTORE)\n    uint64 private constant NOT_PAUSED = 1;\n\n    /// @notice Value indicating contract is paused by owner\n    uint64 private constant OWNER_PAUSED = type(uint64).max;\n\n    /// @notice Reporter pause duration (24 hours)\n    uint256 private constant REPORTER_PAUSE_DURATION = 24 hours;\n\n    // ============ Mutable State Variables ============\n\n    /// @notice Contract owner address\n    /// @dev Packed with pauseUntil in the same storage slot\n    address public owner;\n\n    /// @notice Pause state timestamp\n    /// @dev NOT_PAUSED (1) = not paused, type(uint64).max = owner paused, timestamp = reporter paused\n    /// @dev Packed with owner in the same storage slot\n    uint64 public pauseUntil = NOT_PAUSED;\n\n    /// @notice Mapping of reporter addresses\n    mapping(address => bool) public reporters;\n\n\n    // ============ Custom Errors ============\n\n    /// @notice Thrown when contract is already paused\n    error AlreadyPaused();\n\n    /// @notice Thrown when contract is already paused by owner\n    /// @dev This error is thrown when owner tries to pause an already owner-paused contract\n    error AlreadyPausedByOwner();\n\n    /// @notice Thrown when reporter state is already set\n    error AlreadySet();\n\n    /// @notice Thrown when caller is not the owner\n    error NotOwner();\n\n    /// @notice Thrown when caller is not a reporter\n    error NotReporter();\n\n    /// @notice Thrown when contract is not paused\n    error NotPaused();\n\n    /// @notice Thrown when zero address is provided\n    error ZeroAddress();\n\n    // ============ Events ============\n\n    /// @notice Emitted when ownership is transferred\n    /// @param previousOwner Previous owner address\n    /// @param newOwner New owner address\n    event OwnerChanged(address indexed previousOwner, address indexed newOwner);\n\n    /// @notice Emitted when a reporter is added or removed\n    /// @param reporter Reporter address\n    /// @param added True if added, false if removed\n    event ReporterUpdated(address indexed reporter, bool added);\n\n    /// @notice Emitted when contract is paused by owner\n    event OwnerPaused();\n\n    /// @notice Emitted when contract is unpaused by owner\n    event OwnerUnpaused();\n\n    /// @notice Emitted when contract is paused by reporter\n    /// @param reporter Reporter address that triggered the pause\n    /// @param until Timestamp when pause will automatically expire\n    event ReporterPaused(address indexed reporter, uint64 until);\n\n    // ============ Modifiers ============\n\n    /// @notice Modifier to ensure contract is not paused\n    modifier whenNotPaused() {\n        if (block.timestamp < pauseUntil) revert AlreadyPaused();\n        _;\n    }\n\n    /// @notice Modifier to restrict access to owner only\n    modifier onlyOwner() {\n        if (msg.sender != owner) revert NotOwner();\n        _;\n    }\n\n    /// @notice Modifier to restrict access to reporters only\n    modifier onlyReporter() {\n        if (!reporters[msg.sender]) revert NotReporter();\n        _;\n    }\n\n    // ============ Constructor ============\n\n    /// @notice Constructor to initialize the contract with an owner\n    /// @param _owner Initial owner address\n    constructor(address _owner) {\n        if (_owner == ZERO_ADDRESS) revert ZeroAddress();\n        owner = _owner;\n    }\n\n    // ============ Owner Functions ============\n\n    /// @notice Transfer ownership to a new address\n    /// @dev Only callable by the current owner\n    /// @dev Emits OwnerChanged event with previousOwner (current owner) and newOwner\n    /// @param newOwner New owner address\n    function transferOwnership(address newOwner) external onlyOwner {\n        if (newOwner == ZERO_ADDRESS) revert ZeroAddress();\n        address previousOwner = owner;\n        owner = newOwner;\n        emit OwnerChanged(previousOwner, newOwner);\n    }\n\n    /// @notice Add or remove a reporter\n    /// @dev Only callable by the owner\n    /// @param reporter Reporter address to add or remove\n    /// @param added True to add, false to remove\n    function setReporter(address reporter, bool added) external onlyOwner {\n        if (reporter == ZERO_ADDRESS) revert ZeroAddress();\n        if (reporters[reporter] == added) revert AlreadySet();\n        reporters[reporter] = added;\n        emit ReporterUpdated(reporter, added);\n    }\n\n    /// @notice Pause the contract (until manually unpaused by owner)\n    /// @dev Only callable by the owner\n    /// @dev Sets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pause\n    /// @dev Reverts if contract is already paused by owner\n    /// @dev Owner can override reporter pause (temporary pause) by calling this function\n    function pause() external onlyOwner {\n        if(pauseUntil == OWNER_PAUSED) revert AlreadyPausedByOwner();\n\n        pauseUntil = OWNER_PAUSED;\n        emit OwnerPaused();\n    }\n\n    /// @notice Unpause the contract\n    /// @dev Only callable by the owner\n    /// @dev Resets pauseUntil to NOT_PAUSED, clearing both owner and reporter pauses\n    /// @dev Reverts if contract is not paused\n    /// @dev Gas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause\n    function unpause() external onlyOwner {\n        if(!isPaused()) revert NotPaused();\n\n        pauseUntil = NOT_PAUSED;\n        emit OwnerUnpaused();\n    }\n\n    // ============ Reporter Functions ============\n\n    /// @notice Pause the contract for 24 hours\n    /// @dev Only callable by a reporter\n    /// @dev Reverts if contract is already paused\n    /// @dev Sets pauseUntil to block.timestamp + 24 hours\n    function pauseByReporter() external onlyReporter whenNotPaused {\n        pauseUntil = uint64(block.timestamp + REPORTER_PAUSE_DURATION);\n        emit ReporterPaused(msg.sender, pauseUntil);\n    }\n\n    // ============ View Functions ============\n\n    /// @notice Check if the contract is currently paused\n    /// @return True if paused, false otherwise\n    /// @dev Returns true if block.timestamp < pauseUntil\n    function isPaused() public view returns (bool) {\n        return block.timestamp < pauseUntil;\n    }\n}"},"contracts/8/interfaces/permit2/IPermit2.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ISignatureTransfer} from \"./ISignatureTransfer.sol\";\nimport {IAllowanceTransfer} from \"./IAllowanceTransfer.sol\";\n\n/// @notice Permit2 handles signature-based transfers in SignatureTransfer and allowance-based transfers in AllowanceTransfer.\n/// @dev Users must approve Permit2 before calling any of the transfer functions.\ninterface IPermit2 is ISignatureTransfer, IAllowanceTransfer {\n// IPermit2 unifies the two interfaces so users have maximal flexibility with their approval.\n}\n"},"contracts/8/libraries/RevertReasonForwarder.sol":{"content":"/// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nlibrary RevertReasonForwarder {\n    function reRevert() internal pure {\n        // bubble up revert reason from latest external call\n        /// @solidity memory-safe-assembly\n        assembly { // solhint-disable-line no-inline-assembly\n            let ptr := mload(0x40)\n            returndatacopy(ptr, 0, returndatasize())\n            revert(ptr, returndatasize())\n        }\n    }\n}"},"contracts/8/libraries/UniswapTokenInfoHelper.sol":{"content":"/// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Constants.sol\";\nimport {IUni} from \"../interfaces/IUni.sol\";\nimport {IUniV3} from \"../interfaces/IUniV3.sol\";\n\n/// @title UniswapTokenInfoHelper\n/// @notice Helper functions for getting fromToken and toToken from\n/// encoded pools array of unxswap and uniswapV3Swap methods.\n/// @dev This contract will be used in DexRouter. So the\n/// masks are re-defined here and keep the same as in the original contracts.\nlibrary UniswapTokenInfoHelper {\n    function getUnxswapTokenInfo(bool sendValue, bytes32[] calldata pools)\n        internal\n        view\n        returns (address fromToken, address toToken)\n    {\n        require(pools.length > 0, \"pools must be greater than 0\");\n\n        // get fromToken\n        address firstPoolAddr = address(uint160(uint256(pools[0]) & _ADDRESS_MASK));\n        // default: token0 to token1; reverse: token1 to token0\n        bool firstReversed = (uint256(pools[0]) & _REVERSE_MASK) != 0;\n        fromToken = firstReversed ? IUni(firstPoolAddr).token1() : IUni(firstPoolAddr).token0();\n        if (fromToken == _WETH && sendValue) {\n            fromToken = _ETH;\n        }\n        require(!sendValue || fromToken == _ETH, \"msg.value should be zero\");\n\n        // get toToken\n        bytes32 lastPool = pools[pools.length - 1];\n        address lastPoolAddr = address(uint160(uint256(lastPool) & _ADDRESS_MASK));\n        bool lastReversed = (uint256(lastPool) & _REVERSE_MASK) != 0;\n        toToken = lastReversed ? IUni(lastPoolAddr).token0() : IUni(lastPoolAddr).token1();\n        bool isWeth = (uint256(lastPool) & _WETH_MASK) != 0; // unwrap weth to eth eventually\n        if (toToken == _WETH && isWeth) {\n            toToken = _ETH;\n        }\n    }\n\n\n    function getUniswapV3TokenInfo(bool sendValue, uint256[] calldata pools)\n        internal\n        view\n        returns (address fromToken, address toToken)\n    {\n        require(pools.length > 0, \"pools must be greater than 0\");\n\n        // get fromToken\n        address firstPoolAddr = address(uint160(pools[0] & _ADDRESS_MASK));\n        bool firstZeroForOne = (pools[0] & _ONE_FOR_ZERO_MASK) == 0;\n        fromToken = firstZeroForOne ? IUniV3(firstPoolAddr).token0() : IUniV3(firstPoolAddr).token1();\n        if (fromToken == _WETH && sendValue) {\n            fromToken = _ETH;\n        }\n        require(!sendValue || fromToken == _ETH, \"msg.value should be zero\");\n\n        // get toToken\n        uint256 lastPool = pools[pools.length - 1];\n        address lastPoolAddr = address(uint160(lastPool & _ADDRESS_MASK));\n        bool lastZeroForOne = (lastPool & _ONE_FOR_ZERO_MASK) == 0;\n        toToken = lastZeroForOne ? IUniV3(lastPoolAddr).token1() : IUniV3(lastPoolAddr).token0();\n        bool unwrapWeth = (lastPool & _WETH_UNWRAP_MASK) != 0; // unwrap weth to eth eventually\n        if (toToken == _WETH && unwrapWeth) {\n            toToken = _ETH;\n        }\n    }\n}"},"contracts/8/interfaces/IUniswapV3SwapCallback.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n/// @title Callback for IUniswapV3PoolActions#swap\n/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface\ninterface IUniswapV3SwapCallback {\n    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.\n    /// @dev In the implementation you must pay the pool tokens owed for the swap.\n    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.\n    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.\n    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.\n    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by\n    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.\n    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call\n    function uniswapV3SwapCallback(\n        int256 amount0Delta,\n        int256 amount1Delta,\n        bytes calldata data\n    ) external;\n}\n"},"contracts/8/interfaces/permit2/IAllowanceTransfer.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IEIP712} from \"./IEIP712.sol\";\n\n/// @title AllowanceTransfer\n/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts\n/// @dev Requires user's token approval on the Permit2 contract\ninterface IAllowanceTransfer is IEIP712 {\n    /// @notice Thrown when an allowance on a token has expired.\n    /// @param deadline The timestamp at which the allowed amount is no longer valid\n    error AllowanceExpired(uint256 deadline);\n\n    /// @notice Thrown when an allowance on a token has been depleted.\n    /// @param amount The maximum amount allowed\n    error InsufficientAllowance(uint256 amount);\n\n    /// @notice Thrown when too many nonces are invalidated.\n    error ExcessiveInvalidation();\n\n    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.\n    event NonceInvalidation(\n        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce\n    );\n\n    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.\n    event Approval(\n        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration\n    );\n\n    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.\n    event Permit(\n        address indexed owner,\n        address indexed token,\n        address indexed spender,\n        uint160 amount,\n        uint48 expiration,\n        uint48 nonce\n    );\n\n    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.\n    event Lockdown(address indexed owner, address token, address spender);\n\n    /// @notice The permit data for a token\n    struct PermitDetails {\n        // ERC20 token address\n        address token;\n        // the maximum amount allowed to spend\n        uint160 amount;\n        // timestamp at which a spender's token allowances become invalid\n        uint48 expiration;\n        // an incrementing value indexed per owner,token,and spender for each signature\n        uint48 nonce;\n    }\n\n    /// @notice The permit message signed for a single token allowance\n    struct PermitSingle {\n        // the permit data for a single token alownce\n        PermitDetails details;\n        // address permissioned on the allowed tokens\n        address spender;\n        // deadline on the permit signature\n        uint256 sigDeadline;\n    }\n\n    /// @notice The permit message signed for multiple token allowances\n    struct PermitBatch {\n        // the permit data for multiple token allowances\n        PermitDetails[] details;\n        // address permissioned on the allowed tokens\n        address spender;\n        // deadline on the permit signature\n        uint256 sigDeadline;\n    }\n\n    /// @notice The saved permissions\n    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message\n    /// @dev Setting amount to type(uint160).max sets an unlimited approval\n    struct PackedAllowance {\n        // amount allowed\n        uint160 amount;\n        // permission expiry\n        uint48 expiration;\n        // an incrementing value indexed per owner,token,and spender for each signature\n        uint48 nonce;\n    }\n\n    /// @notice A token spender pair.\n    struct TokenSpenderPair {\n        // the token the spender is approved\n        address token;\n        // the spender address\n        address spender;\n    }\n\n    /// @notice Details for a token transfer.\n    struct AllowanceTransferDetails {\n        // the owner of the token\n        address from;\n        // the recipient of the token\n        address to;\n        // the amount of the token\n        uint160 amount;\n        // the token to be transferred\n        address token;\n    }\n\n    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.\n    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]\n    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.\n    function allowance(address user, address token, address spender)\n        external\n        view\n        returns (uint160 amount, uint48 expiration, uint48 nonce);\n\n    /// @notice Approves the spender to use up to amount of the specified token up until the expiration\n    /// @param token The token to approve\n    /// @param spender The spender address to approve\n    /// @param amount The approved amount of the token\n    /// @param expiration The timestamp at which the approval is no longer valid\n    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve\n    /// @dev Setting amount to type(uint160).max sets an unlimited approval\n    function approve(address token, address spender, uint160 amount, uint48 expiration) external;\n\n    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature\n    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce\n    /// @param owner The owner of the tokens being approved\n    /// @param permitSingle Data signed over by the owner specifying the terms of approval\n    /// @param signature The owner's signature over the permit data\n    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;\n\n    /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature\n    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce\n    /// @param owner The owner of the tokens being approved\n    /// @param permitBatch Data signed over by the owner specifying the terms of approval\n    /// @param signature The owner's signature over the permit data\n    function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;\n\n    /// @notice Transfer approved tokens from one address to another\n    /// @param from The address to transfer from\n    /// @param to The address of the recipient\n    /// @param amount The amount of the token to transfer\n    /// @param token The token address to transfer\n    /// @dev Requires the from address to have approved at least the desired amount\n    /// of tokens to msg.sender.\n    function transferFrom(address from, address to, uint160 amount, address token) external;\n\n    /// @notice Transfer approved tokens in a batch\n    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers\n    /// @dev Requires the from addresses to have approved at least the desired amount\n    /// of tokens to msg.sender.\n    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;\n\n    /// @notice Enables performing a \"lockdown\" of the sender's Permit2 identity\n    /// by batch revoking approvals\n    /// @param approvals Array of approvals to revoke.\n    function lockdown(TokenSpenderPair[] calldata approvals) external;\n\n    /// @notice Invalidate nonces for a given (token, spender) pair\n    /// @param token The token to invalidate nonces for\n    /// @param spender The spender to invalidate nonces for\n    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.\n    /// @dev Can't invalidate more than 2**16 nonces per transaction.\n    function invalidateNonces(address token, address spender, uint48 newNonce) external;\n}\n"},"contracts/8/interfaces/permit2/ISignatureTransfer.sol":{"content":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IEIP712} from \"./IEIP712.sol\";\n\n/// @title SignatureTransfer\n/// @notice Handles ERC20 token transfers through signature based actions\n/// @dev Requires user's token approval on the Permit2 contract\ninterface ISignatureTransfer is IEIP712 {\n    /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount\n    /// @param maxAmount The maximum amount a spender can request to transfer\n    error InvalidAmount(uint256 maxAmount);\n\n    /// @notice Thrown when the number of tokens permissioned to a spender does not match the number of tokens being transferred\n    /// @dev If the spender does not need to transfer the number of tokens permitted, the spender can request amount 0 to be transferred\n    error LengthMismatch();\n\n    /// @notice Emits an event when the owner successfully invalidates an unordered nonce.\n    event UnorderedNonceInvalidation(address indexed owner, uint256 word, uint256 mask);\n\n    /// @notice The token and amount details for a transfer signed in the permit transfer signature\n    struct TokenPermissions {\n        // ERC20 token address\n        address token;\n        // the maximum amount that can be spent\n        uint256 amount;\n    }\n\n    /// @notice The signed permit message for a single token transfer\n    struct PermitTransferFrom {\n        TokenPermissions permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice Specifies the recipient address and amount for batched transfers.\n    /// @dev Recipients and amounts correspond to the index of the signed token permissions array.\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount.\n    struct SignatureTransferDetails {\n        // recipient address\n        address to;\n        // spender requested amount\n        uint256 requestedAmount;\n    }\n\n    /// @notice Used to reconstruct the signed permit message for multiple token transfers\n    /// @dev Do not need to pass in spender address as it is required that it is msg.sender\n    /// @dev Note that a user still signs over a spender address\n    struct PermitBatchTransferFrom {\n        // the tokens and corresponding amounts permitted for a transfer\n        TokenPermissions[] permitted;\n        // a unique value for every token owner's signature to prevent signature replays\n        uint256 nonce;\n        // deadline on the permit signature\n        uint256 deadline;\n    }\n\n    /// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection\n    /// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order\n    /// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce\n    /// @dev It returns a uint256 bitmap\n    /// @dev The index, or wordPosition is capped at type(uint248).max\n    function nonceBitmap(address, uint256) external view returns (uint256);\n\n    /// @notice Transfers a token using a signed permit message\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers a token using a signed permit message\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @dev Reverts if the requested amount is greater than the permitted signed amount\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails The spender's requested transfer details for the permitted token\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitTransferFrom memory permit,\n        SignatureTransferDetails calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param signature The signature to verify\n    function permitTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Transfers multiple tokens using a signed permit message\n    /// @dev The witness type string must follow EIP712 ordering of nested structs and must include the TokenPermissions type definition\n    /// @notice Includes extra data provided by the caller to verify signature over\n    /// @param permit The permit data signed over by the owner\n    /// @param owner The owner of the tokens to transfer\n    /// @param transferDetails Specifies the recipient and requested amount for the token transfer\n    /// @param witness Extra data to include when checking the user signature\n    /// @param witnessTypeString The EIP-712 type definition for remaining string stub of the typehash\n    /// @param signature The signature to verify\n    function permitWitnessTransferFrom(\n        PermitBatchTransferFrom memory permit,\n        SignatureTransferDetails[] calldata transferDetails,\n        address owner,\n        bytes32 witness,\n        string calldata witnessTypeString,\n        bytes calldata signature\n    ) external;\n\n    /// @notice Invalidates the bits specified in mask for the bitmap at the word position\n    /// @dev The wordPos is maxed at type(uint248).max\n    /// @param wordPos A number to index the nonceBitmap at\n    /// @param mask A bitmap masked against msg.sender's current bitmap at the word position\n    function invalidateUnorderedNonces(uint256 wordPos, uint256 mask) external;\n}\n"},"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol":{"content":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"}},"language":"Solidity","settings":{"viaIR":false,"metadata":{"bytecodeHash":"ipfs","useLiteralContent":false},"libraries":{"contracts/8/DexRouter.sol":{"DagRouter":"0x408fab3aafc590d99b09e6ad13ad5df73b066526","UnxswapRouter":"0x14d28f43301a5a6277afad65e9817e0a12ea0fec","SwapWrapRouter":"0x057d1e699296cced17696c442e637dca69b34e1a","SmartSwapRouter":"0xbf0824d673a73c67287059fd351794284646b8d7","UnxswapV3Router":"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f"}},"optimizer":{"runs":200,"enabled":true},"evmVersion":"london","remappings":["@ensdomains/=node_modules/@ensdomains/","@openzeppelin/=node_modules/@openzeppelin/","ds-test/=lib/forge-std/lib/ds-test/src/","eth-gas-reporter/=node_modules/eth-gas-reporter/","forge-std/=lib/forge-std/src/","hardhat/=node_modules/hardhat/","@dex/=contracts/8/","@dex-exactout/=contracts/exactout/","@uniswap/=node_modules/@uniswap/","@zetachain/=node_modules/@zetachain/"]}},"stdJsonOutput":{"sources":{"contracts/8/DexRouter.sol":{"id":0},"contracts/8/interfaces/IUni.sol":{"id":7},"contracts/8/interfaces/IWETH.sol":{"id":10},"contracts/8/libraries/PMMLib.sol":{"id":23},"contracts/8/router/DagRouter.sol":{"id":31},"contracts/8/interfaces/IERC20.sol":{"id":5},"contracts/8/interfaces/IUniV3.sol":{"id":8},"contracts/8/libraries/Address.sol":{"id":15},"contracts/8/libraries/TrimLib.sol":{"id":29},"contracts/8/libraries/EventLib.sol":{"id":21},"contracts/8/libraries/SafeMath.sol":{"id":27},"contracts/8/interfaces/IAdapter.sol":{"id":1},"contracts/8/libraries/CommonLib.sol":{"id":18},"contracts/8/libraries/Constants.sol":{"id":19},"contracts/8/libraries/SafeERC20.sol":{"id":26},"contracts/8/router/UnxswapRouter.sol":{"id":34},"contracts/8/interfaces/IDexRouter.sol":{"id":4},"contracts/8/libraries/ChainConfig.sol":{"id":16},"contracts/8/libraries/EthReceiver.sol":{"id":20},"contracts/8/libraries/TransferLib.sol":{"id":28},"contracts/8/router/SwapWrapRouter.sol":{"id":33},"contracts/8/libraries/ExtraDataLib.sol":{"id":22},"contracts/8/router/SmartSwapRouter.sol":{"id":32},"contracts/8/router/UnxswapV3Router.sol":{"id":35},"contracts/8/interfaces/IERC20Permit.sol":{"id":6},"contracts/8/libraries/CommissionLib.sol":{"id":17},"contracts/8/interfaces/IApproveProxy.sol":{"id":2},"contracts/8/interfaces/IDaiLikePermit.sol":{"id":3},"contracts/8/interfaces/permit2/IEIP712.sol":{"id":12},"contracts/8/libraries/PausableModuleV2.sol":{"id":24},"contracts/8/interfaces/permit2/IPermit2.sol":{"id":13},"contracts/8/libraries/RevertReasonForwarder.sol":{"id":25},"contracts/8/libraries/UniswapTokenInfoHelper.sol":{"id":30},"contracts/8/interfaces/IUniswapV3SwapCallback.sol":{"id":9},"contracts/8/interfaces/permit2/IAllowanceTransfer.sol":{"id":11},"contracts/8/interfaces/permit2/ISignatureTransfer.sol":{"id":14},"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol":{"id":36}},"contracts":{"contracts/8/DexRouter.sol":{"DexRouter":{"abi":[{"type":"constructor","inputs":[{"name":"_owner","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"name":"AlreadyPaused","type":"error","inputs":[]},{"name":"AlreadyPausedByOwner","type":"error","inputs":[]},{"name":"AlreadySet","type":"error","inputs":[]},{"name":"NotOwner","type":"error","inputs":[]},{"name":"NotPaused","type":"error","inputs":[]},{"name":"NotReporter","type":"error","inputs":[]},{"name":"ZeroAddress","type":"error","inputs":[]},{"name":"OwnerChanged","type":"event","inputs":[{"name":"previousOwner","type":"address","indexed":true,"internalType":"address"},{"name":"newOwner","type":"address","indexed":true,"internalType":"address"}],"anonymous":false},{"name":"OwnerPaused","type":"event","inputs":[],"anonymous":false},{"name":"OwnerUnpaused","type":"event","inputs":[],"anonymous":false},{"name":"ReporterPaused","type":"event","inputs":[{"name":"reporter","type":"address","indexed":true,"internalType":"address"},{"name":"until","type":"uint64","indexed":false,"internalType":"uint64"}],"anonymous":false},{"name":"ReporterUpdated","type":"event","inputs":[{"name":"reporter","type":"address","indexed":true,"internalType":"address"},{"name":"added","type":"bool","indexed":false,"internalType":"bool"}],"anonymous":false},{"name":"dagSwapByOrderId","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"paths","type":"tuple[]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"dagSwapTo","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"paths","type":"tuple[]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"isPaused","type":"function","inputs":[],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"owner","type":"function","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"name":"pause","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"pauseByReporter","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"pauseUntil","type":"function","inputs":[],"outputs":[{"name":"","type":"uint64","internalType":"uint64"}],"stateMutability":"view"},{"name":"reporters","type":"function","inputs":[{"name":"","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"name":"setReporter","type":"function","inputs":[{"name":"reporter","type":"address","internalType":"address"},{"name":"added","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"smartSwapByOrderId","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"batchesAmount","type":"uint256[]","internalType":"uint256[]"},{"name":"batches","type":"tuple[][]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]"},{"name":"pmmRequests","type":"tuple[]","components":[{"name":"pathIndex","type":"uint256","internalType":"uint256"},{"name":"payer","type":"address","internalType":"address"},{"name":"fromToken","type":"address","internalType":"address"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"toTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"salt","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"},{"name":"isPushOrder","type":"bool","internalType":"bool"},{"name":"extension","type":"bytes","internalType":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"smartSwapTo","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"batchesAmount","type":"uint256[]","internalType":"uint256[]"},{"name":"batches","type":"tuple[][]","components":[{"name":"mixAdapters","type":"address[]","internalType":"address[]"},{"name":"assetTo","type":"address[]","internalType":"address[]"},{"name":"rawData","type":"uint256[]","internalType":"uint256[]"},{"name":"extraData","type":"bytes[]","internalType":"bytes[]"},{"name":"fromToken","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.RouterPath[][]"},{"name":"pmmRequests","type":"tuple[]","components":[{"name":"pathIndex","type":"uint256","internalType":"uint256"},{"name":"payer","type":"address","internalType":"address"},{"name":"fromToken","type":"address","internalType":"address"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"toTokenAmountMax","type":"uint256","internalType":"uint256"},{"name":"salt","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"},{"name":"isPushOrder","type":"bool","internalType":"bool"},{"name":"extension","type":"bytes","internalType":"bytes"}],"internalType":"struct PMMLib.PMMSwapRequest[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"swapWrap","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"rawdata","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"payable"},{"name":"swapWrapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"}],"outputs":[],"stateMutability":"payable"},{"name":"transferOwnership","type":"function","inputs":[{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapCallback","type":"function","inputs":[{"name":"amount0Delta","type":"int256","internalType":"int256"},{"name":"amount1Delta","type":"int256","internalType":"int256"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"name":"uniswapV3SwapTo","type":"function","inputs":[{"name":"receiver","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"pools","type":"uint256[]","internalType":"uint256[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"uniswapV3SwapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"pools","type":"uint256[]","internalType":"uint256[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unpause","type":"function","inputs":[],"outputs":[],"stateMutability":"nonpayable"},{"name":"unxswapByOrderId","type":"function","inputs":[{"name":"srcToken","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unxswapTo","type":"function","inputs":[{"name":"srcToken","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"minReturn","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"unxswapToWithBaseRequest","type":"function","inputs":[{"name":"orderId","type":"uint256","internalType":"uint256"},{"name":"receiver","type":"address","internalType":"address"},{"name":"baseRequest","type":"tuple","components":[{"name":"fromToken","type":"uint256","internalType":"uint256"},{"name":"toToken","type":"address","internalType":"address"},{"name":"fromTokenAmount","type":"uint256","internalType":"uint256"},{"name":"minReturnAmount","type":"uint256","internalType":"uint256"},{"name":"deadLine","type":"uint256","internalType":"uint256"}],"internalType":"struct IDexRouter.BaseRequest"},{"name":"pools","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"returnAmount","type":"uint256","internalType":"uint256"}],"stateMutability":"payable"},{"name":"version","type":"function","inputs":[],"outputs":[{"name":"","type":"string","internalType":"string"}],"stateMutability":"view"},{"type":"receive","stateMutability":"payable"}],"metadata":"{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AlreadyPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadyPausedByOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"AlreadySet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotPaused\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotReporter\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"OwnerPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"OwnerUnpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"until\",\"type\":\"uint64\"}],\"name\":\"ReporterPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"added\",\"type\":\"bool\"}],\"name\":\"ReporterUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"mixAdapters\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"assetTo\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"rawData\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"extraData\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.RouterPath[]\",\"name\":\"paths\",\"type\":\"tuple[]\"}],\"name\":\"dagSwapByOrderId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"mixAdapters\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"assetTo\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"rawData\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"extraData\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.RouterPath[]\",\"name\":\"paths\",\"type\":\"tuple[]\"}],\"name\":\"dagSwapTo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseByReporter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pauseUntil\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"reporters\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"reporter\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"added\",\"type\":\"bool\"}],\"name\":\"setReporter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"internalType\":\"uint256[]\",\"name\":\"batchesAmount\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"mixAdapters\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"assetTo\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"rawData\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"extraData\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.RouterPath[][]\",\"name\":\"batches\",\"type\":\"tuple[][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"pathIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmountMax\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toTokenAmountMax\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"salt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isPushOrder\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"extension\",\"type\":\"bytes\"}],\"internalType\":\"struct PMMLib.PMMSwapRequest[]\",\"name\":\"pmmRequests\",\"type\":\"tuple[]\"}],\"name\":\"smartSwapByOrderId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"internalType\":\"uint256[]\",\"name\":\"batchesAmount\",\"type\":\"uint256[]\"},{\"components\":[{\"internalType\":\"address[]\",\"name\":\"mixAdapters\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"assetTo\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"rawData\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"extraData\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.RouterPath[][]\",\"name\":\"batches\",\"type\":\"tuple[][]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"pathIndex\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"payer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"fromToken\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmountMax\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"toTokenAmountMax\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"salt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"isPushOrder\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"extension\",\"type\":\"bytes\"}],\"internalType\":\"struct PMMLib.PMMSwapRequest[]\",\"name\":\"pmmRequests\",\"type\":\"tuple[]\"}],\"name\":\"smartSwapTo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rawdata\",\"type\":\"uint256\"}],\"name\":\"swapWrap\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"}],\"name\":\"swapWrapToWithBaseRequest\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int256\",\"name\":\"amount0Delta\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"amount1Delta\",\"type\":\"int256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"uniswapV3SwapCallback\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"receiver\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturn\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"pools\",\"type\":\"uint256[]\"}],\"name\":\"uniswapV3SwapTo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"internalType\":\"uint256[]\",\"name\":\"pools\",\"type\":\"uint256[]\"}],\"name\":\"uniswapV3SwapToWithBaseRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"srcToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturn\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"pools\",\"type\":\"bytes32[]\"}],\"name\":\"unxswapByOrderId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"srcToken\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturn\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"bytes32[]\",\"name\":\"pools\",\"type\":\"bytes32[]\"}],\"name\":\"unxswapTo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"orderId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"fromToken\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"toToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"fromTokenAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minReturnAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadLine\",\"type\":\"uint256\"}],\"internalType\":\"struct IDexRouter.BaseRequest\",\"name\":\"baseRequest\",\"type\":\"tuple\"},{\"internalType\":\"bytes32[]\",\"name\":\"pools\",\"type\":\"bytes32[]\"}],\"name\":\"unxswapToWithBaseRequest\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"returnAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"AlreadyPausedByOwner()\":[{\"details\":\"This error is thrown when owner tries to pause an already owner-paused contract\"}]},\"kind\":\"dev\",\"methods\":{\"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])\":{\"params\":{\"baseRequest\":\"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"paths\":\"An array of RouterPath structs defining the DAG swap route.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])\":{\"params\":{\"baseRequest\":\"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"paths\":\"An array of RouterPath structs defining the DAG swap route.\",\"receiver\":\"The address that will receive the swapped tokens.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"isPaused()\":{\"details\":\"Returns true if block.timestamp < pauseUntil\",\"returns\":{\"_0\":\"True if paused, false otherwise\"}},\"pause()\":{\"details\":\"Only callable by the ownerSets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pauseReverts if contract is already paused by ownerOwner can override reporter pause (temporary pause) by calling this function\"},\"pauseByReporter()\":{\"details\":\"Only callable by a reporterReverts if contract is already pausedSets pauseUntil to block.timestamp + 24 hours\"},\"setReporter(address,bool)\":{\"details\":\"Only callable by the owner\",\"params\":{\"added\":\"True to add, false to remove\",\"reporter\":\"Reporter address to add or remove\"}},\"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])\":{\"params\":{\"baseRequest\":\"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\",\"batches\":\"Detailed routing information for executing the swap across different paths or protocols.\",\"batchesAmount\":\"Array indicating amounts for each batch in the swap, allowing for split operations.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking.\",\"pmmRequests\":\"PMM swap requests (currently used only for calldata length calculation, not for swap logic).\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])\":{\"params\":{\"baseRequest\":\"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.\",\"batches\":\"Detailed routing information for executing the swap across different paths or protocols.\",\"batchesAmount\":\"Array indicating amounts for each batch in the swap, allowing for split operations.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking.\",\"pmmRequests\":\"PMM swap requests (currently used only for calldata length calculation, not for swap logic).\",\"receiver\":\"Address to receive the output tokens from the swap.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"swapWrap(uint256,uint256)\":{\"details\":\"This function supports bidirectional swaps between ETH and WETH with minimal gas overhead. The rawdata parameter encodes: - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH\",\"params\":{\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"rawdata\":\"Encoded data containing swap direction, transfer mode and amount information using bit masks.\"}},\"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))\":{\"details\":\"This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly. It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses.\",\"params\":{\"baseRequest\":\"Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"receiver\":\"The address that will receive the swapped tokens.\"}},\"transferOwnership(address)\":{\"details\":\"Only callable by the current ownerEmits OwnerChanged event with previousOwner (current owner) and newOwner\",\"params\":{\"newOwner\":\"New owner address\"}},\"uniswapV3SwapCallback(int256,int256,bytes)\":{\"details\":\"The first 32 bytes of data is a flag to identify which router to call\"},\"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])\":{\"params\":{\"amount\":\"The amount of the source token to be swapped.\",\"minReturn\":\"The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage.\",\"pools\":\"An array of pool identifiers used to define the swap route within Uniswap V3.\",\"receiver\":\"The address that will receive the swap funds (encoded as uint256 with order ID mask).\"},\"returns\":{\"returnAmount\":\"The amount of tokens received after the completion of the swap.\"}},\"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])\":{\"params\":{\"baseRequest\":\"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"pools\":\"An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.\",\"receiver\":\"The address that will receive the swapped tokens.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"unpause()\":{\"details\":\"Only callable by the ownerResets pauseUntil to NOT_PAUSED, clearing both owner and reporter pausesReverts if contract is not pausedGas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause\"},\"unxswapByOrderId(uint256,uint256,uint256,bytes32[])\":{\"params\":{\"amount\":\"The amount of the source token to be swapped.\",\"minReturn\":\"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\",\"pools\":\"An array of pool identifiers to specify the swap route, optimizing for best rates.\",\"srcToken\":\"The source token to be swapped.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"unxswapTo(uint256,uint256,uint256,address,bytes32[])\":{\"params\":{\"amount\":\"The amount of the source token to be swapped.\",\"minReturn\":\"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions.\",\"pools\":\"An array of pool identifiers to specify the swap route, optimizing for best rates.\",\"receiver\":\"The address where the swapped tokens will be sent.\",\"srcToken\":\"The source token to be swapped.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}},\"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])\":{\"params\":{\"baseRequest\":\"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline.\",\"orderId\":\"Unique identifier for the swap order, facilitating tracking and reference.\",\"pools\":\"An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.\",\"receiver\":\"The address that will receive the swapped tokens.\"},\"returns\":{\"returnAmount\":\"The total amount of destination tokens received from the swap.\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"AlreadyPaused()\":[{\"notice\":\"Thrown when contract is already paused\"}],\"AlreadyPausedByOwner()\":[{\"notice\":\"Thrown when contract is already paused by owner\"}],\"AlreadySet()\":[{\"notice\":\"Thrown when reporter state is already set\"}],\"NotOwner()\":[{\"notice\":\"Thrown when caller is not the owner\"}],\"NotPaused()\":[{\"notice\":\"Thrown when contract is not paused\"}],\"NotReporter()\":[{\"notice\":\"Thrown when caller is not a reporter\"}],\"ZeroAddress()\":[{\"notice\":\"Thrown when zero address is provided\"}]},\"events\":{\"OwnerChanged(address,address)\":{\"notice\":\"Emitted when ownership is transferred\"},\"OwnerPaused()\":{\"notice\":\"Emitted when contract is paused by owner\"},\"OwnerUnpaused()\":{\"notice\":\"Emitted when contract is unpaused by owner\"},\"ReporterPaused(address,uint64)\":{\"notice\":\"Emitted when contract is paused by reporter\"},\"ReporterUpdated(address,bool)\":{\"notice\":\"Emitted when a reporter is added or removed\"}},\"kind\":\"user\",\"methods\":{\"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])\":{\"notice\":\"================================ dagSwap related ================================Executes a DAG swap to a specified receiver using structured base request parameters.\"},\"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])\":{\"notice\":\"Executes a DAG swap to a specified receiver using structured base request parameters.\"},\"isPaused()\":{\"notice\":\"Check if the contract is currently paused\"},\"owner()\":{\"notice\":\"Contract owner address\"},\"pause()\":{\"notice\":\"Pause the contract (until manually unpaused by owner)\"},\"pauseByReporter()\":{\"notice\":\"Pause the contract for 24 hours\"},\"pauseUntil()\":{\"notice\":\"Pause state timestamp\"},\"reporters(address)\":{\"notice\":\"Mapping of reporter addresses\"},\"setReporter(address,bool)\":{\"notice\":\"Add or remove a reporter\"},\"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])\":{\"notice\":\"================================ smartSwap related ================================Executes a smart swap directly to a specified receiver address.\"},\"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])\":{\"notice\":\"Executes a smart swap directly to a specified receiver address.\"},\"swapWrap(uint256,uint256)\":{\"notice\":\"================================ swapWrap related ================================Executes a simple swap between ETH and WETH using encoded parameters.\"},\"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))\":{\"notice\":\"Executes a swap between ETH and WETH using structured base request parameters to a specified receiver.\"},\"transferOwnership(address)\":{\"notice\":\"Transfer ownership to a new address\"},\"uniswapV3SwapCallback(int256,int256,bytes)\":{\"notice\":\"================================ uniswapV3Callback ==============================callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter\"},\"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])\":{\"notice\":\"============================== uniswapV3Swap related ==============================Executes a swap using the Uniswap V3 protocol.\"},\"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])\":{\"notice\":\"Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee.\"},\"unpause()\":{\"notice\":\"Unpause the contract\"},\"unxswapByOrderId(uint256,uint256,uint256,bytes32[])\":{\"notice\":\"============================== unxswap related ==============================Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\"},\"unxswapTo(uint256,uint256,uint256,address,bytes32[])\":{\"notice\":\"Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\"},\"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])\":{\"notice\":\"Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/8/DexRouter.sol\":\"DexRouter\"},\"evmVersion\":\"london\",\"libraries\":{\"contracts/8/DexRouter.sol:DagRouter\":\"0x408fab3aafc590d99b09e6ad13ad5df73b066526\",\"contracts/8/DexRouter.sol:SmartSwapRouter\":\"0xbf0824d673a73c67287059fd351794284646b8d7\",\"contracts/8/DexRouter.sol:SwapWrapRouter\":\"0x057d1e699296cced17696c442e637dca69b34e1a\",\"contracts/8/DexRouter.sol:UnxswapRouter\":\"0x14d28f43301a5a6277afad65e9817e0a12ea0fec\",\"contracts/8/DexRouter.sol:UnxswapV3Router\":\"0x610638b97f5d3eb5c2e6b2b0ae9ab5436040a63f\"},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@dex-exactout/=contracts/exactout/\",\":@dex/=contracts/8/\",\":@ensdomains/=node_modules/@ensdomains/\",\":@openzeppelin/=node_modules/@openzeppelin/\",\":@uniswap/=node_modules/@uniswap/\",\":@zetachain/=node_modules/@zetachain/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":eth-gas-reporter/=node_modules/eth-gas-reporter/\",\":forge-std/=lib/forge-std/src/\",\":hardhat/=node_modules/hardhat/\"]},\"sources\":{\"contracts/8/DexRouter.sol\":{\"keccak256\":\"0xa2e888d60cbec4aace3818de4cb341ac82423ece5ea4de5c2011d5cceed277a9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7cb5daa1e487814408abfff377652e36eddd8ccac29373fd36f67ed86051e910\",\"dweb:/ipfs/QmU2YkbvaK6mQoTtHGiWTkAK42t69HWDjHpmndWWSLVRHs\"]},\"contracts/8/interfaces/IAdapter.sol\":{\"keccak256\":\"0x8861a0548ae3a9b7467c3eb5fcd4c04bce00d58d2cb4eaedd520cf666989fc69\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://118733596fa2a3ad4c310c9fa2bae239d2daebdaffbe9518e248564c93339025\",\"dweb:/ipfs/QmWyJPwYzW2mQFdP7bemhEpkGTrZy9oCus5fHPEcFnH4uC\"]},\"contracts/8/interfaces/IApproveProxy.sol\":{\"keccak256\":\"0x405f493fdea26f110bcd8585ecb9b63dc477562b31fdfeea73006a38dd084c51\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0b5817d2b37a73ffe57f89659f744359d686d5c83a2c66d1afe6053e250ea8fc\",\"dweb:/ipfs/QmQWp1Hyxt45sTUcZu5PtKbLHQM49twkxKzyPEZGQJ35sL\"]},\"contracts/8/interfaces/IDaiLikePermit.sol\":{\"keccak256\":\"0x480d32f19e542d9daa222cb703dd091d4eea3b534c45269fd1f04f8ba470cc44\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3a140269977a9ead684809df7f29ecc3b15bc98a94e1b19799cc247b8f006fcd\",\"dweb:/ipfs/QmVgYfTVtfaUqjTkbzHe8G7ZJEhEcJqLvgGBhDLwuYfEUd\"]},\"contracts/8/interfaces/IDexRouter.sol\":{\"keccak256\":\"0x3bb573b81e2ec17af37c3a683136db5f60154093dbb2a2703fe929c2c9ea8524\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://de99ed726a09e017852a446b92553dec6af808815368a17e85f2645731180cab\",\"dweb:/ipfs/QmX4k5i4giEG1bqnHgHUKXp171iLZX12oKqXXJzixasX1T\"]},\"contracts/8/interfaces/IERC20.sol\":{\"keccak256\":\"0xc2d4e51a0477ae32fc24b7a10da9bc9f6b0754fee338c1b099e8335b8b2fb18c\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://82f3ee0b162cf1bc9a9bfdbb24ac75af5cb2865f2183a857b53590c5ad5ab1eb\",\"dweb:/ipfs/QmYGEwymZyHHRU4wKbXMbXwV2tVWYSVLkr1AvnhwcuSVmy\"]},\"contracts/8/interfaces/IERC20Permit.sol\":{\"keccak256\":\"0x25ca4efda5b398358811f84a4b914a8f1f1cc0522870d5ac166543209220900e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e17f726455864c6b0c14bb7dc842716b488d093de8805027728a6bfe5c4d9f7d\",\"dweb:/ipfs/QmUfVkVkfTBnzBvjCU6ig1e9AoLyZhLfiKJxh51pu3s6Q1\"]},\"contracts/8/interfaces/IUni.sol\":{\"keccak256\":\"0xdbcf77948d2f22cbeb494fea8b053ce6da708a68ccf5965f38aa45d3d4124e0b\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2386c909438e34ce6fe90de1953cd61d442dfd6f301fa0291e8e694df4002660\",\"dweb:/ipfs/Qmehr1DdfJWQRppVns8b3r2PmJed3Mw733aFWsTfunvo8k\"]},\"contracts/8/interfaces/IUniV3.sol\":{\"keccak256\":\"0x2e4f6a760cf0327cd1d1137c054e18194739b1b727b2733f3be4befdb707f0d4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://c4a58969dceb7f930696da70cfa044e2cadf444aba12a601f1420c1ffd71109e\",\"dweb:/ipfs/Qmf3gKajta4dcmcdPbJXYRY3J1QZ7WmagsgRkK8rmSfy5T\"]},\"contracts/8/interfaces/IUniswapV3SwapCallback.sol\":{\"keccak256\":\"0xe7378c64d6811136b32c8b6fad142a4e7d8f2534337215983e52b288a0dbbbfd\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d9058ab07cc5f2bb1b901f00307aa71f1ab4259426698da5b9b5a2ee7b317019\",\"dweb:/ipfs/QmNWFPZ4uoTT7VdoPtjfExHPcaeZJN55WqUrBevMmejxku\"]},\"contracts/8/interfaces/IWETH.sol\":{\"keccak256\":\"0x7dc79bded17353823f20fb059c19d7d4e17fa726d90fb16e877d80955caedd61\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e68128f5861e8a9239e490b4f52300e8afe8f532e56bc9e42314e05579307909\",\"dweb:/ipfs/QmSJWjomYU9uSm5GJxU3Cw32cC2th1kUDbPe5T8WNwzGqY\"]},\"contracts/8/interfaces/permit2/IAllowanceTransfer.sol\":{\"keccak256\":\"0x37f0ac203b6ef605c9533e1a739477e8e9dcea90710b40e645a367f8a21ace29\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e0104d72aeaec1cd66cc232e7de7b7ead08608efcc179491b8a66387614670b0\",\"dweb:/ipfs/QmfAZDyuNC9FXXbnJUwqHNwmAK6uRrXxtWEytLsxjskPsN\"]},\"contracts/8/interfaces/permit2/IEIP712.sol\":{\"keccak256\":\"0xfdccf2b9639070803cd0e4198427fb0df3cc452ca59bd3b8a0d957a9a4254138\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f7c936ac42ce89e827db905a1544397f8bdf46db34cdb6aa1b90dea42fdb4c72\",\"dweb:/ipfs/QmVgurxo1N31qZqkPBirw9Z7S9tLYmv6jSwQp8R8ur2cBk\"]},\"contracts/8/interfaces/permit2/IPermit2.sol\":{\"keccak256\":\"0xaa631cc9f53e699301d94233007110a345e6779011def484e8dd97b8fe0af771\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://fc0502cf19c9c18f320a3001201e89e350393b75837f6b7971de18b2de06f30d\",\"dweb:/ipfs/QmT9SfhdJ7VJNNrf94g4H5usyi7ShqWGx7Cqsz9jZTjX96\"]},\"contracts/8/interfaces/permit2/ISignatureTransfer.sol\":{\"keccak256\":\"0xe6df9966f8841dc3958ee86169c89de97e7f614c81c28b9dc947b12d732df64e\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3d4eafdee7f48c3be8350a94eb6edd0bfb2af2c105df65787a77174f356c0317\",\"dweb:/ipfs/QmY1j2adeeAhNpn6cUuthemxGCdLXHTfyMh9yTKsY4mZ2d\"]},\"contracts/8/libraries/Address.sol\":{\"keccak256\":\"0x004a443da2e1b4c87deee3d90ef5381969a550e72d14c04c51e329cccba5f320\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://12263d11c29caba329cf5871bb6d734e1c78e9123a9d98d43a03807a7ada4583\",\"dweb:/ipfs/QmTttjMHcsXrnk6JzF6r3qK9JNuAB3Yp3KV6s7F3iTvhLt\"]},\"contracts/8/libraries/ChainConfig.sol\":{\"keccak256\":\"0xd1209ba067d7ba326cd15cdfe6fd0715911f1644f1ad8dc4c0d73f75c3473334\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://772925bb432d65a32d8fe20eae84fbadcc1e34e010a7c7d4900337e3ed6c9f1e\",\"dweb:/ipfs/QmbJBNQtc7Fpk7trij4hU5tZJiVoBGidfiufa6v44TU2mS\"]},\"contracts/8/libraries/CommissionLib.sol\":{\"keccak256\":\"0x643bd59a29981c6681916d8e934b191cea55afd62f29b6e36fdc559c331e23fe\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://091f462610e1732997f4e1be0ac256a4ea2659d7ead92e8d1ae4f88bd2c5f5cf\",\"dweb:/ipfs/QmYZvsLbEuq2bomSogSHVAcyefuETFzy9BFXLtRFUxhtse\"]},\"contracts/8/libraries/CommonLib.sol\":{\"keccak256\":\"0x1ba9c1ea51250b5de23e243d16e8a77c6931059fbab5e3fbd6cb94f2ee0cb3b4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://3e8288d091f898fc4046bdbbbea8d7e4c2d33b76a0bea42088b145b1cc53e009\",\"dweb:/ipfs/Qmbah9PF4S4SmE5ZsMWCQLmypqCFkLAsXHK4GN5TJjC9ws\"]},\"contracts/8/libraries/Constants.sol\":{\"keccak256\":\"0xa75fc32798397998145485da4fc6acd2f19d2c145e77ba5a9b111c25ec2df347\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://53168fcd9b174e70202496bf5bc282a459d6fb1e2ea9b7f26ff5546fd1a0d46c\",\"dweb:/ipfs/QmZTcGvNcLB9nhTDXj5ehiQPJ8fvcaiKTeEy41ZeP1MnnV\"]},\"contracts/8/libraries/EthReceiver.sol\":{\"keccak256\":\"0x9f14897cf172b1ae722e8e6fce6c8d4a6199727b6918d530f33823e0b3331456\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://51f12d67113e4abbc62b76fdd38913bc98d4e0e0d7343ed35c9579af4d27e6cf\",\"dweb:/ipfs/QmWewjv5mBaKSzAKZnxAnUtBpt7ERSy26xwJMat8ajE31P\"]},\"contracts/8/libraries/EventLib.sol\":{\"keccak256\":\"0xfaf2998524b6953f78628a0431088fcba659a4d5b5e21fa6c134f54eed421177\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://700edb01bea25dce86887bb6efc1eb86cff6874f2101366353303d3d7091c4be\",\"dweb:/ipfs/QmSF53YdVuRJQfmxhjz4Xq6im2e9ySumqh74yEtb37hdUp\"]},\"contracts/8/libraries/ExtraDataLib.sol\":{\"keccak256\":\"0x2e2bf0b4149a02e0cfcdb3389c8c2a1bca09cd361a248f6cf8b1ff595fc51a83\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a66d9df293c72eb224a997f940d60276862602047749ccf5307fdd726d9d387a\",\"dweb:/ipfs/Qmd5unNhaPrebYjBaUZojS1GVqv5Kdmixbe7H6sogninj4\"]},\"contracts/8/libraries/PMMLib.sol\":{\"keccak256\":\"0xe9ca70104294965d1c6df7bf21df1b662debef55864fa9e26310ef120e123182\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://488112321a387c93ec1e2e24ef7284db5af965159145ab8f354b4d3d4575577d\",\"dweb:/ipfs/QmatShYGr33UX6ZTK8QV8qgfZ5GZwMuNLSSnt26Mfdxv7x\"]},\"contracts/8/libraries/PausableModuleV2.sol\":{\"keccak256\":\"0xc1980d47b3524a45357e3c1e5deae2f5bbe89617b7e9821ad02adb86d5766164\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://eea5d9c6e2f66ee04029fb4bd11ee3e4536ff226e9ad338f77954d5cd4ada99b\",\"dweb:/ipfs/QmPrQwT2Uqse1zTom5DgPSsTPqnsPEzDcTTYEaFNd327Pv\"]},\"contracts/8/libraries/RevertReasonForwarder.sol\":{\"keccak256\":\"0x12d542c0a07c83175bc927b2ecd77dd9cf9d113e1f6d242a9886920cdc84e004\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0cda9f3b320ff838c7eaa579980203ab10d53ae56fc4b1b87e202a88a642f849\",\"dweb:/ipfs/QmTVqFy9ADmp51CKR7wEif332Vh2FNjLZKY9KRVAtomzVT\"]},\"contracts/8/libraries/SafeERC20.sol\":{\"keccak256\":\"0x6fb5661c7d83a1394d05cd20d69ede4337ae8e7f68db40b4548f0656d112ed17\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://59bd76fd98e228d49f4f5172e033d4b7b0d89ca9e6bbcbea797d5da023b28124\",\"dweb:/ipfs/QmY4Qg3U789ajRT5vyMLuuEK8x3zuPVzJoEymvtYzhLBaJ\"]},\"contracts/8/libraries/SafeMath.sol\":{\"keccak256\":\"0x71d16bf7d3101044d077f24e517d09d31d482830e807dc3b27c24926b0367b9f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://292b9a002462c9402aa17b7740a41776cff5e16aa506bc3c138b1a3be39e9e39\",\"dweb:/ipfs/QmUHUPA8k1vMYv4PG9t8BrVBngkp7HKQrG15QsYDAaVeUk\"]},\"contracts/8/libraries/TransferLib.sol\":{\"keccak256\":\"0x9c07c291096da3744297df10b6e2786cf37d8cd13cc5a60ea06284312df9bf79\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://729034f687391da9d2f169e59ee730ff371b125c96559761a2911d7a886c3a83\",\"dweb:/ipfs/QmV9ZNiBHrortkp2626Tc8dwHh3f1ooFDTcNhVJSZ1C8ov\"]},\"contracts/8/libraries/TrimLib.sol\":{\"keccak256\":\"0x0bebfa439ba87881a4ba4aa0f79d686df2661fe694e19f1af926a814b0477cd9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e7e56783f89736c780e3caa9b7a6f612a61017b37af4d136a67be79b14eafa85\",\"dweb:/ipfs/QmQyVHoLATm2L7sDz4YxodNfXvmCc7Z5gHkAqSgxQNYdms\"]},\"contracts/8/libraries/UniswapTokenInfoHelper.sol\":{\"keccak256\":\"0x01f1104c48d38499b6777ebf08d971e771c1ede88b2f1a6f7748f1e9ed58fecb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f28977162c3d06959b5bef9241ddb5d16ddc473b8a4eb5bf3fcc6185c8d9fd43\",\"dweb:/ipfs/Qmcp1SGgFCFBhKkDMWG21HHCLqCzDmsxe5SaB4R2vV9poi\"]},\"contracts/8/router/DagRouter.sol\":{\"keccak256\":\"0x8530c6f0f392e650c1360662cc1c3df9ad9aab84e3d1eea0b7734218ab242cb6\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://28d49dc94b286b207c27422ac6851bda80fb52d1d576ceec4cf46e8db007c5c7\",\"dweb:/ipfs/QmebtXDLz1pxQyfQphzjNuwokXxgxH21EQEKukcVqrgjiu\"]},\"contracts/8/router/SmartSwapRouter.sol\":{\"keccak256\":\"0x0e96ad6df4ee3697ee9bbb807bba00f4fb584b36acf2c5c3cd9ae643c9c2b608\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8400278328b6e21952a94e43b701727612e7d9cd875c692b0735a704ad232fc6\",\"dweb:/ipfs/QmRTafq87cYhK6Wqwk6gowJugQFGQTTQrq3LsZ45Vtj6B2\"]},\"contracts/8/router/SwapWrapRouter.sol\":{\"keccak256\":\"0x6e449e1aca977fb933a918cb0f49a69bb602be3f01055dfb2e877b6f2b99a65a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f14a3c364697a508c0a2c1936aa44dad4229a207688673dee66906664b6e1296\",\"dweb:/ipfs/QmRgzev7cWwvi3fAdDPRK9ox8kYuSUMHLJtbm182VwfrVf\"]},\"contracts/8/router/UnxswapRouter.sol\":{\"keccak256\":\"0xa770963280bc94d5d23e5eafa4fb00c24b2fdc69a19f595201d7186f272ae3ee\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2628c20acc77a77f07018a0b29b75a9bbbd9d283eca4b1c31714215051345842\",\"dweb:/ipfs/Qmc3eVEfzSjRi1RVE9aGpz3EvLrFrZxbsaSDmViUoM8YWi\"]},\"contracts/8/router/UnxswapV3Router.sol\":{\"keccak256\":\"0x06891e81dc996f958a31283af909548540eec55942974111970ead978ae9efae\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f4a93018bf5d04210913ede51ed570f72d2522465ee767b2b3262e91ba01b7c6\",\"dweb:/ipfs/QmQ73bpv6BXMgZnVqfnkwDLgP24GoBEQHfMeQsTDLp4RyY\"]},\"node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"keccak256\":\"0xa535a5df777d44e945dd24aa43a11e44b024140fc340ad0dfe42acf4002aade1\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://41319e7f621f2dc3733511332c4fd032f8e32ad2aa7fd6f665c19741d9941a34\",\"dweb:/ipfs/QmcYR3bd862GD1Bc7jwrU9bGxrhUu5na1oP964bDCu2id1\"]}},\"version\":1}","userdoc":{"kind":"user","errors":{"NotOwner()":[{"notice":"Thrown when caller is not the owner"}],"NotPaused()":[{"notice":"Thrown when contract is not paused"}],"AlreadySet()":[{"notice":"Thrown when reporter state is already set"}],"NotReporter()":[{"notice":"Thrown when caller is not a reporter"}],"ZeroAddress()":[{"notice":"Thrown when zero address is provided"}],"AlreadyPaused()":[{"notice":"Thrown when contract is already paused"}],"AlreadyPausedByOwner()":[{"notice":"Thrown when contract is already paused by owner"}]},"events":{"OwnerPaused()":{"notice":"Emitted when contract is paused by owner"},"OwnerUnpaused()":{"notice":"Emitted when contract is unpaused by owner"},"OwnerChanged(address,address)":{"notice":"Emitted when ownership is transferred"},"ReporterUpdated(address,bool)":{"notice":"Emitted when a reporter is added or removed"},"ReporterPaused(address,uint64)":{"notice":"Emitted when contract is paused by reporter"}},"methods":{"owner()":{"notice":"Contract owner address"},"pause()":{"notice":"Pause the contract (until manually unpaused by owner)"},"unpause()":{"notice":"Unpause the contract"},"isPaused()":{"notice":"Check if the contract is currently paused"},"pauseUntil()":{"notice":"Pause state timestamp"},"pauseByReporter()":{"notice":"Pause the contract for 24 hours"},"reporters(address)":{"notice":"Mapping of reporter addresses"},"setReporter(address,bool)":{"notice":"Add or remove a reporter"},"swapWrap(uint256,uint256)":{"notice":"================================ swapWrap related ================================Executes a simple swap between ETH and WETH using encoded parameters."},"transferOwnership(address)":{"notice":"Transfer ownership to a new address"},"uniswapV3SwapCallback(int256,int256,bytes)":{"notice":"================================ uniswapV3Callback ==============================callback function for both UnxswapV3Router and UnxswapV3ExactOutRouter"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"notice":"============================== uniswapV3Swap related ==============================Executes a swap using the Uniswap V3 protocol."},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"notice":"============================== unxswap related ==============================Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"notice":"Executes a token swap using the Unxswap protocol, sending the output directly to a specified receiver.         The srcToken can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"notice":"Executes a swap between ETH and WETH using structured base request parameters to a specified receiver."},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"notice":"Executes a Unxswap token swap to a specified receiver using structured base request parameters. For unxswap, if fromToken or toToken is ETH, the address can be 0xEeee or address(0) for temporary use, the address(0) usage will removed in the future."},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"notice":"Executes a Uniswap V3 token swap to a specified receiver using structured base request parameters. For uniswapV3, if fromToken or toToken is ETH, the address needs to be 0xEeee."},"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"================================ dagSwap related ================================Executes a DAG swap to a specified receiver using structured base request parameters."},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"notice":"Executes a DAG swap to a specified receiver using structured base request parameters."},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"================================ smartSwap related ================================Executes a smart swap directly to a specified receiver address."},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"notice":"Executes a smart swap directly to a specified receiver address."}},"version":1},"devdoc":{"kind":"dev","errors":{"AlreadyPausedByOwner()":[{"details":"This error is thrown when owner tries to pause an already owner-paused contract"}]},"methods":{"pause()":{"details":"Only callable by the ownerSets pauseUntil to OWNER_PAUSED (type(uint64).max) to indicate owner pauseReverts if contract is already paused by ownerOwner can override reporter pause (temporary pause) by calling this function"},"unpause()":{"details":"Only callable by the ownerResets pauseUntil to NOT_PAUSED, clearing both owner and reporter pausesReverts if contract is not pausedGas optimized: using NOT_PAUSED (1) avoids expensive zero->non-zero SSTORE on next pause"},"isPaused()":{"details":"Returns true if block.timestamp < pauseUntil","returns":{"_0":"True if paused, false otherwise"}},"pauseByReporter()":{"details":"Only callable by a reporterReverts if contract is already pausedSets pauseUntil to block.timestamp + 24 hours"},"setReporter(address,bool)":{"params":{"added":"True to add, false to remove","reporter":"Reporter address to add or remove"},"details":"Only callable by the owner"},"swapWrap(uint256,uint256)":{"params":{"orderId":"Unique identifier for the swap order, facilitating tracking and reference.","rawdata":"Encoded data containing swap direction, transfer mode and amount information using bit masks."},"details":"This function supports bidirectional swaps between ETH and WETH with minimal gas overhead. The rawdata parameter encodes: - Transfer mode in bits [251:249], direction (reversed flag) in bit 255: false=ETH->WETH, true=WETH->ETH"},"transferOwnership(address)":{"params":{"newOwner":"New owner address"},"details":"Only callable by the current ownerEmits OwnerChanged event with previousOwner (current owner) and newOwner"},"uniswapV3SwapCallback(int256,int256,bytes)":{"details":"The first 32 bytes of data is a flag to identify which router to call"},"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])":{"params":{"pools":"An array of pool identifiers used to define the swap route within Uniswap V3.","amount":"The amount of the source token to be swapped.","receiver":"The address that will receive the swap funds (encoded as uint256 with order ID mask).","minReturn":"The minimum acceptable amount of tokens to receive from the swap, guarding against excessive slippage."},"returns":{"returnAmount":"The amount of tokens received after the completion of the swap."}},"unxswapByOrderId(uint256,uint256,uint256,bytes32[])":{"params":{"pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","amount":"The amount of the source token to be swapped.","srcToken":"The source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"unxswapTo(uint256,uint256,uint256,address,bytes32[])":{"params":{"pools":"An array of pool identifiers to specify the swap route, optimizing for best rates.","amount":"The amount of the source token to be swapped.","receiver":"The address where the swapped tokens will be sent.","srcToken":"The source token to be swapped.","minReturn":"The minimum amount of destination tokens expected from the swap, ensuring the trade does not proceed under unfavorable conditions."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))":{"params":{"orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token (with mode in high bits [251:249]), destination token, amount, minimum return, and deadline."},"details":"This function validates that the token pair is either ETH->WETH or WETH->ETH and executes the swap accordingly. It extracts the amount and mode from the baseRequest and determines the swap direction based on the token addresses."},"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])":{"params":{"pools":"An array of pool identifiers defining the Unxswap route, with encoded swap direction and WETH unwrap flags.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])":{"params":{"pools":"An array of pool identifiers defining the Uniswap V3 swap route, with encoded swap direction and unwrap flags.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"paths":"An array of RouterPath structs defining the DAG swap route.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])":{"params":{"paths":"An array of RouterPath structs defining the DAG swap route.","orderId":"Unique identifier for the swap order, facilitating tracking and reference.","receiver":"The address that will receive the swapped tokens.","baseRequest":"Struct containing essential swap parameters including source token, destination token, amount, minimum return, and deadline."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"batches":"Detailed routing information for executing the swap across different paths or protocols.","orderId":"Unique identifier for the swap order, facilitating tracking.","baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic).","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}},"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])":{"params":{"batches":"Detailed routing information for executing the swap across different paths or protocols.","orderId":"Unique identifier for the swap order, facilitating tracking.","receiver":"Address to receive the output tokens from the swap.","baseRequest":"Contains essential parameters for the swap such as source and destination tokens, amounts, and deadline.","pmmRequests":"PMM swap requests (currently used only for calldata length calculation, not for swap logic).","batchesAmount":"Array indicating amounts for each batch in the swap, allowing for split operations."},"returns":{"returnAmount":"The total amount of destination tokens received from the swap."}}},"version":1},"storageLayout":{"types":{"t_bool":{"label":"bool","encoding":"inplace","numberOfBytes":"1"},"t_uint64":{"label":"uint64","encoding":"inplace","numberOfBytes":"8"},"t_address":{"label":"address","encoding":"inplace","numberOfBytes":"20"},"t_uint256":{"label":"uint256","encoding":"inplace","numberOfBytes":"32"},"t_mapping(t_address,t_bool)":{"key":"t_address","label":"mapping(address => bool)","value":"t_bool","encoding":"mapping","numberOfBytes":"32"}},"storage":[{"slot":"0","type":"t_address","astId":2864,"label":"owner","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"0","type":"t_uint64","astId":2868,"label":"pauseUntil","offset":20,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"1","type":"t_mapping(t_address,t_bool)","astId":2873,"label":"reporters","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"},{"slot":"2","type":"t_uint256","astId":8465,"label":"_status","offset":0,"contract":"contracts/8/DexRouter.sol:DexRouter"}]},"transientStorageLayout":null,"evm":{"bytecode":{"object":"608060405260008054600160a01b600160e01b031916600160a01b1790553480156200002a57600080fd5b50604051620034ee380380620034ee8339810160408190526200004d91620000a2565b806001600160a01b038116620000765760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055506001600255620000d4565b600060208284031215620000b557600080fd5b81516001600160a01b0381168114620000cd57600080fd5b9392505050565b61340a80620000e46000396000f3fe6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b81529091507300000000000000000000000000000000000000009063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b81529091507300000000000000000000000000000000000000009063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b031981529091507300000000000000000000000000000000000000009063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b81529091507300000000000000000000000000000000000000009063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507300000000000000000000000000000000000000009063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b81527300000000000000000000000000000000000000009063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","sourceMap":"550:15160:0:-:0;;;1427:37:24;;;-1:-1:-1;;;;;;;;1427:37:24;-1:-1:-1;;;1427:37:24;;;730:73:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;775:6;-1:-1:-1;;;;;3943:22:24;;3939:48;;3974:13;;-1:-1:-1;;;3974:13:24;;;;;;;;;;;3939:48;3997:5;:14;;-1:-1:-1;;;;;;3997:14:24;-1:-1:-1;;;;;3997:14:24;;;;;;;;;;-1:-1:-1;;1821:7:36;:22;550:15160:0;;14:290:37;84:6;137:2;125:9;116:7;112:23;108:32;105:52;;;153:1;150;143:12;105:52;179:16;;-1:-1:-1;;;;;224:31:37;;214:42;;204:70;;270:1;267;260:12;204:70;293:5;14:290;-1:-1:-1;;;14:290:37:o;:::-;550:15160:0;;;;;;","linkReferences":{"contracts/8/router/DagRouter.sol":{"DagRouter":[{"start":2308,"length":20},{"start":4726,"length":20}]},"contracts/8/router/UnxswapRouter.sol":{"UnxswapRouter":[{"start":2021,"length":20},{"start":3326,"length":20},{"start":4074,"length":20}]},"contracts/8/router/SwapWrapRouter.sol":{"SwapWrapRouter":[{"start":1464,"length":20},{"start":3518,"length":20}]},"contracts/8/router/SmartSwapRouter.sol":{"SmartSwapRouter":[{"start":1727,"length":20},{"start":3782,"length":20}]},"contracts/8/router/UnxswapV3Router.sol":{"UnxswapV3Router":[{"start":2593,"length":20},{"start":2953,"length":20},{"start":5206,"length":20}]}}},"deployedBytecode":{"object":"6080604052600436106101395760003560e01c80638da5cb5b116100ab578063b88154771161006f578063b8815477146103ac578063ba0863ab146103bf578063e1bb5133146103d4578063f2c42696146103f4578063f2fde38b14610407578063fa461e331461042757600080fd5b80638da5cb5b146103145780639871efa41461034c57806398d2ac621461035f578063b187bd2614610372578063b80c2f091461039957600080fd5b80632cc1cd9e116100fd5780632cc1cd9e146102025780633f4ba83a1461024257806344014e981461025757806354fd4d501461026a5780637e3db158146102c05780638456cb59146102ff57600080fd5b806301617fab1461019057806303b87e5f146101a357806308298b5a146101c95780630c307f76146101dc5780630d5f0e3b146101ef57600080fd5b3661018b573233036101895760405162461bcd60e51b81526020600482015260146024820152731155120819195c1bdcda5d081c995a9958dd195960621b60448201526064015b60405180910390fd5b005b600080fd5b61018961019e3660046121d6565b610447565b6101b66101b1366004612277565b610540565b6040519081526020015b60405180910390f35b6101b66101d7366004612341565b61066d565b6101b66101ea3660046123b1565b61078d565b6101b66101fd366004612421565b6108aa565b34801561020e57600080fd5b5061023261021d366004612464565b60016020526000908152604090205460ff1681565b60405190151581526020016101c0565b34801561024e57600080fd5b5061018961096f565b6101b66102653660046123b1565b610a0f565b34801561027657600080fd5b506102b36040518060400160405280601a81526020017f76312e302e31302d7266712d616e74692d61726269747261676500000000000081525081565b6040516101c091906124cc565b3480156102cc57600080fd5b506000546102e790600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016101c0565b34801561030b57600080fd5b50610189610ad7565b34801561032057600080fd5b50600054610334906001600160a01b031681565b6040516001600160a01b0390911681526020016101c0565b6101b661035a366004612421565b610b88565b61018961036d3660046124df565b610c4d565b34801561037e57600080fd5b50600054600160a01b90046001600160401b03164210610232565b6101b66103a736600461251c565b610d49565b6101b66103ba3660046123b1565b610e73565b3480156103cb57600080fd5b50610189610f38565b3480156103e057600080fd5b506101896103ef3660046125e2565b61100f565b6101b6610402366004612615565b611101565b34801561041357600080fd5b50610189610422366004612464565b61121b565b34801561043357600080fd5b5061018961044236600461266f565b6112bd565b61044f611424565b600054600160a01b90046001600160401b031642101561048257604051631785c68160e01b815260040160405180910390fd5b60408051602081018490529081018290526000906060016040516020818303038152906040525160046104b59190612704565b905060006104c28261147b565b604051635702872760e01b81529091507300000000000000000000000000000000000000009063570287279061050090879087908690600401612963565b60006040518083038186803b15801561051857600080fd5b505af415801561052c573d6000803e3d6000fd5b50505050505061053c6001600255565b5050565b600061054a611424565b600054600160a01b90046001600160401b031642101561057d57604051631785c68160e01b815260040160405180910390fd5b60008a8a8a8a8a8a8a8a8a6040516020016105a099989796959493929190612db7565b6040516020818303038152906040525160046105bc9190612704565b905060006105c98261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610611908f908f908f908f908f908f908f908b90600401612f51565b602060405180830381865af415801561062e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106529190613007565b925050506106606001600255565b9998505050505050505050565b6000610677611424565b600054600160a01b90046001600160401b03164210156106aa57604051631785c68160e01b815260040160405180910390fd5b60008787878787876040516020016106c796959493929190613020565b6040516020818303038152906040525160046106e39190612704565b905060006106f08261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610734908c908c908c908c908c908c908a90600401613054565b602060405180830381865af4158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190613007565b925050506107836001600255565b9695505050505050565b6000610797611424565b600054600160a01b90046001600160401b03164210156107ca57604051631785c68160e01b815260040160405180910390fd5b600086868686866040516020016107e59594939291906130a8565b6040516020818303038152906040525160046108019190612704565b9050600061080e8261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd5030590610852908b908b908b908b908b9089906004016130df565b602060405180830381865af415801561086f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108939190613007565b925050506108a16001600255565b95945050505050565b60006108b4611424565b600054600160a01b90046001600160401b03164210156108e757604051631785c68160e01b815260040160405180910390fd5b6000868686868660405160200161090295949392919061312b565b60405160208183030381529060405251600461091e9190612704565b9050600061092b8261147b565b60405163cf45397b60e01b81529091507300000000000000000000000000000000000000009063cf45397b90610852908b908b908b908b908b90899060040161315c565b6000546001600160a01b0316331461099a576040516330cd747160e01b815260040160405180910390fd5b600054600160a01b90046001600160401b031642106109cc57604051636cd6020160e01b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b1916600160a01b1781556040517fa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba728229190a1565b6000610a19611424565b600054600160a01b90046001600160401b0316421015610a4c57604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610a67959493929190613194565b604051602081830303815290604052516004610a839190612704565b90506000610a908261147b565b604051600162036e8960e11b031981529091507300000000000000000000000000000000000000009063fff922ee90610852908b908b908b908b908b9089906004016131cb565b6000546001600160a01b03163314610b02576040516330cd747160e01b815260040160405180910390fd5b60005467fffffffffffffffe19600160a01b9091046001600160401b031601610b3e57604051630faae31d60e31b815260040160405180910390fd5b6000805467ffffffffffffffff60a01b191667ffffffffffffffff60a01b1781556040517fe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da9190a1565b6000610b92611424565b600054600160a01b90046001600160401b0316421015610bc557604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610be095949392919061312b565b604051602081830303815290604052516004610bfc9190612704565b90506000610c098261147b565b604051629ef65360e01b815290915073000000000000000000000000000000000000000090629ef65390610852908b908b908b9033908c908c908a90600401613054565b610c55611424565b600054600160a01b90046001600160401b0316421015610c8857604051631785c68160e01b815260040160405180910390fd5b6000838383604051602001610c9f93929190613202565b604051602081830303815290604052516004610cbb9190612704565b90506000610cc88261147b565b60405163b25a9b2360e01b81529091507300000000000000000000000000000000000000009063b25a9b2390610d08908890889088908790600401613225565b60006040518083038186803b158015610d2057600080fd5b505af4158015610d34573d6000803e3d6000fd5b505050505050610d446001600255565b505050565b6000610d53611424565b600054600160a01b90046001600160401b0316421015610d8657604051631785c68160e01b815260040160405180910390fd5b60008989898989898989604051602001610da798979695949392919061325b565b604051602081830303815290604052516004610dc39190612704565b90506000610dd08261147b565b604051637a9c232960e11b81529091507300000000000000000000000000000000000000009063f538465290610e18908e9033908f908f908f908f908f908b90600401612f51565b602060405180830381865af4158015610e35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e599190613007565b92505050610e676001600255565b98975050505050505050565b6000610e7d611424565b600054600160a01b90046001600160401b0316421015610eb057604051631785c68160e01b815260040160405180910390fd5b60008686868686604051602001610ecb959493929190613194565b604051602081830303815290604052516004610ee79190612704565b90506000610ef48261147b565b60405163f88e245160e01b81529091507300000000000000000000000000000000000000009063f88e245190610852908b908b908b908b908b9089906004016131cb565b3360009081526001602052604090205460ff16610f685760405163e5ce9c0960e01b815260040160405180910390fd5b600054600160a01b90046001600160401b0316421015610f9b57604051631785c68160e01b815260040160405180910390fd5b610fa86201518042612704565b6000805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117918290556040519104909116815233907f74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b9060200160405180910390a2565b6000546001600160a01b0316331461103a576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b0382166110615760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03821660009081526001602052604090205481151560ff9091161515036110a25760405163a741a04560e01b815260040160405180910390fd5b6001600160a01b038216600081815260016020908152604091829020805460ff191685151590811790915591519182527f3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18910160405180910390a25050565b600061110b611424565b600054600160a01b90046001600160401b031642101561113e57604051631785c68160e01b815260040160405180910390fd5b60008585858560405160200161115794939291906132bd565b6040516020818303038152906040525160046111739190612704565b905060006111808261147b565b604051630bd5030560e01b815290915073000000000000000000000000000000000000000090630bd50305906111c4908a9033908b908b908b9089906004016130df565b602060405180830381865af41580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613007565b925050506112136001600255565b949350505050565b6000546001600160a01b03163314611246576040516330cd747160e01b815260040160405180910390fd5b6001600160a01b03811661126d5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9190a35050565b600054600160a01b90046001600160401b03164210156112f057604051631785c68160e01b815260040160405180910390fd5b60208110156113395760405162461bcd60e51b8152602060048201526015602482015274496e76616c69642063616c6c6261636b206461746160581b6044820152606401610180565b600061134860208284866132e4565b6113519161330e565b9050651a0ab1be7e0760d21b81016113d55760405163fa461e3360e01b81527300000000000000000000000000000000000000009063fa461e33906113a090889088908890889060040161332c565b60006040518083038186803b1580156113b857600080fd5b505af41580156113cc573d6000803e3d6000fd5b5050505061141d565b60405162461bcd60e51b815260206004820152601860248201527f556e6b6e6f776e2056332063616c6c6261636b20666c616700000000000000006044820152606401610180565b5050505050565b60028054036114755760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610180565b60028055565b611483612027565b60008061148f846115c3565b9150915061149e8282866118b3565b60405180608001604052806114e7846000815181106114bf576114bf61334c565b6020026020010151846000815181106114da576114da61334c565b6020026020010151611a57565b815260200161152a846001815181106115025761150261334c565b60200260200101518460018151811061151d5761151d61334c565b6020026020010151611bc7565b815260200161156d846002815181106115455761154561334c565b6020026020010151846002815181106115605761156061334c565b6020026020010151611d43565b81526020016115b0846003815181106115885761158861334c565b6020026020010151846003815181106115a3576115a361334c565b6020026020010151612002565b6001600160a01b03169052949350505050565b60408051600480825260a0820190925260609182919060208201608080368337505060408051600480825260a0820190925292945090506020820160808036833701905050905061162b565b62461bcd60e51b600052600160e51b6020528060405250806000fd5b602060043603063603805b848111156116f3576001600160d01b031960208203351665561d3ed458e360d11b81146524949fffc69960d21b82146592527fff1a6560d01b83141717653bbbbbbb911160d11b82146577777777111160d01b8314176588880afc2bbb60d01b8314654444057e155560d11b841417176522220afc2bbb60d01b8314651111057e155560d11b841417653ca20afc2bbb60d01b8414651e51057e155560d11b851417171717156116e957819250506116f3565b50601f1901611636565b5060208103356001600160d01b031981166000653ca20afc2bbb60d01b8214651e51057e155560d11b83141715611728575060015b6522220afc2bbb60d01b8214651111057e155560d11b8314171561174a575060025b6588880afc2bbb60d01b8214654444057e155560d11b831417156117b1576040840335925060ff60f01b831660f01c9050600881116003821017156117b1576117b160597c1520696e76616c6964207265666572726572206e756d0000000000000061160f565b6000925080156117c2576001810192505b5050602084810183905283810182905202900360006001600160d01b0319601f19830135166588888888eeef60d01b81016117fc57600291505b653bbbbbbb911160d11b810361181157600391505b506040848101839052830181905260200290036000601f198201356001600160d01b03198116906524949fffc69960d21b82146592527fff1a6560d01b8314171561186457600460ff60c883901c160192505b50506060848101839052830181905260200290036000601f198201356529e2c12ba71d60d11b6001600160d01b031982160161189f57600191505b508160808501528060808401525050915091565b60005b6118c260016004613378565b60ff168110156119a1578281815181106118de576118de61334c565b602002602001015160206118f29190613391565b8482815181106119045761190461334c565b602002602001015161191691906133a8565b84611922836001612704565b815181106119325761193261334c565b6020026020010151146119915760405162461bcd60e51b815260206004820152602160248201527f45787472614461746120726567696f6e73206e6f7420636f6e736563757469766044820152606560f81b6064820152608401610180565b61199a816133bb565b90506118b6565b5080826119b060016004613378565b60ff16815181106119c3576119c361334c565b602002602001015160206119d79190613391565b846119e460016004613378565b60ff16815181106119f7576119f761334c565b6020026020010151611a0991906133a8565b1015610d445760405162461bcd60e51b815260206004820181905260248201527f457874726144617461206f7665726c61707320776974682073776170446174616044820152606401610180565b611a5f612061565b8115611bc1576000611a726001846133a8565b905060208403356001600160d01b03198116654444057e155560d11b8114651111057e155560d11b8214651e51057e155560d11b8314171784526588880afc2bbb60d01b81146522220afc2bbb60d01b8214653ca20afc2bbb60d01b83141717846020015265ffffffffffff60a01b821660a01c8460a001526001600160a01b0382168460c001526040860335915060016000600160ff1b84161115611b16575060025b60608501526001600160a01b0382166040850152608084018390526001831115611bbd5760015b83811015611bbb576020810260400187033592506001600160d01b03198316808314611b8b57611b8b605c7c1820696e76616c696420636f6d6d697373696f6e20666c61670000000061160f565b5060a083811c65ffffffffffff16604083028701918201526001600160a01b03841660c090910152600101611b3d565b505b5050505b92915050565b611bcf61214d565b8115611bc15760208303356001600160d01b03198116653bbbbbbb911160d11b81146577777777111160d01b8214178084526001811460018114611c2e5760008560200152600085604001526000856060015260008560800152611cb3565b65ffffffffffff60a01b841660a01c85602001526001600160a01b0384168560400152604087033593506001600160d01b03198416808414611c8b57611c8b6056721220696e76616c6964207472696d20666c616760501b61160f565b506001600160cf1b851615611c9e575060025b60608601526001600160a01b03841660808601525b5050653bbbbbbb911160d11b811460018114611cdc5760008460a0015260008460c00152611bbd565b606086033592506001600160d01b03198316808314611d1657611d166056721220696e76616c6964207472696d20666c616760501b61160f565b5065ffffffffffff60a01b831660a01c8460a001526001600160a01b0383168460c0015250505092915050565b611d4b61219e565b8115611bc157611d5c6004836133a8565b6001600160401b03811115611d7357611d73613362565b604051908082528060200260200182016040528015611d9c578160200160208202803683370190505b5060808201526000806003604051908082528060200260200182016040528015611dd0578160200160208202803683370190505b50905060208503356001600160d01b031981169250600485036001600160a01b0382168552604087033591506001600160d01b03198216808514611e3657611e36605d7c1920696e76616c6964207065726d697432496e666f20666c616700000061160f565b5065ffffffffffff821660208601526bffffffffffff000000000000821660301c60408601526592527fff1a6560d01b8403611e7c5760ff60601b821660601c60608401525b605f198701356020840152607f1987013560408401819052608086015190925060005b82811015611ec9576020810260a00189033593508360206001830102830152600181019050611e9f565b505050506592527fff1a6560d01b8203611f7e5780600081518110611ef057611ef061334c565b602002602001015160001b81600181518110611f0e57611f0e61334c565b602002602001015160001b82600281518110611f2c57611f2c61334c565b602002602001015160f81b604051602001611f649392919092835260208301919091526001600160f81b031916604082015260410190565b60408051601f198184030181529190526060840152611ffa565b6524949fffc69960d21b8203611ffa5780600081518110611fa157611fa161334c565b602002602001015160001b81600181518110611fbf57611fbf61334c565b602002602001015160001b604051602001611fe4929190918252602082015260400190565b60408051601f1981840301815291905260608401525b505092915050565b60008160000361201457506000611bc1565b5050601f1901356001600160a01b031690565b604051806080016040528061203a612061565b815260200161204761214d565b815260200161205461219e565b8152600060209091015290565b604051806102a001604052806000151581526020016000151581526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681526020016000815260200160006001600160a01b031681525090565b6040518060e001604052806000151581526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160608152602001606081525090565b600080604083850312156121e957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461220f57600080fd5b919050565b600060a0828403121561222657600080fd5b50919050565b60008083601f84011261223e57600080fd5b5081356001600160401b0381111561225557600080fd5b6020830191508360208260051b850101111561227057600080fd5b9250929050565b60008060008060008060008060006101408a8c03121561229657600080fd5b893598506122a660208b016121f8565b97506122b58b60408c01612214565b965060e08a01356001600160401b03808211156122d157600080fd5b6122dd8d838e0161222c565b90985096506101008c01359150808211156122f757600080fd5b6123038d838e0161222c565b90965094506101208c013591508082111561231d57600080fd5b5061232a8c828d0161222c565b915080935050809150509295985092959850929598565b60008060008060008060a0878903121561235a57600080fd5b863595506020870135945060408701359350612378606088016121f8565b925060808701356001600160401b0381111561239357600080fd5b61239f89828a0161222c565b979a9699509497509295939492505050565b600080600080600061010086880312156123ca57600080fd5b853594506123da602087016121f8565b93506123e98760408801612214565b925060e08601356001600160401b0381111561240457600080fd5b6124108882890161222c565b969995985093965092949392505050565b60008060008060006080868803121561243957600080fd5b85359450602086013593506040860135925060608601356001600160401b0381111561240457600080fd5b60006020828403121561247657600080fd5b61247f826121f8565b9392505050565b6000815180845260005b818110156124ac57602081850181015186830182015201612490565b506000602082860101526020601f19601f83011685010191505092915050565b60208152600061247f6020830184612486565b600080600060e084860312156124f457600080fd5b83359250612504602085016121f8565b91506125138560408601612214565b90509250925092565b600080600080600080600080610120898b03121561253957600080fd5b8835975061254a8a60208b01612214565b965060c08901356001600160401b038082111561256657600080fd5b6125728c838d0161222c565b909850965060e08b013591508082111561258b57600080fd5b6125978c838d0161222c565b90965094506101008b01359150808211156125b157600080fd5b506125be8b828c0161222c565b999c989b5096995094979396929594505050565b8035801515811461220f57600080fd5b600080604083850312156125f557600080fd5b6125fe836121f8565b915061260c602084016125d2565b90509250929050565b60008060008060e0858703121561262b57600080fd5b8435935061263c8660208701612214565b925060c08501356001600160401b0381111561265757600080fd5b6126638782880161222c565b95989497509550505050565b6000806000806060858703121561268557600080fd5b843593506020850135925060408501356001600160401b03808211156126aa57600080fd5b818701915087601f8301126126be57600080fd5b8135818111156126cd57600080fd5b8860208285010111156126df57600080fd5b95989497505060200194505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611bc157611bc16126ee565b60018060a01b03815116825260006020808301518185015260408301516040850152606083015160a0606086015261275260a0860182612486565b60808581015187830391880191909152805180835290840192506000918401905b808310156127935783518252928401926001929092019190840190612773565b509695505050505050565b60006103c082516127b185825115159052565b60208101516127c4602087018215159052565b5060408101516040860152606081015160608601526080810151608086015260a081015160a086015260c081015161280760c08701826001600160a01b03169052565b5060e081015160e08601526101008082015161282d828801826001600160a01b03169052565b50506101208181015190860152610140808201516001600160a01b03908116918701919091526101608083015190870152610180808301518216908701526101a080830151908701526101c0808301518216908701526101e0808301519087015261020080830151821690870152610220808301519087015261024080830151821690870152610260808301519087015261028091820151811691860191909152602084810151805115156102a0880152908101516102c087015260408082015183166102e08801526060820151610300880152608082015161032088015260a082015161034088015260c090910151909116610360860152830151610380850182905261293d82860182612717565b915050606083015161295b6103a08601826001600160a01b03169052565b509392505050565b8381528260208201526060604082015260006108a1606083018461279e565b803582526001600160a01b0361299a602083016121f8565b1660208301526040810135604083015260608101356060830152608081013560808301525050565b81835260006001600160fb1b038311156129db57600080fd5b8260051b80836020870137939093016020019392505050565b6000808335601e19843603018112612a0b57600080fd5b83016020810192503590506001600160401b03811115612a2a57600080fd5b8060051b360382131561227057600080fd5b8183526000602080850194508260005b85811015612a78576001600160a01b03612a65836121f8565b1687529582019590820190600101612a4c565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112612ac357600080fd5b83016020810192503590506001600160401b03811115612ae257600080fd5b80360382131561227057600080fd5b60008235609e19833603018112612b0757600080fd5b90910192915050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612b43838a612af1565b60a0612b4f82836129f4565b828852612b5f8389018284612a3c565b92505050612b6f898301836129f4565b8783038b890152612b81838284612a3c565b925050506040612b93818401846129f4565b888403838a0152612ba58482846129c2565b93505050506060612bb8818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612c1257868303601f19018652612bee8286612aac565b612bf9858284612a83565b945050508e820191508e86019550600181019050612bd3565b505060809586013599909501989098525050509a87019a935091860191600101612b2c565b50919998505050505050505050565b81835260006020808501808196508560051b810191508460005b87811015612c96578284038952612c7782886129f4565b612c82868284612b10565b9a87019a9550505090840190600101612c60565b5091979650505050505050565b81835260006020808501808196508560051b81019150846000805b88811015612da9578385038a52823561013e19893603018112612cdf578283fd5b880180358652610140612cf38883016121f8565b6001600160a01b0316888801526040612d0d8382016121f8565b6001600160a01b0316908801526060612d278382016121f8565b6001600160a01b0316908801526080828101359088015260a0808301359088015260c0808301359088015260e08083013590880152610100612d6a8184016125d2565b151590880152610120612d7f83820184612aac565b935082828a0152612d93838a018583612a83565b9d8a019d98505050938701935050600101612cbe565b509298975050505050505050565b8981526001600160a01b03891660208201526000610140612ddb604084018b612982565b8060e0840152612dee818401898b6129c2565b9050828103610100840152612e04818789612c46565b9050828103610120840152612e1a818587612ca3565b9c9b505050505050505050505050565b81835260006020808501808196506005915085821b8101856000805b89811015612c37578484038b52612e5d838a612af1565b60a0612e6982836129f4565b828852612e798389018284612a3c565b92505050612e89898301836129f4565b8783038b890152612e9b838284612a3c565b925050506040612ead818401846129f4565b888403838a0152612ebf8482846129c2565b93505050506060612ed2818401846129f4565b888403928901929092528183528a830191808b1b84018c0182885b83811015612f2c57868303601f19018652612f088286612aac565b612f13858284612a83565b945050508e820191508e86019550600181019050612eed565b505060809586013599909501989098525050509a87019a935091860191600101612e46565b60006101408a8352602060018060a01b038b1681850152612f75604085018b612982565b8160e0850152612f88828501898b6129c2565b8481036101008601528681529150808201600587901b830182018860005b89811015612fe057858303601f19018452612fc1828c6129f4565b612fcc858284612e2a565b958701959450505090840190600101612fa6565b5050858103610120870152612ff5818861279e565b9e9d5050505050505050505050505050565b60006020828403121561301957600080fd5b5051919050565b86815285602082015284604082015260018060a01b038416606082015260a060808201526000610e6760a0830184866129c2565b87815286602082015285604082015260018060a01b038516606082015260c06080820152600061308860c0830185876129c2565b82810360a084015261309a818561279e565b9a9950505050505050505050565b8581526001600160a01b038516602082015260006101006130cc6040840187612982565b8060e0840152610e678184018587612b10565b8681526001600160a01b038616602082015260006101206131036040840188612982565b8060e08401526131168184018688612e2a565b9050828103610100840152610660818561279e565b8581528460208201528360408201526080606082015260006131516080830184866129c2565b979650505050505050565b86815285602082015284604082015260a06060820152600061318260a0830185876129c2565b8281036080840152610660818561279e565b8581526001600160a01b038516602082015260006101006131b86040840187612982565b8060e0840152610e6781840185876129c2565b8681526001600160a01b038616602082015260006101206131ef6040840188612982565b8060e084015261311681840186886129c2565b8381526001600160a01b038316602082015260e081016112136040830184612982565b8481526001600160a01b038416602082015260006101006132496040840186612982565b8060e08401526131518184018561279e565b60006101208a8352613270602084018b612982565b8060c0840152613283818401898b6129c2565b905082810360e0840152613298818789612c46565b90508281036101008401526132ae818587612ca3565b9b9a5050505050505050505050565b8481526132cd6020820185612982565b60e060c0820152600061078360e083018486612b10565b600080858511156132f457600080fd5b8386111561330157600080fd5b5050820193919092039150565b80356020831015611bc157600019602084900360031b1b1692915050565b848152836020820152606060408201526000610783606083018486612a83565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60ff8281168282160390811115611bc157611bc16126ee565b8082028115828204841417611bc157611bc16126ee565b81810381811115611bc157611bc16126ee565b6000600182016133cd576133cd6126ee565b506001019056fea2646970667358221220fdb1c3a7f0e66237ea85c57bce72af6bd69fffbf2483a766fde88a56096bd0ec64736f6c63430008110033","sourceMap":"550:15160:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;248:9:20;234:10;:23;226:56;;;;-1:-1:-1;;;226:56:20;;216:2:37;226:56:20;;;198:21:37;255:2;235:18;;;228:30;-1:-1:-1;;;274:18:37;;;267:50;334:18;;226:56:20;;;;;;;;;550:15160:0;;;;;13381:344;;;;;;:::i;:::-;;:::i;3139:717::-;;;;;;:::i;:::-;;:::i;:::-;;;2939:25:37;;;2927:2;2912:18;3139:717:0;;;;;;;;10779:541;;;;;;:::i;:::-;;:::i;5571:560::-;;;;;;:::i;:::-;;:::i;6790:509::-;;;;;;:::i;:::-;;:::i;1517:41:24:-;;;;;;;;;;-1:-1:-1;1517:41:24;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;5544:14:37;;5537:22;5519:41;;5507:2;5492:18;1517:41:24;5379:187:37;5878:153:24;;;;;;;;;;;;;:::i;8047:605:0:-;;;;;;:::i;:::-;;:::i;662:61::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;1427:37:24:-;;;;;;;;;;-1:-1:-1;1427:37:24;;;;-1:-1:-1;;;1427:37:24;;-1:-1:-1;;;;;1427:37:24;;;;;;-1:-1:-1;;;;;7105:31:37;;;7087:50;;7075:2;7060:18;1427:37:24;6943:200:37;5383:177:24;;;;;;;;;;;;;:::i;1203:20::-;;;;;;;;;;-1:-1:-1;1203:20:24;;;;-1:-1:-1;;;;;1203:20:24;;;;;;-1:-1:-1;;;;;7421:32:37;;;7403:51;;7391:2;7376:18;1203:20:24;7257:203:37;9464:514:0;;;;;;:::i;:::-;;:::i;14459:507::-;;;;;;:::i;:::-;;:::i;6703:99:24:-;;;;;;;;;;-1:-1:-1;6744:4:24;6785:10;-1:-1:-1;;;6785:10:24;;-1:-1:-1;;;;;6785:10:24;6767:15;:28;6703:99;;1634:690:0;;;;;;:::i;:::-;;:::i;12136:591::-;;;;;;:::i;:::-;;:::i;6289:195:24:-;;;;;;;;;;;;;:::i;4745:284::-;;;;;;;;;;-1:-1:-1;4745:284:24;;;;;:::i;:::-;;:::i;4477:489:0:-;;;;;;:::i;:::-;;:::i;4302:248:24:-;;;;;;;;;;-1:-1:-1;4302:248:24;;;;;:::i;:::-;;:::i;15232:476:0:-;;;;;;;;;;-1:-1:-1;15232:476:0;;;;;:::i;:::-;;:::i;13381:344::-;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;13516:28:0::2;::::0;;::::2;::::0;::::2;12614:25:37::0;;;12655:18;;;12648:34;;;13487:22:0::2;::::0;12587:18:37;;13516:28:0::2;;;;;;;;;;;;:35;13512:1;:39;;;;:::i;:::-;13487:64;;13561:37;13601:48;13634:14;13601:32;:48::i;:::-;13666:52;::::0;-1:-1:-1;;;13666:52:0;;13561:88;;-1:-1:-1;13666:14:0::2;::::0;:23:::2;::::0;:52:::2;::::0;13690:7;;13699;;13561:88;;13666:52:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;13659:59;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;13381:344:0;;:::o;3139:717::-;3489:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;3525:22:0::2;3565:7;3574:8;3584:11;3597:13;;3612:7;;3621:11;;3554:79;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:86;3550:1;:90;;;;:::i;:::-;3525:115;;3650:37;3690:48;3723:14;3690:32;:48::i;:::-;3755:94;::::0;-1:-1:-1;;;3755:94:0;;3650:88;;-1:-1:-1;3755:15:0::2;::::0;:27:::2;::::0;:94:::2;::::0;3783:7;;3792:8;;3802:11;;3815:13;;;;3830:7;;;;3650:88;;3755:94:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3748:101;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;3139:717:0;;;;;;;;;;;:::o;10779:541::-;10994:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;11026:22:0::2;11066:8;11076:6;11084:9;11095:8;11105:5;;11055:56;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:63;11051:1;:67;;;;:::i;:::-;11026:92;;11128:37;11168:48;11201:14;11168:32;:48::i;:::-;11233:80;::::0;-1:-1:-1;;;11233:80:0;;11128:88;;-1:-1:-1;11233:13:0::2;::::0;:23:::2;::::0;:80:::2;::::0;11257:8;;11267:6;;11275:9;;11286:8;;11296:5;;;;11128:88;;11233:80:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;11226:87;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;10779:541:0;;;;;;;;:::o;5571:560::-;5819:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;5855:22:0::2;5895:7;5904:8;5914:11;5927:5;;5884:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;5880:1;:60;;;;:::i;:::-;5855:85;;5950:37;5990:48;6023:14;5990:32;:48::i;:::-;6055:69;::::0;-1:-1:-1;;;6055:69:0;;5950:88;;-1:-1:-1;6055:9:0::2;::::0;:19:::2;::::0;:69:::2;::::0;6075:7;;6084:8;;6094:11;;6107:5;;;;5950:88;;6055:69:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;6048:76;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;5571:560:0;;;;;;;:::o;6790:509::-;6985:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;7017:22:0::2;7057:8;7067:6;7075:9;7086:5;;7046:46;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:53;7042:1;:57;;;;:::i;:::-;7017:82;;7109:37;7149:48;7182:14;7149:32;:48::i;:::-;7214:78;::::0;-1:-1:-1;;;7214:78:0;;7109:88;;-1:-1:-1;7214:15:0::2;::::0;:31:::2;::::0;:78:::2;::::0;7246:8;;7256:6;;7264:9;;7275:5;;;;7109:88;;7214:78:::2;;;:::i;5878:153:24:-:0;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;6744:4;6785:10;-1:-1:-1;;;6785:10:24;;-1:-1:-1;;;;;6785:10:24;6767:15;:28;5926:34:::1;;5949:11;;-1:-1:-1::0;;;5949:11:24::1;;;;;;;;;;;5926:34;5971:10;:23:::0;;-1:-1:-1;;;;5971:23:24::1;-1:-1:-1::0;;;5971:23:24::1;::::0;;6009:15:::1;::::0;::::1;::::0;5971:10;6009:15:::1;5878:153::o:0;8047:605:0:-;8313:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;8349:22:0::2;8389:7;8398:8;8408:11;8421:5;;8378:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;8374:1;:60;;;;:::i;:::-;8349:85;;8444:37;8484:48;8517:14;8484:32;:48::i;:::-;8549:96;::::0;-1:-1:-1;;;;;;8549:96:0;;8444:88;;-1:-1:-1;8549:15:0::2;::::0;:46:::2;::::0;:96:::2;::::0;8596:7;;8605:8;;8615:11;;8628:5;;;;8444:88;;8549:96:::2;;;:::i;5383:177:24:-:0;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;5432:10:::1;::::0;-1:-1:-1;;;;;5432:10:24;;::::1;-1:-1:-1::0;;;;;5432:10:24::1;:26:::0;5429:60:::1;;5467:22;;-1:-1:-1::0;;;5467:22:24::1;;;;;;;;;;;5429:60;5500:10;:25:::0;;-1:-1:-1;;;;5500:25:24::1;-1:-1:-1::0;;;5500:25:24::1;::::0;;5540:13:::1;::::0;::::1;::::0;5500:10;5540:13:::1;5383:177::o:0;9464:514:0:-;9660:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;9692:22:0::2;9732:8;9742:6;9750:9;9761:5;;9721:46;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:53;9717:1;:57;;;;:::i;:::-;9692:82;;9784:37;9824:48;9857:14;9824:32;:48::i;:::-;9889:82;::::0;-1:-1:-1;;;9889:82:0;;9784:88;;-1:-1:-1;9889:13:0::2;::::0;:23:::2;::::0;:82:::2;::::0;9913:8;;9923:6;;9931:9;;9942:10:::2;::::0;9954:5;;;;9784:88;;9889:82:::2;;;:::i;14459:507::-:0;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;14683:22:0::2;14723:7;14732:8;14742:11;14712:42;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:49;14708:1;:53;;;;:::i;:::-;14683:78;;14771:37;14811:48;14844:14;14811:32;:48::i;:::-;14876:83;::::0;-1:-1:-1;;;14876:83:0;;14771:88;;-1:-1:-1;14876:14:0::2;::::0;:40:::2;::::0;:83:::2;::::0;14917:7;;14926:8;;14936:11;;14771:88;;14876:83:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;14869:90;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;14459:507:0;;;:::o;1634:690::-;1965:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;2001:22:0::2;2041:7;2050:11;2063:13;;2078:7;;2087:11;;2030:69;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:76;2026:1;:80;;;;:::i;:::-;2001:105;;2116:37;2156:48;2189:14;2156:32;:48::i;:::-;2221:96;::::0;-1:-1:-1;;;2221:96:0;;2116:88;;-1:-1:-1;2221:15:0::2;::::0;:27:::2;::::0;:96:::2;::::0;2249:7;;2258:10:::2;::::0;2270:11;;2283:13;;;;2298:7;;;;2116:88;;2221:96:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2214:103;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;1634:690:0;;;;;;;;;;:::o;12136:591::-;12396:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;12432:22:0::2;12472:7;12481:8;12491:11;12504:5;;12461:49;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:56;12457:1;:60;;;;:::i;:::-;12432:85;;12527:37;12567:48;12600:14;12567:32;:48::i;:::-;12632:88;::::0;-1:-1:-1;;;12632:88:0;;12527;;-1:-1:-1;12632:13:0::2;::::0;:38:::2;::::0;:88:::2;::::0;12671:7;;12680:8;;12690:11;;12703:5;;;;12527:88;;12632::::2;;;:::i;6289:195:24:-:0;3685:10;3675:21;;;;:9;:21;;;;;;;;3670:48;;3705:13;;-1:-1:-1;;;3705:13:24;;;;;;;;;;;3670:48;3361:10:::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;6382:41:::2;1030:8;6382:15;:41;:::i;:::-;6362:10;:62:::0;;-1:-1:-1;;;;6362:62:24::2;-1:-1:-1::0;;;;;;;;6362:62:24;;::::2;::::0;::::2;::::0;;;::::2;::::0;;;;6439:38:::2;::::0;6466:10;::::2;::::0;;::::2;7087:50:37::0;;6454:10:24::2;::::0;6439:38:::2;::::0;7075:2:37;7060:18;6439:38:24::2;;;;;;;6289:195::o:0;4745:284::-;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;-1:-1:-1;;;;;4829:24:24;::::1;4825:50;;4862:13;;-1:-1:-1::0;;;4862:13:24::1;;;;;;;;;;;4825:50;-1:-1:-1::0;;;;;4889:19:24;::::1;;::::0;;;:9:::1;:19;::::0;;;;;:28;::::1;;:19;::::0;;::::1;:28;;::::0;4885:53:::1;;4926:12;;-1:-1:-1::0;;;4926:12:24::1;;;;;;;;;;;4885:53;-1:-1:-1::0;;;;;4948:19:24;::::1;;::::0;;;:9:::1;:19;::::0;;;;;;;;:27;;-1:-1:-1;;4948:27:24::1;::::0;::::1;;::::0;;::::1;::::0;;;4990:32;;5519:41:37;;;4990:32:24::1;::::0;5492:18:37;4990:32:24::1;;;;;;;4745:284:::0;;:::o;4477:489:0:-;4666:20;2261:21:36;:19;:21::i;:::-;3361:10:24::1;::::0;-1:-1:-1;;;3361:10:24;::::1;-1:-1:-1::0;;;;;3361:10:24::1;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1::0;;;3380:15:24::1;;;;;;;;;;;3339:56;4698:22:0::2;4738:7;4747:11;4760:5;;4727:39;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;:46;4723:1;:50;;;;:::i;:::-;4698:75;;4783:37;4823:48;4856:14;4823:32;:48::i;:::-;4888:71;::::0;-1:-1:-1;;;4888:71:0;;4783:88;;-1:-1:-1;4888:9:0::2;::::0;:19:::2;::::0;:71:::2;::::0;4908:7;;4917:10:::2;::::0;4929:11;;4942:5;;;;4783:88;;4888:71:::2;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4881:78;;;;2303:20:36::0;1716:1;2809:7;:22;2629:209;2303:20;4477:489:0;;;;;;:::o;4302:248:24:-;3526:5;;-1:-1:-1;;;;;3526:5:24;3512:10;:19;3508:42;;3540:10;;-1:-1:-1;;;3540:10:24;;;;;;;;;;;3508:42;-1:-1:-1;;;;;4380:24:24;::::1;4376:50;;4413:13;;-1:-1:-1::0;;;4413:13:24::1;;;;;;;;;;;4376:50;4436:21;4460:5:::0;;-1:-1:-1;;;;;4475:16:24;;::::1;-1:-1:-1::0;;;;;;4475:16:24;::::1;::::0;::::1;::::0;;4506:37:::1;::::0;4460:5;;;::::1;::::0;;;4506:37:::1;::::0;4436:21;4506:37:::1;4366:184;4302:248:::0;:::o;15232:476:0:-;3361:10:24;;-1:-1:-1;;;3361:10:24;;-1:-1:-1;;;;;3361:10:24;3343:15;:28;3339:56;;;3380:15;;-1:-1:-1;;;3380:15:24;;;;;;;;;;;3339:56;15421:2:0::1;15406:17:::0;::::1;;15398:51;;;::::0;-1:-1:-1;;;15398:51:0;;42356:2:37;15398:51:0::1;::::0;::::1;42338:21:37::0;42395:2;42375:18;;;42368:30;-1:-1:-1;;;42414:18:37;;;42407:51;42475:18;;15398:51:0::1;42154:345:37::0;15398:51:0::1;15459:12;15482:9;15488:2;15459:12:::0;15482:4;;:9:::1;:::i;:::-;15474:18;::::0;::::1;:::i;:::-;15459:33:::0;-1:-1:-1;;;;15506:33:0;;15502:200:::1;;15555:71;::::0;-1:-1:-1;;;15555:71:0;;:15:::1;::::0;:37:::1;::::0;:71:::1;::::0;15593:12;;15607;;15621:4;;;;15555:71:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;15502:200;;;15657:34;::::0;-1:-1:-1;;;15657:34:0;;43697:2:37;15657:34:0::1;::::0;::::1;43679:21:37::0;43736:2;43716:18;;;43709:30;43775:26;43755:18;;;43748:54;43819:18;;15657:34:0::1;43495:348:37::0;15502:200:0::1;15388:320;15232:476:::0;;;;:::o;2336:287:36:-;1759:1;2468:7;;:19;2460:63;;;;-1:-1:-1;;;2460:63:36;;44050:2:37;2460:63:36;;;44032:21:37;44089:2;44069:18;;;44062:30;44128:33;44108:18;;;44101:61;44179:18;;2460:63:36;43848:355:37;2460:63:36;1759:1;2598:18;;2336:287::o;2322:1135:22:-;2398:37;;:::i;:::-;2842:26;2870:24;2898:46;2929:14;2898:30;:46::i;:::-;2841:103;;;;3030:64;3059:9;3070:7;3079:14;3030:28;:64::i;:::-;3117:306;;;;;;;;3168:46;3189:9;3199:1;3189:12;;;;;;;;:::i;:::-;;;;;;;3203:7;3211:1;3203:10;;;;;;;;:::i;:::-;;;;;;;3168:20;:46::i;:::-;3117:306;;;;3238:40;3253:9;3263:1;3253:12;;;;;;;;:::i;:::-;;;;;;;3267:7;3275:1;3267:10;;;;;;;;:::i;:::-;;;;;;;3238:14;:40::i;:::-;3117:306;;;;3305:43;3323:9;3333:1;3323:12;;;;;;;;:::i;:::-;;;;;;;3337:7;3345:1;3337:10;;;;;;;;:::i;:::-;;;;;;;3305:17;:43::i;:::-;3117:306;;;;3372:40;3387:9;3397:1;3387:12;;;;;;;;:::i;:::-;;;;;;;3401:7;3409:1;3401:10;;;;;;;;:::i;:::-;;;;;;;3372:14;:40::i;:::-;-1:-1:-1;;;;;3117:306:22;;;3105:318;2322:1135;-1:-1:-1;;;;2322:1135:22:o;4230:6236::-;4414:34;;;2138:1;4414:34;;;;;;;;;4325:26;;;;4414:34;;;;;;;;;-1:-1:-1;;4468:34:22;;;2138:1;4468:34;;;;;;;;;4402:46;;-1:-1:-1;2138:1:22;-1:-1:-1;4468:34:22;;;;;;;;;;-1:-1:-1;4468:34:22;4458:44;;4551:420;;;-1:-1:-1;;;4632:1:22;4604:135;-1:-1:-1;;;4784:4:22;4756:138;4924:1;4918:4;4911:15;;4953:3;4950:1;4943:14;4551:420;5527:4;5523:1;5507:14;5503:22;5499:33;5483:14;5479:54;5567:8;5546:1247;5590:14;5581:7;5578:27;5546:1247;;;-1:-1:-1;;;;;;5806:4:22;5797:7;5793:18;5780:32;5776:60;-1:-1:-1;;;6618:10:22;6615:38;-1:-1:-1;;;6552:10:22;6549:39;-1:-1:-1;;;6511:10:22;6508:39;6505:84;6477:198;-1:-1:-1;;;6379:10:22;6376:30;-1:-1:-1;;;6352:10:22;6349:25;6346:61;-1:-1:-1;;;6274:10:22;6271:44;-1:-1:-1;;;6226:10:22;6223:46;6220:96;6188:245;-1:-1:-1;;;6098:10:22;6095:40;-1:-1:-1;;;6054:10:22;6051:42;6048:88;-1:-1:-1;;;5985:10:22;5982:35;-1:-1:-1;;;5946:10:22;5943:37;5940:78;5908:254;5880:575;5856:837;5853:926;;;6728:7;6716:19;;6756:5;;;5853:926;-1:-1:-1;;;5619:18:22;5546:1247;;;5550:27;6938:4;6928:8;6924:19;6911:33;-1:-1:-1;;;;;;6973:14:22;6969:42;7043:1;-1:-1:-1;;;7132:4:22;7129:29;-1:-1:-1;;;7083:4:22;7080:31;7060:112;7057:164;;;-1:-1:-1;7206:1:22;7057:164;-1:-1:-1;;;7314:4:22;7311:34;-1:-1:-1;;;7260:4:22;7257:36;7237:122;7234:174;;;-1:-1:-1;7393:1:22;7234:174;-1:-1:-1;;;7505:4:22;7502:38;-1:-1:-1;;;7447:4:22;7444:40;7424:130;7421:645;;;7618:4;7608:8;7604:19;7591:33;7573:51;;-1:-1:-1;;;7669:14:22;7665:44;7660:3;7656:54;7641:69;;7795:27;7782:11;7779:44;7749:27;7736:11;7733:44;7730:94;7727:325;;;7847:161;7982:4;7890:66;7847:161;:::i;:::-;8093:1;;-1:-1:-1;8110:18:22;;8107:154;;8174:1;8161:11;8157:19;8147:29;;8107:154;-1:-1:-1;;8296:4:22;8281:20;;;8274:38;;;8360:18;;;8353:34;;;8522:17;8508:32;;-1:-1:-1;;;;;;;;;8616:19:22;;8603:33;8657:30;-1:-1:-1;;;8764:19:22;;8761:66;;8812:1;8802:11;;8761:66;-1:-1:-1;;;8846:4:22;8843:24;8840:71;;8896:1;8886:11;;8840:71;-1:-1:-1;8946:4:22;8931:20;;;8924:38;;;9004:18;;8997:34;;;9159:4;9147:17;9133:32;;-1:-1:-1;;;9255:19:22;;9242:33;-1:-1:-1;;;;;;9296:45:22;;;-1:-1:-1;;;9496:33:22;;-1:-1:-1;;;9445:33:22;;9425:118;9422:286;;;9691:1;9582:64;9586:3;9582:64;;;;9673:20;;-1:-1:-1;9422:286:22;-1:-1:-1;;9743:4:22;9728:20;;;9721:38;;;9808:18;;9801:34;;;9967:4;9955:17;9941:32;;-1:-1:-1;;;10057:19:22;;10044:33;-1:-1:-1;;;;;;;;;10161:34:22;;10158:62;10155:109;;10249:1;10239:11;;10155:109;;10306:8;10299:4;10288:9;10284:20;10277:38;10381:6;10374:4;10365:7;10361:18;10354:34;;;4230:6236;;;:::o;11156:680::-;11414:9;11409:175;11433:23;11455:1;2138;11433:23;:::i;:::-;11429:27;;:1;:27;11409:175;;;11520:7;11528:1;11520:10;;;;;;;;:::i;:::-;;;;;;;11533:2;11520:15;;;;:::i;:::-;11505:9;11515:1;11505:12;;;;;;;;:::i;:::-;;;;;;;:30;;;;:::i;:::-;11485:9;11495:5;:1;11499;11495:5;:::i;:::-;11485:16;;;;;;;;:::i;:::-;;;;;;;:50;11477:96;;;;-1:-1:-1;;;11477:96:22;;45136:2:37;11477:96:22;;;45118:21:37;45175:2;45155:18;;;45148:30;45214:34;45194:18;;;45187:62;-1:-1:-1;;;45265:18:37;;;45258:31;45306:19;;11477:96:22;44934:397:37;11477:96:22;11458:3;;;:::i;:::-;;;11409:175;;;-1:-1:-1;11778:14:22;11737:7;11745:23;11767:1;2138;11745:23;:::i;:::-;11737:32;;;;;;;;;;:::i;:::-;;;;;;;11772:2;11737:37;;;;:::i;:::-;11700:9;11710:23;11732:1;2138;11710:23;:::i;:::-;11700:34;;;;;;;;;;:::i;:::-;;;;;;;:74;;;;:::i;:::-;:92;;11692:137;;;;-1:-1:-1;;;11692:137:22;;45678:2:37;11692:137:22;;;45660:21:37;;;45697:18;;;45690:30;45756:34;45736:18;;;45729:62;45808:18;;11692:137:22;45476:356:37;11879:3865:22;11965:47;;:::i;:::-;12024:63;;12055:21;12024:63;12096:19;12118:10;12127:1;12118:6;:10;:::i;:::-;12096:32;;12733:4;12723:8;12719:19;12706:33;-1:-1:-1;;;;;;12768:14:22;12764:42;-1:-1:-1;;;13067:4:22;13064:40;-1:-1:-1;;;12987:4:22;12984:36;-1:-1:-1;;;12930:4:22;12927:31;12899:143;12875:247;12843:14;12819:317;-1:-1:-1;;;13429:4:22;13426:38;-1:-1:-1;;;13351:4:22;13348:34;-1:-1:-1;;;13296:4:22;13293:29;13265:139;13241:241;13208:14;13202:4;13198:25;13174:322;-1:-1:-1;;;13612:14:22;13608:42;13603:3;13599:52;13566:14;13560:4;13556:25;13532:133;-1:-1:-1;;;;;13771:14:22;13767:34;13734:14;13728:4;13724:25;13700:115;13896:4;13886:8;13882:19;13869:33;13851:51;;13936:12;14090:1;-1:-1:-1;;;14050:14:22;14046:42;14043:49;14040:162;;;-1:-1:-1;14128:9:22;14040:162;14243:4;14239:25;;14215:110;-1:-1:-1;;;;;14405:34:22;;14366:4;14362:25;;14338:123;14485:4;14481:25;;14474:46;;;14572:1;14556:18;;14553:1144;;;14608:1;14593:1090;14618:11;14615:1;14612:18;14593:1090;;;14734:4;14731:1;14727:12;14721:4;14717:23;14707:8;14703:38;14690:52;14672:70;;-1:-1:-1;;;;;;14780:14:22;14776:42;14858:5;14852:4;14849:15;14839:277;;14892:173;15035:4;14939:66;14892:173;:::i;:::-;-1:-1:-1;15306:3:22;15302:52;;;;;15207:4;15200:12;;15169:44;;;;;15137:239;-1:-1:-1;;;;;15586:34:22;;15459:4;15451:44;;;15419:223;14645:1;14638:9;14593:1090;;;14597:14;14553:1144;;;15716:21;11879:3865;;;;;:::o;15781:3787::-;15861:35;;:::i;:::-;15908:57;;15939:15;15908:57;16536:4;16526:8;16522:19;16509:33;-1:-1:-1;;;;;;16575:8:22;16571:30;-1:-1:-1;;;16693:8:22;16690:28;-1:-1:-1;;;16652:8:22;16649:23;16629:103;16795:7;16769:8;16745:71;16859:1;16850:7;16847:14;16879:1;16874:1353;;;;18294:1;18283:8;18277:4;18273:19;18266:30;18353:1;18342:8;18336:4;18332:19;18325:30;18415:1;18404:8;18398:4;18394:19;18387:30;18473:1;18462:8;18456:4;18452:19;18445:30;16840:1668;;16874:1353;-1:-1:-1;;;16980:8:22;16976:30;16971:3;16967:40;16936:8;16930:4;16926:19;16898:127;-1:-1:-1;;;;;17127:8:22;17123:54;17092:8;17086:4;17082:19;17054:141;17317:4;17307:8;17303:19;17290:33;17278:45;;-1:-1:-1;;;;;;17356:8:22;17352:30;17422:4;17412:8;17409:18;17399:254;;17451:161;17586:4;-1:-1:-1;;;17451:161:22;:::i;:::-;-1:-1:-1;17685:12:22;-1:-1:-1;;;17781:30:22;;17778:37;17775:140;;-1:-1:-1;17849:9:22;17775:140;17964:4;17960:19;;17932:104;-1:-1:-1;;;;;18122:54:22;;18085:4;18081:19;;18053:141;16840:1668;;;-1:-1:-1;;;18531:8:22;18528:28;18574:1;18569:797;;;;19433:1;19422:8;19416:4;19412:19;19405:30;19494:1;19483:8;19477:4;19473:19;19466:30;18521:1006;;18569:797;18683:4;18673:8;18669:19;18656:33;18644:45;;-1:-1:-1;;;;;;18722:8:22;18718:30;18788:4;18778:8;18775:18;18765:254;;18817:161;18952:4;-1:-1:-1;;;18817:161:22;:::i;:::-;18765:254;-1:-1:-1;;;19118:8:22;19114:30;19109:3;19105:40;19074:8;19068:4;19064:19;19036:127;-1:-1:-1;;;;;19267:8:22;19263:54;19232:8;19226:4;19222:19;19194:141;18521:1006;;;15781:3787;;;;:::o;19608:3521::-;19691:41;;:::i;:::-;19744:60;;19775:18;19744:60;19969:10;19978:1;19969:6;:10;:::i;:::-;-1:-1:-1;;;;;19955:25:22;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;19955:25:22;-1:-1:-1;19933:19:22;;;:47;19990:23;;20078:1;20064:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;20064:16:22;;20023:57;;20702:4;20692:8;20688:19;20675:33;-1:-1:-1;;;;;;20744:15:22;20740:45;20721:64;;20933:1;20925:6;20921:14;-1:-1:-1;;;;;20972:15:22;20968:35;20955:11;20948:56;21122:4;21112:8;21108:19;21095:33;21076:52;;-1:-1:-1;;;;;;21157:15:22;21153:45;21241:4;21224:15;21221:25;21211:248;;21266:149;21393:4;21305:66;21266:149;:::i;:::-;21211:248;21524:24;21507:15;21503:46;21496:4;21483:11;21479:22;21472:78;21632:27;21615:15;21611:49;21607:2;21603:58;21596:4;21583:11;21579:22;21572:90;-1:-1:-1;;;21693:15:22;21690:44;21687:198;;-1:-1:-1;;;21806:15:22;21802:52;21798:2;21794:61;21787:4;21764:21;21760:32;21753:103;21687:198;-1:-1:-1;;21978:19:22;;21965:33;22045:4;22018:32;;22011:57;-1:-1:-1;;22177:19:22;;22164:33;22244:4;22217:32;;22210:57;;;22191:4;22355:22;;22349:29;22164:33;;-1:-1:-1;;22391:271:22;22416:12;22413:1;22410:19;22391:271;;;22530:4;22527:1;22523:12;22517:4;22513:23;22503:8;22499:38;22486:52;22467:71;;22606:15;22598:4;22594:1;22591;22587:9;22583:20;22566:15;22562:42;22555:67;22444:1;22441;22437:9;22432:14;;22391:271;;;22395:14;;;;-1:-1:-1;;;22685:15:22;:42;22681:413;;22792:21;22814:1;22792:24;;;;;;;;:::i;:::-;;;;;;;22784:33;;22827:21;22849:1;22827:24;;;;;;;;:::i;:::-;;;;;;;22819:33;;22867:21;22889:1;22867:24;;;;;;;;:::i;:::-;;;;;;;22854:39;;22767:127;;;;;;;;;46020:19:37;;;46064:2;46055:12;;46048:28;;;;-1:-1:-1;;;;;;46106:26:37;46101:2;46092:12;;46085:48;46158:2;46149:12;;45837:330;22767:127:22;;;;-1:-1:-1;;22767:127:22;;;;;;;;;22743:21;;;:151;22681:413;;;-1:-1:-1;;;22915:15:22;:42;22911:183;;23022:21;23044:1;23022:24;;;;;;;;:::i;:::-;;;;;;;23014:33;;23057:21;23079:1;23057:24;;;;;;;;:::i;:::-;;;;;;;23049:33;;22997:86;;;;;;;;46329:19:37;;;46373:2;46364:12;;46357:28;46410:2;46401:12;;46172:247;22997:86:22;;;;-1:-1:-1;;22997:86:22;;;;;;;;;22973:21;;;:110;22911:183;23104:18;;19608:3521;;;;:::o;23166:366::-;23246:16;23278:6;23288:1;23278:11;23274:59;;-1:-1:-1;23320:1:22;23305:17;;23274:59;-1:-1:-1;;;;23414:19:22;23401:33;-1:-1:-1;;;;;23459:32:22;;23166:366::o;-1:-1:-1:-;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;363:248:37:-;431:6;439;492:2;480:9;471:7;467:23;463:32;460:52;;;508:1;505;498:12;460:52;-1:-1:-1;;531:23:37;;;601:2;586:18;;;573:32;;-1:-1:-1;363:248:37:o;616:173::-;684:20;;-1:-1:-1;;;;;733:31:37;;723:42;;713:70;;779:1;776;769:12;713:70;616:173;;;:::o;794:160::-;858:5;903:3;894:6;889:3;885:16;881:26;878:46;;;920:1;917;910:12;878:46;-1:-1:-1;942:6:37;794:160;-1:-1:-1;794:160:37:o;959:367::-;1022:8;1032:6;1086:3;1079:4;1071:6;1067:17;1063:27;1053:55;;1104:1;1101;1094:12;1053:55;-1:-1:-1;1127:20:37;;-1:-1:-1;;;;;1159:30:37;;1156:50;;;1202:1;1199;1192:12;1156:50;1239:4;1231:6;1227:17;1215:29;;1299:3;1292:4;1282:6;1279:1;1275:14;1267:6;1263:27;1259:38;1256:47;1253:67;;;1316:1;1313;1306:12;1253:67;959:367;;;;;:::o;1331:1457::-;1636:6;1644;1652;1660;1668;1676;1684;1692;1700;1753:3;1741:9;1732:7;1728:23;1724:33;1721:53;;;1770:1;1767;1760:12;1721:53;1806:9;1793:23;1783:33;;1835:38;1869:2;1858:9;1854:18;1835:38;:::i;:::-;1825:48;;1892:67;1951:7;1946:2;1935:9;1931:18;1892:67;:::i;:::-;1882:77;;2010:3;1999:9;1995:19;1982:33;-1:-1:-1;;;;;2075:2:37;2067:6;2064:14;2061:34;;;2091:1;2088;2081:12;2061:34;2130:70;2192:7;2183:6;2172:9;2168:22;2130:70;:::i;:::-;2219:8;;-1:-1:-1;2104:96:37;-1:-1:-1;2307:3:37;2292:19;;2279:33;;-1:-1:-1;2324:16:37;;;2321:36;;;2353:1;2350;2343:12;2321:36;2392:72;2456:7;2445:8;2434:9;2430:24;2392:72;:::i;:::-;2483:8;;-1:-1:-1;2366:98:37;-1:-1:-1;2571:3:37;2556:19;;2543:33;;-1:-1:-1;2588:16:37;;;2585:36;;;2617:1;2614;2607:12;2585:36;;2656:72;2720:7;2709:8;2698:9;2694:24;2656:72;:::i;:::-;2630:98;;2747:8;2737:18;;;2774:8;2764:18;;;1331:1457;;;;;;;;;;;:::o;2975:717::-;3097:6;3105;3113;3121;3129;3137;3190:3;3178:9;3169:7;3165:23;3161:33;3158:53;;;3207:1;3204;3197:12;3158:53;3243:9;3230:23;3220:33;;3300:2;3289:9;3285:18;3272:32;3262:42;;3351:2;3340:9;3336:18;3323:32;3313:42;;3374:38;3408:2;3397:9;3393:18;3374:38;:::i;:::-;3364:48;;3463:3;3452:9;3448:19;3435:33;-1:-1:-1;;;;;3483:6:37;3480:30;3477:50;;;3523:1;3520;3513:12;3477:50;3562:70;3624:7;3615:6;3604:9;3600:22;3562:70;:::i;:::-;2975:717;;;;-1:-1:-1;2975:717:37;;-1:-1:-1;2975:717:37;;3651:8;;2975:717;-1:-1:-1;;;2975:717:37:o;3697:743::-;3869:6;3877;3885;3893;3901;3954:3;3942:9;3933:7;3929:23;3925:33;3922:53;;;3971:1;3968;3961:12;3922:53;4007:9;3994:23;3984:33;;4036:38;4070:2;4059:9;4055:18;4036:38;:::i;:::-;4026:48;;4093:67;4152:7;4147:2;4136:9;4132:18;4093:67;:::i;:::-;4083:77;;4211:3;4200:9;4196:19;4183:33;-1:-1:-1;;;;;4231:6:37;4228:30;4225:50;;;4271:1;4268;4261:12;4225:50;4310:70;4372:7;4363:6;4352:9;4348:22;4310:70;:::i;:::-;3697:743;;;;-1:-1:-1;3697:743:37;;-1:-1:-1;4399:8:37;;4284:96;3697:743;-1:-1:-1;;;3697:743:37:o;4445:642::-;4558:6;4566;4574;4582;4590;4643:3;4631:9;4622:7;4618:23;4614:33;4611:53;;;4660:1;4657;4650:12;4611:53;4696:9;4683:23;4673:33;;4753:2;4742:9;4738:18;4725:32;4715:42;;4804:2;4793:9;4789:18;4776:32;4766:42;;4859:2;4848:9;4844:18;4831:32;-1:-1:-1;;;;;4878:6:37;4875:30;4872:50;;;4918:1;4915;4908:12;5092:186;5151:6;5204:2;5192:9;5183:7;5179:23;5175:32;5172:52;;;5220:1;5217;5210:12;5172:52;5243:29;5262:9;5243:29;:::i;:::-;5233:39;5092:186;-1:-1:-1;;;5092:186:37:o;6290:423::-;6332:3;6370:5;6364:12;6397:6;6392:3;6385:19;6422:1;6432:162;6446:6;6443:1;6440:13;6432:162;;;6508:4;6564:13;;;6560:22;;6554:29;6536:11;;;6532:20;;6525:59;6461:12;6432:162;;;6436:3;6639:1;6632:4;6623:6;6618:3;6614:16;6610:27;6603:38;6702:4;6695:2;6691:7;6686:2;6678:6;6674:15;6670:29;6665:3;6661:39;6657:50;6650:57;;;6290:423;;;;:::o;6718:220::-;6867:2;6856:9;6849:21;6830:4;6887:45;6928:2;6917:9;6913:18;6905:6;6887:45;:::i;8112:388::-;8219:6;8227;8235;8288:3;8276:9;8267:7;8263:23;8259:33;8256:53;;;8305:1;8302;8295:12;8256:53;8341:9;8328:23;8318:33;;8370:38;8404:2;8393:9;8389:18;8370:38;:::i;:::-;8360:48;;8427:67;8486:7;8481:2;8470:9;8466:18;8427:67;:::i;:::-;8417:77;;8112:388;;;;;:::o;8505:1383::-;8801:6;8809;8817;8825;8833;8841;8849;8857;8910:3;8898:9;8889:7;8885:23;8881:33;8878:53;;;8927:1;8924;8917:12;8878:53;8963:9;8950:23;8940:33;;8992:67;9051:7;9046:2;9035:9;9031:18;8992:67;:::i;:::-;8982:77;;9110:3;9099:9;9095:19;9082:33;-1:-1:-1;;;;;9175:2:37;9167:6;9164:14;9161:34;;;9191:1;9188;9181:12;9161:34;9230:70;9292:7;9283:6;9272:9;9268:22;9230:70;:::i;:::-;9319:8;;-1:-1:-1;9204:96:37;-1:-1:-1;9407:3:37;9392:19;;9379:33;;-1:-1:-1;9424:16:37;;;9421:36;;;9453:1;9450;9443:12;9421:36;9492:72;9556:7;9545:8;9534:9;9530:24;9492:72;:::i;:::-;9583:8;;-1:-1:-1;9466:98:37;-1:-1:-1;9671:3:37;9656:19;;9643:33;;-1:-1:-1;9688:16:37;;;9685:36;;;9717:1;9714;9707:12;9685:36;;9756:72;9820:7;9809:8;9798:9;9794:24;9756:72;:::i;:::-;8505:1383;;;;-1:-1:-1;8505:1383:37;;-1:-1:-1;8505:1383:37;;;;;;9847:8;-1:-1:-1;;;8505:1383:37:o;10612:160::-;10677:20;;10733:13;;10726:21;10716:32;;10706:60;;10762:1;10759;10752:12;10777:254;10842:6;10850;10903:2;10891:9;10882:7;10878:23;10874:32;10871:52;;;10919:1;10916;10909:12;10871:52;10942:29;10961:9;10942:29;:::i;:::-;10932:39;;10990:35;11021:2;11010:9;11006:18;10990:35;:::i;:::-;10980:45;;10777:254;;;;;:::o;11036:669::-;11199:6;11207;11215;11223;11276:3;11264:9;11255:7;11251:23;11247:33;11244:53;;;11293:1;11290;11283:12;11244:53;11329:9;11316:23;11306:33;;11358:67;11417:7;11412:2;11401:9;11397:18;11358:67;:::i;:::-;11348:77;;11476:3;11465:9;11461:19;11448:33;-1:-1:-1;;;;;11496:6:37;11493:30;11490:50;;;11536:1;11533;11526:12;11490:50;11575:70;11637:7;11628:6;11617:9;11613:22;11575:70;:::i;:::-;11036:669;;;;-1:-1:-1;11664:8:37;-1:-1:-1;;;;11036:669:37:o;11710:725::-;11796:6;11804;11812;11820;11873:2;11861:9;11852:7;11848:23;11844:32;11841:52;;;11889:1;11886;11879:12;11841:52;11925:9;11912:23;11902:33;;11982:2;11971:9;11967:18;11954:32;11944:42;;12037:2;12026:9;12022:18;12009:32;-1:-1:-1;;;;;12101:2:37;12093:6;12090:14;12087:34;;;12117:1;12114;12107:12;12087:34;12155:6;12144:9;12140:22;12130:32;;12200:7;12193:4;12189:2;12185:13;12181:27;12171:55;;12222:1;12219;12212:12;12171:55;12262:2;12249:16;12288:2;12280:6;12277:14;12274:34;;;12304:1;12301;12294:12;12274:34;12349:7;12344:2;12335:6;12331:2;12327:15;12323:24;12320:37;12317:57;;;12370:1;12367;12360:12;12317:57;11710:725;;;;-1:-1:-1;;12401:2:37;12393:11;;-1:-1:-1;;;11710:725:37:o;12693:127::-;12754:10;12749:3;12745:20;12742:1;12735:31;12785:4;12782:1;12775:15;12809:4;12806:1;12799:15;12825:125;12890:9;;;12911:10;;;12908:36;;;12924:18;;:::i;13502:918::-;13621:1;13617;13612:3;13608:11;13604:19;13596:5;13590:12;13586:38;13581:3;13574:51;13556:3;13644:4;13695:2;13688:5;13684:14;13678:21;13673:2;13668:3;13664:12;13657:43;13749:4;13742:5;13738:16;13732:23;13725:4;13720:3;13716:14;13709:47;13802:4;13795:5;13791:16;13785:23;13840:4;13833;13828:3;13824:14;13817:28;13866:47;13907:4;13902:3;13898:14;13884:12;13866:47;:::i;:::-;13961:4;13950:16;;;13944:23;13999:14;;;13983;;;13976:38;;;;14063:21;;14093:20;;;14167:23;;;;-1:-1:-1;;;14131:13:37;;;14218:175;14232:6;14229:1;14226:13;14218:175;;;14295:13;;14281:28;;14368:15;;;;14254:1;14247:9;;;;;14331:14;;;;14218:175;;;-1:-1:-1;14409:5:37;13502:918;-1:-1:-1;;;;;;13502:918:37:o;14425:2453::-;14477:3;14505:6;14536:5;14530:12;14551:31;14578:3;14573:2;14567:9;5353:13;5346:21;5334:34;;5283:91;14551:31;14625:4;14621:2;14617:13;14611:20;14640:45;14679:4;14674:3;14670:14;14656:12;5353:13;5346:21;5334:34;;5283:91;14640:45;;14731:4;14727:2;14723:13;14717:20;14710:4;14705:3;14701:14;14694:44;14784:4;14780:2;14776:13;14770:20;14763:4;14758:3;14754:14;14747:44;14837:4;14833:2;14829:13;14823:20;14816:4;14811:3;14807:14;14800:44;14890:4;14886:2;14882:13;14876:20;14869:4;14864:3;14860:14;14853:44;14942:4;14938:2;14934:13;14928:20;14957:50;15001:4;14996:3;14992:14;14976;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;14957:50;;15053:4;15049:2;15045:13;15039:20;15032:4;15027:3;15023:14;15016:44;15079:6;15130:2;15126;15122:11;15116:18;15143:48;15187:2;15182:3;15178:12;15162:14;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;15143:48;-1:-1:-1;;15210:6:37;15252:11;;;15246:18;15232:12;;;15225:40;15284:6;15327:11;;;15321:18;-1:-1:-1;;;;;7214:31:37;;;15383:12;;;7202:44;;;;15415:6;15457:11;;;15451:18;15437:12;;;15430:40;15489:6;15532:11;;;15526:18;7214:31;;15588:12;;;7202:44;15620:6;15662:11;;;15656:18;15642:12;;;15635:40;15694:6;15737:11;;;15731:18;7214:31;;15793:12;;;7202:44;15826:6;15869:12;;;15863:19;15848:13;;;15841:42;15903:6;15946:12;;;15940:19;7214:31;;16003:13;;;7202:44;16037:6;16080:12;;;16074:19;16059:13;;;16052:42;16114:6;16157:12;;;16151:19;7214:31;;16214:13;;;7202:44;16248:6;16291:12;;;16285:19;16270:13;;;16263:42;16325:6;16368:12;;;16362:19;7214:31;;16425:13;;;7202:44;;;;16487:4;16476:16;;;16470:23;13043:12;;13036:20;13029:28;16554:6;16545:16;;13017:41;13096:16;;;13090:23;13074:14;;;13067:47;13160:4;13149:16;;;13143:23;13236:21;;13220:14;;;13213:45;13307:4;13296:16;;13290:23;13274:14;;;13267:47;13363:4;13352:16;;13346:23;13330:14;;;13323:47;13193:3;13408:16;;13402:23;13386:14;;;13379:47;13479:4;13468:16;;;13462:23;13458:32;;;13442:14;;;13435:56;16600:16;;16594:23;16642:6;16633:16;;16626:28;;;16675:60;16722:12;;;16594:23;16675:60;:::i;:::-;16663:72;;;16784:4;16777:5;16773:16;16767:23;16799:53;16844:6;16839:3;16835:16;16818:15;-1:-1:-1;;;;;7214:31:37;7202:44;;7148:104;16799:53;-1:-1:-1;16868:4:37;14425:2453;-1:-1:-1;;;14425:2453:37:o;16883:412::-;17128:6;17117:9;17110:25;17171:6;17166:2;17155:9;17151:18;17144:34;17214:2;17209;17198:9;17194:18;17187:30;17091:4;17234:55;17285:2;17274:9;17270:18;17262:6;17234:55;:::i;17300:396::-;17386:19;;17374:32;;-1:-1:-1;;;;;17442:36:37;17472:4;17461:16;;17442:36;:::i;:::-;17438:62;17431:4;17426:3;17422:14;17415:86;17557:4;17550:5;17546:16;17533:30;17526:4;17521:3;17517:14;17510:54;17620:4;17613:5;17609:16;17596:30;17589:4;17584:3;17580:14;17573:54;17683:4;17676:5;17672:16;17659:30;17652:4;17647:3;17643:14;17636:54;;;17300:396::o;17701:311::-;17789:19;;;17771:3;-1:-1:-1;;;;;17820:31:37;;17817:51;;;17864:1;17861;17854:12;17817:51;17900:6;17897:1;17893:14;17952:8;17945:5;17938:4;17933:3;17929:14;17916:45;17981:18;;;;18001:4;17977:29;;17701:311;-1:-1:-1;;;17701:311:37:o;18017:520::-;18087:5;18094:6;18154:3;18141:17;18240:2;18236:7;18225:8;18209:14;18205:29;18201:43;18181:18;18177:68;18167:96;;18259:1;18256;18249:12;18167:96;18287:33;;18391:4;18378:18;;;-1:-1:-1;18339:21:37;;-1:-1:-1;;;;;;18408:30:37;;18405:50;;;18451:1;18448;18441:12;18405:50;18505:6;18502:1;18498:14;18482;18478:35;18471:5;18467:47;18464:67;;;18527:1;18524;18517:12;18542:447;18642:6;18637:3;18630:19;18612:3;18668:4;18697:2;18692:3;18688:12;18681:19;;18723:5;18746:1;18756:208;18770:6;18767:1;18764:13;18756:208;;;-1:-1:-1;;;;;18835:26:37;18854:6;18835:26;:::i;:::-;18831:52;18819:65;;18904:12;;;;18939:15;;;;18792:1;18785:9;18756:208;;;-1:-1:-1;18980:3:37;;18542:447;-1:-1:-1;;;;;18542:447:37:o;18994:266::-;19082:6;19077:3;19070:19;19134:6;19127:5;19120:4;19115:3;19111:14;19098:43;-1:-1:-1;19186:1:37;19161:16;;;19179:4;19157:27;;;19150:38;;;;19242:2;19221:15;;;-1:-1:-1;;19217:29:37;19208:39;;;19204:50;;18994:266::o;19265:500::-;19323:5;19330:6;19390:3;19377:17;19476:2;19472:7;19461:8;19445:14;19441:29;19437:43;19417:18;19413:68;19403:96;;19495:1;19492;19485:12;19403:96;19523:33;;19627:4;19614:18;;;-1:-1:-1;19575:21:37;;-1:-1:-1;;;;;;19644:30:37;;19641:50;;;19687:1;19684;19677:12;19641:50;19734:6;19718:14;19714:27;19707:5;19703:39;19700:59;;;19755:1;19752;19745:12;19770:296;19840:5;19899:3;19886:17;19985:3;19981:8;19970;19954:14;19950:29;19946:44;19926:18;19922:69;19912:97;;20005:1;20002;19995:12;19912:97;20027:33;;;;19770:296;-1:-1:-1;;19770:296:37:o;20071:2501::-;20190:6;20185:3;20178:19;20160:3;20216:4;20257:2;20252:3;20248:12;20282:11;20309;20302:18;;20339:1;20329:11;;20380:6;20376:2;20372:15;20365:5;20361:27;20411:5;20434:1;20455;20465:2081;20481:6;20476:3;20473:15;20465:2081;;;20556:5;20550:4;20546:16;20541:3;20534:29;20586:57;20636:6;20629:5;20586:57;:::i;:::-;20666:4;20717:50;20764:2;20760;20717:50;:::i;:::-;20793:2;20787:4;20780:16;20823:80;20899:2;20893:4;20889:13;20875:12;20861;20823:80;:::i;:::-;20809:94;;;;20954:59;21009:2;21005;21001:11;20997:2;20954:59;:::i;:::-;21060:4;21052:6;21048:17;21043:2;21037:4;21033:13;21026:40;21093:77;21163:6;21147:14;21131;21093:77;:::i;:::-;21079:91;;;;21193:4;21248:59;21303:2;21299;21295:11;21291:2;21248:59;:::i;:::-;21354:4;21346:6;21342:17;21337:2;21331:4;21327:13;21320:40;21387:77;21457:6;21441:14;21425;21387:77;:::i;:::-;21373:91;;;;;21487:4;21542:59;21597:2;21593;21589:11;21585:2;21542:59;:::i;:::-;21636:17;;;21621:13;;;21614:40;;;;21699:30;;;21751:15;;;;21809:23;;;21797:36;;21793:45;;21867:14;21905:1;21919:432;21935:14;21930:3;21927:23;21919:432;;;22022:19;;;-1:-1:-1;;22018:33:37;22004:48;;22105:56;22152:8;22136:14;22105:56;:::i;:::-;22188:63;22244:6;22229:13;22214;22188:63;:::i;:::-;22178:73;;;;22294:2;22284:8;22280:17;22268:29;;22334:2;22327:5;22323:14;22314:23;;21969:1;21964:3;21960:11;21953:18;;21919:432;;;-1:-1:-1;;22374:4:37;22426:11;;;22413:25;22398:13;;;;22391:48;;;;-1:-1:-1;;;22524:12:37;;;;22460:6;-1:-1:-1;22489:15:37;;;;20507:1;20498:11;20465:2081;;;-1:-1:-1;22562:4:37;;20071:2501;-1:-1:-1;;;;;;;;;20071:2501:37:o;22577:788::-;22715:6;22710:3;22703:19;22685:3;22741:4;22782:2;22777:3;22773:12;22807:11;22834;22827:18;;22884:6;22881:1;22877:14;22870:5;22866:26;22854:38;;22915:5;22938:1;22948:391;22962:6;22959:1;22956:13;22948:391;;;23033:5;23027:4;23023:16;23018:3;23011:29;23089:57;23139:6;23132:5;23089:57;:::i;:::-;23167:92;23254:4;23239:13;23224;23167:92;:::i;:::-;23317:12;;;;23159:100;-1:-1:-1;;;23282:15:37;;;;22984:1;22977:9;22948:391;;;-1:-1:-1;23355:4:37;;22577:788;-1:-1:-1;;;;;;;22577:788:37:o;23370:2126::-;23493:6;23488:3;23481:19;23463:3;23519:4;23560:2;23555:3;23551:12;23585:11;23612;23605:18;;23662:6;23659:1;23655:14;23648:5;23644:26;23632:38;;23693:5;23716:1;23737;23747:1723;23763:6;23758:3;23755:15;23747:1723;;;23838:5;23832:4;23828:16;23823:3;23816:29;23897:6;23884:20;23987:3;23983:8;23975:5;23959:14;23955:26;23951:41;23931:18;23927:66;23917:94;;24007:1;24004;23997:12;23917:94;24039:30;;24124:21;;24111:35;;24092:6;24179:36;24198:16;;;24179:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24261:13;;;7202:44;24298:4;24337:36;24356:16;;;24337:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24421:13;;;7202:44;24458:4;24497:36;24516:16;;;24497:36;:::i;:::-;-1:-1:-1;;;;;7214:31:37;24581:13;;;7202:44;24618:4;24670:16;;;24657:30;24642:13;;;24635:53;24711:4;24763:16;;;24750:30;24735:13;;;24728:53;24804:4;24856:16;;;24843:30;24828:13;;;24821:53;24897:4;24949:16;;;24936:30;24921:13;;;24914:53;24990:6;25031:33;25047:16;;;25031:33;:::i;:::-;5353:13;5346:21;25109:13;;;5334:34;25147:6;25202:58;25242:17;;;25246:7;25202:58;:::i;:::-;25166:94;;25296:2;25290:3;25284:4;25280:14;25273:26;25320:70;25386:2;25380:4;25376:13;25362:12;25346:14;25320:70;:::i;:::-;25448:12;;;;25312:78;-1:-1:-1;;;25413:15:37;;;;-1:-1:-1;;23789:1:37;23780:11;23747:1723;;;-1:-1:-1;25486:4:37;;23370:2126;-1:-1:-1;;;;;;;;23370:2126:37:o;25501:1339::-;26186:25;;;-1:-1:-1;;;;;26247:32:37;;26242:2;26227:18;;26220:60;26145:4;26174:3;26289:66;26351:2;26336:18;;26328:6;26289:66;:::i;:::-;26392:2;26386:3;26375:9;26371:19;26364:31;26418:73;26487:2;26476:9;26472:18;26464:6;26456;26418:73;:::i;:::-;26404:87;;26540:9;26532:6;26528:22;26522:3;26511:9;26507:19;26500:51;26574:99;26666:6;26658;26650;26574:99;:::i;:::-;26560:113;;26722:9;26714:6;26710:22;26704:3;26693:9;26689:19;26682:51;26750:84;26827:6;26819;26811;26750:84;:::i;:::-;26742:92;25501:1339;-1:-1:-1;;;;;;;;;;;;25501:1339:37:o;26845:2540::-;27003:6;26998:3;26991:19;26973:3;27029:4;27070:2;27065:3;27061:12;27095:11;27122;27115:18;;27152:1;27142:11;;27193:6;27189:2;27185:15;27178:5;27174:27;27224:5;27247:1;27268;27278:2081;27294:6;27289:3;27286:15;27278:2081;;;27369:5;27363:4;27359:16;27354:3;27347:29;27399:57;27449:6;27442:5;27399:57;:::i;:::-;27479:4;27530:50;27577:2;27573;27530:50;:::i;:::-;27606:2;27600:4;27593:16;27636:80;27712:2;27706:4;27702:13;27688:12;27674;27636:80;:::i;:::-;27622:94;;;;27767:59;27822:2;27818;27814:11;27810:2;27767:59;:::i;:::-;27873:4;27865:6;27861:17;27856:2;27850:4;27846:13;27839:40;27906:77;27976:6;27960:14;27944;27906:77;:::i;:::-;27892:91;;;;28006:4;28061:59;28116:2;28112;28108:11;28104:2;28061:59;:::i;:::-;28167:4;28159:6;28155:17;28150:2;28144:4;28140:13;28133:40;28200:77;28270:6;28254:14;28238;28200:77;:::i;:::-;28186:91;;;;;28300:4;28355:59;28410:2;28406;28402:11;28398:2;28355:59;:::i;:::-;28449:17;;;28434:13;;;28427:40;;;;28512:30;;;28564:15;;;;28622:23;;;28610:36;;28606:45;;28680:14;28718:1;28732:432;28748:14;28743:3;28740:23;28732:432;;;28835:19;;;-1:-1:-1;;28831:33:37;28817:48;;28918:56;28965:8;28949:14;28918:56;:::i;:::-;29001:63;29057:6;29042:13;29027;29001:63;:::i;:::-;28991:73;;;;29107:2;29097:8;29093:17;29081:29;;29147:2;29140:5;29136:14;29127:23;;28782:1;28777:3;28773:11;28766:18;;28732:432;;;-1:-1:-1;;29187:4:37;29239:11;;;29226:25;29211:13;;;;29204:48;;;;-1:-1:-1;;;29337:12:37;;;;29273:6;-1:-1:-1;29302:15:37;;;;27320:1;27311:11;27278:2081;;29390:1787;29968:4;29997:3;30027:6;30016:9;30009:25;30053:2;30120:1;30116;30111:3;30107:11;30103:19;30095:6;30091:32;30086:2;30075:9;30071:18;30064:60;30133:66;30195:2;30184:9;30180:18;30172:6;30133:66;:::i;:::-;30236:2;30230:3;30219:9;30215:19;30208:31;30262:73;30331:2;30320:9;30316:18;30308:6;30300;30262:73;:::i;:::-;30372:22;;;30366:3;30351:19;;30344:51;30430:22;;;30248:87;-1:-1:-1;30468:15:37;;;30526:1;30522:14;;;30510:27;;30506:36;;30565:6;30589:1;30599:452;30613:6;30610:1;30607:13;30599:452;;;30678:19;;;-1:-1:-1;;30674:33:37;30662:46;;30757:58;30808:6;30800;30757:58;:::i;:::-;30838:133;30964:6;30949:13;30934;30838:133;:::i;:::-;31029:12;;;;30828:143;-1:-1:-1;;;30994:15:37;;;;30635:1;30628:9;30599:452;;;30603:3;;31100:9;31092:6;31088:22;31082:3;31071:9;31067:19;31060:51;31128:43;31164:6;31156;31128:43;:::i;:::-;31120:51;29390:1787;-1:-1:-1;;;;;;;;;;;;;;29390:1787:37:o;31182:184::-;31252:6;31305:2;31293:9;31284:7;31280:23;31276:32;31273:52;;;31321:1;31318;31311:12;31273:52;-1:-1:-1;31344:16:37;;31182:184;-1:-1:-1;31182:184:37:o;31371:601::-;31672:6;31661:9;31654:25;31715:6;31710:2;31699:9;31695:18;31688:34;31758:6;31753:2;31742:9;31738:18;31731:34;31830:1;31826;31821:3;31817:11;31813:19;31805:6;31801:32;31796:2;31785:9;31781:18;31774:60;31871:3;31865;31854:9;31850:19;31843:32;31635:4;31892:74;31961:3;31950:9;31946:19;31938:6;31930;31892:74;:::i;31977:815::-;32366:6;32355:9;32348:25;32409:6;32404:2;32393:9;32389:18;32382:34;32452:6;32447:2;32436:9;32432:18;32425:34;32524:1;32520;32515:3;32511:11;32507:19;32499:6;32495:32;32490:2;32479:9;32475:18;32468:60;32565:3;32559;32548:9;32544:19;32537:32;32329:4;32592:74;32661:3;32650:9;32646:19;32638:6;32630;32592:74;:::i;:::-;32715:9;32707:6;32703:22;32697:3;32686:9;32682:19;32675:51;32743:43;32779:6;32771;32743:43;:::i;:::-;32735:51;31977:815;-1:-1:-1;;;;;;;;;;31977:815:37:o;32797:715::-;33188:25;;;-1:-1:-1;;;;;33249:32:37;;33244:2;33229:18;;33222:60;33147:4;33176:3;33291:66;33353:2;33338:18;;33330:6;33291:66;:::i;:::-;33394:2;33388:3;33377:9;33373:19;33366:31;33414:92;33502:2;33491:9;33487:18;33479:6;33471;33414:92;:::i;33517:968::-;33996:25;;;-1:-1:-1;;;;;34057:32:37;;34052:2;34037:18;;34030:60;33955:4;33984:3;34099:66;34161:2;34146:18;;34138:6;34099:66;:::i;:::-;34202:2;34196:3;34185:9;34181:19;34174:31;34228:131;34355:2;34344:9;34340:18;34332:6;34324;34228:131;:::i;:::-;34214:145;;34408:9;34400:6;34396:22;34390:3;34379:9;34375:19;34368:51;34436:43;34472:6;34464;34436:43;:::i;34490:503::-;34763:6;34752:9;34745:25;34806:6;34801:2;34790:9;34786:18;34779:34;34849:6;34844:2;34833:9;34829:18;34822:34;34892:3;34887:2;34876:9;34872:18;34865:31;34726:4;34913:74;34982:3;34971:9;34967:19;34959:6;34951;34913:74;:::i;:::-;34905:82;34490:503;-1:-1:-1;;;;;;;34490:503:37:o;34998:717::-;35359:6;35348:9;35341:25;35402:6;35397:2;35386:9;35382:18;35375:34;35445:6;35440:2;35429:9;35425:18;35418:34;35488:3;35483:2;35472:9;35468:18;35461:31;35322:4;35515:74;35584:3;35573:9;35569:19;35561:6;35553;35515:74;:::i;:::-;35638:9;35630:6;35626:22;35620:3;35609:9;35605:19;35598:51;35666:43;35702:6;35694;35666:43;:::i;35720:640::-;36055:25;;;-1:-1:-1;;;;;36116:32:37;;36111:2;36096:18;;36089:60;36014:4;36043:3;36158:66;36220:2;36205:18;;36197:6;36158:66;:::i;:::-;36261:2;36255:3;36244:9;36240:19;36233:31;36281:73;36350:2;36339:9;36335:18;36327:6;36319;36281:73;:::i;36365:854::-;36788:25;;;-1:-1:-1;;;;;36849:32:37;;36844:2;36829:18;;36822:60;36747:4;36776:3;36891:66;36953:2;36938:18;;36930:6;36891:66;:::i;:::-;36994:2;36988:3;36977:9;36973:19;36966:31;37020:73;37089:2;37078:9;37074:18;37066:6;37058;37020:73;:::i;37732:436::-;37993:25;;;-1:-1:-1;;;;;38054:32:37;;38049:2;38034:18;;38027:60;37980:3;37965:19;;38096:66;38158:2;38143:18;;38135:6;38096:66;:::i;38173:622::-;38508:25;;;-1:-1:-1;;;;;38569:32:37;;38564:2;38549:18;;38542:60;38467:4;38496:3;38611:66;38673:2;38658:18;;38650:6;38611:66;:::i;:::-;38714:2;38708:3;38697:9;38693:19;38686:31;38734:55;38785:2;38774:9;38770:18;38762:6;38734:55;:::i;38800:1242::-;39416:4;39445:3;39475:6;39464:9;39457:25;39491:66;39553:2;39542:9;39538:18;39530:6;39491:66;:::i;:::-;39594:2;39588:3;39577:9;39573:19;39566:31;39620:73;39689:2;39678:9;39674:18;39666:6;39658;39620:73;:::i;:::-;39606:87;;39742:9;39734:6;39730:22;39724:3;39713:9;39709:19;39702:51;39776:99;39868:6;39860;39852;39776:99;:::i;:::-;39762:113;;39924:9;39916:6;39912:22;39906:3;39895:9;39891:19;39884:51;39952:84;40029:6;40021;40013;39952:84;:::i;:::-;39944:92;38800:1242;-1:-1:-1;;;;;;;;;;;38800:1242:37:o;41551:598::-;41910:6;41899:9;41892:25;41926:66;41988:2;41977:9;41973:18;41965:6;41926:66;:::i;:::-;42029:3;42023;42012:9;42008:19;42001:32;41873:4;42050:93;42138:3;42127:9;42123:19;42115:6;42107;42050:93;:::i;42504:331::-;42609:9;42620;42662:8;42650:10;42647:24;42644:44;;;42684:1;42681;42674:12;42644:44;42713:6;42703:8;42700:20;42697:40;;;42733:1;42730;42723:12;42697:40;-1:-1:-1;;42759:23:37;;;42804:25;;;;;-1:-1:-1;42504:331:37:o;42840:255::-;42960:19;;42999:2;42991:11;;42988:101;;;-1:-1:-1;;43060:2:37;43056:12;;;43053:1;43049:20;43045:33;43034:45;42840:255;;;;:::o;43100:390::-;43317:6;43306:9;43299:25;43360:6;43355:2;43344:9;43340:18;43333:34;43403:2;43398;43387:9;43383:18;43376:30;43280:4;43423:61;43480:2;43469:9;43465:18;43457:6;43449;43423:61;:::i;44208:127::-;44269:10;44264:3;44260:20;44257:1;44250:31;44300:4;44297:1;44290:15;44324:4;44321:1;44314:15;44340:127;44401:10;44396:3;44392:20;44389:1;44382:31;44432:4;44429:1;44422:15;44456:4;44453:1;44446:15;44472:151;44562:4;44555:12;;;44541;;;44537:31;;44580:14;;44577:40;;;44597:18;;:::i;44628:168::-;44701:9;;;44732;;44749:15;;;44743:22;;44729:37;44719:71;;44770:18;;:::i;44801:128::-;44868:9;;;44889:11;;;44886:37;;;44903:18;;:::i;45336:135::-;45375:3;45396:17;;;45393:43;;45416:18;;:::i;:::-;-1:-1:-1;45463:1:37;45452:13;;45336:135::o","linkReferences":{"contracts/8/router/DagRouter.sol":{"DagRouter":[{"start":2080,"length":20},{"start":4498,"length":20}]},"contracts/8/router/UnxswapRouter.sol":{"UnxswapRouter":[{"start":1793,"length":20},{"start":3098,"length":20},{"start":3846,"length":20}]},"contracts/8/router/SwapWrapRouter.sol":{"SwapWrapRouter":[{"start":1236,"length":20},{"start":3290,"length":20}]},"contracts/8/router/SmartSwapRouter.sol":{"SmartSwapRouter":[{"start":1499,"length":20},{"start":3554,"length":20}]},"contracts/8/router/UnxswapV3Router.sol":{"UnxswapV3Router":[{"start":2365,"length":20},{"start":2725,"length":20},{"start":4978,"length":20}]}},"immutableReferences":{}}}}}}},"signatures":{"function":[{"signature":"dagSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])","signatureHash4":"0xf2c42696","signatureHash32":"0xf2c42696669720417c2b0f4291b3aa531103edcb08f504a40e78abb6822a482a"},{"signature":"dagSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),(address[],address[],uint256[],bytes[],uint256)[])","signatureHash4":"0x0c307f76","signatureHash32":"0x0c307f76ca72bdb3e46836252ed5a7f1519d85e83c271f3511860c439b0f02c1"},{"signature":"isPaused()","signatureHash4":"0xb187bd26","signatureHash32":"0xb187bd2625dabf471d1f3bd50a44225753699aa87d046d3b53bf00dfebd06f94"},{"signature":"owner()","signatureHash4":"0x8da5cb5b","signatureHash32":"0x8da5cb5b36e7f68c1d2e56001220cdbdd3ba2616072f718acfda4a06441a807d"},{"signature":"pause()","signatureHash4":"0x8456cb59","signatureHash32":"0x8456cb591a934d53f6ccc6332123a165a1f3562907bf11330d847a29ca49eb89"},{"signature":"pauseByReporter()","signatureHash4":"0xba0863ab","signatureHash32":"0xba0863ab2940e6a1bdfe7fbcd4538a9e09e97c0d4a7cb3ef7d991be1fd11f97b"},{"signature":"pauseUntil()","signatureHash4":"0x7e3db158","signatureHash32":"0x7e3db158d3db3c56b36be0d64d8cf82d34efb2cff65e7e9efe10c5bbd45730f8"},{"signature":"reporters(address)","signatureHash4":"0x2cc1cd9e","signatureHash32":"0x2cc1cd9ee8ac899310aaf3cbc89cb96982f1a5251b50bb0cdfa45e0656f0a998"},{"signature":"setReporter(address,bool)","signatureHash4":"0xe1bb5133","signatureHash32":"0xe1bb5133a1ea76dccc2f16b792148983bb62b34c8c150cf3f7b08ca793413421"},{"signature":"smartSwapByOrderId(uint256,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])","signatureHash4":"0xb80c2f09","signatureHash32":"0xb80c2f09f1ed45d59b13a8c792639ec8a30a115642b4cced425d67c407dee8f1"},{"signature":"smartSwapTo(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[],(address[],address[],uint256[],bytes[],uint256)[][],(uint256,address,address,address,uint256,uint256,uint256,uint256,bool,bytes)[])","signatureHash4":"0x03b87e5f","signatureHash32":"0x03b87e5fc58001b74541a7039a02a56987ff7d3cc24368482995310a19e0d558"},{"signature":"swapWrapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256))","signatureHash4":"0x98d2ac62","signatureHash32":"0x98d2ac624642ded3ae37897c1571d2ca7d62304b7136bc7040cf88138c5aa15f"},{"signature":"swapWrap(uint256,uint256)","signatureHash4":"0x01617fab","signatureHash32":"0x01617fabb8db9fdea5885a7e4a826ed77eb32c129b0449b6b6579c63263aa394"},{"signature":"transferOwnership(address)","signatureHash4":"0xf2fde38b","signatureHash32":"0xf2fde38b092330466c661fc723d5289b90272a3e580e3187d1d7ef788506c557"},{"signature":"uniswapV3SwapCallback(int256,int256,bytes)","signatureHash4":"0xfa461e33","signatureHash32":"0xfa461e33028c3f5ba6fd24f0f40b936af65270d771ddf3e963f1798ed73aadc4"},{"signature":"uniswapV3SwapTo(uint256,uint256,uint256,uint256[])","signatureHash4":"0x0d5f0e3b","signatureHash32":"0x0d5f0e3bb9b8cae796f74d40dcab96e69902e2ce0cc08411fcd0e11db3d088a4"},{"signature":"uniswapV3SwapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),uint256[])","signatureHash4":"0x44014e98","signatureHash32":"0x44014e98cd9be761a4bedcbaf3c556be7b991fc5134790acdcaba1edd4202813"},{"signature":"unpause()","signatureHash4":"0x3f4ba83a","signatureHash32":"0x3f4ba83af89dc9793996d9e56b8abe6dc88cd97c9c2bb23027806e9c1ffd54dc"},{"signature":"unxswapByOrderId(uint256,uint256,uint256,bytes32[])","signatureHash4":"0x9871efa4","signatureHash32":"0x9871efa43b5c109f509d7855d3617247b22bc6cfdf20df0e8a1e4622ba8e0d83"},{"signature":"unxswapTo(uint256,uint256,uint256,address,bytes32[])","signatureHash4":"0x08298b5a","signatureHash32":"0x08298b5ac4d18597d35f5e6d39421da07ebe1805c3e9e7d045f9a75f66e5faeb"},{"signature":"unxswapToWithBaseRequest(uint256,address,(uint256,address,uint256,uint256,uint256),bytes32[])","signatureHash4":"0xb8815477","signatureHash32":"0xb88154778feca0a1e29911d31116a65c7210d858a5b7f2541619a2f198d95d3f"},{"signature":"version()","signatureHash4":"0x54fd4d50","signatureHash32":"0x54fd4d50fce680dbc2593d9e893064bfa880e5642d0036394e1a1849f7fc0749"}],"event":[{"signature":"OwnerChanged(address,address)","signatureHash4":"0xb532073b","signatureHash32":"0xb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c"},{"signature":"OwnerPaused()","signatureHash4":"0xe87c0617","signatureHash32":"0xe87c0617b224ad42109d34a366489608a977d9d0b5a0f42333560b64dc1857da"},{"signature":"OwnerUnpaused()","signatureHash4":"0xa630ddbc","signatureHash32":"0xa630ddbc6d065093502b684cfc802453dbc9e818363e0b1e91987134eba72822"},{"signature":"ReporterPaused(address,uint64)","signatureHash4":"0x74f73747","signatureHash32":"0x74f737474e51e6f21594544da726e535efe4bdda2283013fa9f77835b7f9163b"},{"signature":"ReporterUpdated(address,bool)","signatureHash4":"0x3852f36d","signatureHash32":"0x3852f36d292dc71d9e7d1a5a7612b2cf3d10b1772f1909c3bf23aac036db7e18"}],"error":[{"signature":"AlreadyPaused()","signatureHash4":"0x1785c681","signatureHash32":"0x1785c68176ff5ca26e02299a48022fe13a267aed4ebbbf517400769c3e8e8df7"},{"signature":"AlreadyPausedByOwner()","signatureHash4":"0x7d5718e8","signatureHash32":"0x7d5718e8816136143e6354c7da2f486913509d05e688777623fe3c9a524e44ea"},{"signature":"AlreadySet()","signatureHash4":"0xa741a045","signatureHash32":"0xa741a0456e52b90bd22850f10558d4a38cdc2876b51fbd4ffc1b587676dbc61c"},{"signature":"NotOwner()","signatureHash4":"0x30cd7471","signatureHash32":"0x30cd74712f59d478562d48e2d35de830db72c60a63dd08ae59199eec990b5bc4"},{"signature":"NotPaused()","signatureHash4":"0x6cd60201","signatureHash32":"0x6cd602013233635730773e15e89b8a778034d859147e8f706bcd1aa42e228e06"},{"signature":"NotReporter()","signatureHash4":"0xe5ce9c09","signatureHash32":"0xe5ce9c093241d02ad20cda5738a2f82628e184196584fd98c04c6031fb80619c"},{"signature":"ZeroAddress()","signatureHash4":"0xd92e233d","signatureHash32":"0xd92e233df2717d4a40030e20904abd27b68fcbeede117eaaccbbdac9618c8c73"}]},"proxyResolution":{"isProxy":false,"proxyType":null,"implementations":[]},"match":"match","chainId":"1","address":"0x8feAB81D36E7576107D5dE0758c1b839Be31B4F6"}