Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xDf54cC8b9259740478445a99f14AfCb3CD26456A
Balance 0 ETH
Nonce 1
Code Size 23514 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

23514 bytes
0x60806040526004361061019a5760003560e01c806385f8c259116100e1578063baa2abde1161008a578063ded9382a11610064578063ded9382a14610c11578063e8e3370014610c91578063f305d71914610d1e578063fb3bdb4114610d71576101e0565b8063baa2abde14610adb578063c45a015514610b45578063d06ca61f14610b5a576101e0565b8063ad615dec116100bb578063ad615dec146109b2578063af2979eb146109e8578063b6f9de9514610a48576101e0565b806385f8c259146108c25780638803dbee146108f8578063ad5c46481461099d576101e0565b80634a25d94a1161014357806361d027b31161011d57806361d027b31461074c578063791ac9471461078a5780637ff36ab51461082f576101e0565b80634a25d94a146105825780635b0d5984146106275780635c11d795146106a7576101e0565b80631f00ca74116101745780631f00ca741461039b5780632195995c1461045257806338ed1739146104dd576101e0565b806302751cec146101e5578063054d50d41461025e57806318cbafe5146102a6576101e0565b366101e0573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216146101de57fe5b005b600080fd5b3480156101f157600080fd5b50610245600480360360c081101561020857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135916060810135916080820135169060a00135610e04565b6040805192835260208301919091528051918290030190f35b34801561026a57600080fd5b506102946004803603606081101561028157600080fd5b5080359060208101359060400135610f57565b60408051918252519081900360200190f35b3480156102b257600080fd5b5061034b600480360360a08110156102c957600080fd5b8135916020810135918101906060810160408201356401000000008111156102f057600080fd5b82018360208201111561030257600080fd5b8035906020019184602083028401116401000000008311171561032457600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135610f6c565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561038757818101518382015260200161036f565b505050509050019250505060405180910390f35b3480156103a757600080fd5b5061034b600480360360408110156103be57600080fd5b813591908101906040810160208201356401000000008111156103e057600080fd5b8201836020820111156103f257600080fd5b8035906020019184602083028401116401000000008311171561041457600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061139c945050505050565b34801561045e57600080fd5b50610245600480360361016081101561047657600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013582169160408201359160608101359160808201359160a08101359091169060c08101359060e081013515159060ff61010082013516906101208101359061014001356113d2565b3480156104e957600080fd5b5061034b600480360360a081101561050057600080fd5b81359160208101359181019060608101604082013564010000000081111561052757600080fd5b82018360208201111561053957600080fd5b8035906020019184602083028401116401000000008311171561055b57600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135611510565b34801561058e57600080fd5b5061034b600480360360a08110156105a557600080fd5b8135916020810135918101906060810160408201356401000000008111156105cc57600080fd5b8201836020820111156105de57600080fd5b8035906020019184602083028401116401000000008311171561060057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff81351690602001356117ae565b34801561063357600080fd5b50610294600480360361014081101561064b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135916060810135916080820135169060a08101359060c081013515159060ff60e08201351690610100810135906101200135611a14565b3480156106b357600080fd5b506101de600480360360a08110156106ca57600080fd5b8135916020810135918101906060810160408201356401000000008111156106f157600080fd5b82018360208201111561070357600080fd5b8035906020019184602083028401116401000000008311171561072557600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135611b66565b34801561075857600080fd5b50610761611f14565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561079657600080fd5b506101de600480360360a08110156107ad57600080fd5b8135916020810135918101906060810160408201356401000000008111156107d457600080fd5b8201836020820111156107e657600080fd5b8035906020019184602083028401116401000000008311171561080857600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135611f30565b61034b6004803603608081101561084557600080fd5b8135919081019060408101602082013564010000000081111561086757600080fd5b82018360208201111561087957600080fd5b8035906020019184602083028401116401000000008311171561089b57600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135612372565b3480156108ce57600080fd5b50610294600480360360608110156108e557600080fd5b508035906020810135906040013561284d565b34801561090457600080fd5b5061034b600480360360a081101561091b57600080fd5b81359160208101359181019060608101604082013564010000000081111561094257600080fd5b82018360208201111561095457600080fd5b8035906020019184602083028401116401000000008311171561097657600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff813516906020013561285a565b3480156109a957600080fd5b50610761612a54565b3480156109be57600080fd5b50610294600480360360608110156109d557600080fd5b5080359060208101359060400135612a78565b3480156109f457600080fd5b50610294600480360360c0811015610a0b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135916060810135916080820135169060a00135612a85565b6101de60048036036080811015610a5e57600080fd5b81359190810190604081016020820135640100000000811115610a8057600080fd5b820183602082011115610a9257600080fd5b80359060200191846020830284011164010000000083111715610ab457600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135612c70565b348015610ae757600080fd5b50610245600480360360e0811015610afe57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013582169160408201359160608101359160808201359160a08101359091169060c001356131eb565b348015610b5157600080fd5b506107616134f5565b348015610b6657600080fd5b5061034b60048036036040811015610b7d57600080fd5b81359190810190604081016020820135640100000000811115610b9f57600080fd5b820183602082011115610bb157600080fd5b80359060200191846020830284011164010000000083111715610bd357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550613519945050505050565b348015610c1d57600080fd5b506102456004803603610140811015610c3557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135916060810135916080820135169060a08101359060c081013515159060ff60e08201351690610100810135906101200135613546565b348015610c9d57600080fd5b50610d006004803603610100811015610cb557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013582169160408201359160608101359160808201359160a08101359160c0820135169060e0013561369e565b60408051938452602084019290925282820152519081900360600190f35b610d00600480360360c0811015610d3457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135916060810135916080820135169060a0013561382d565b61034b60048036036080811015610d8757600080fd5b81359190810190604081016020820135640100000000811115610da957600080fd5b820183602082011115610dbb57600080fd5b80359060200191846020830284011164010000000083111715610ddd57600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff8135169060200135613b59565b6000808242811015610e7757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b610ea6897f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28a8a8a308a6131eb565b9093509150610eb68986856140c1565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015610f2957600080fd5b505af1158015610f3d573d6000803e3d6000fd5b50505050610f4b858361429e565b50965096945050505050565b6000610f648484846143db565b949350505050565b60608142811015610fde57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21686867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181811061104357fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b6103e8600489020460006110f68a836144ff565b90506111567f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f828a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061457192505050565b9350888460018651038151811061116957fe5b602002602001015110156111c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b61128d888860008181106111d857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16336112737f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8c8c600081811061122757fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168d8d600181811061125157fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff166146d7565b8760008151811061128057fe5b60200260200101516147c2565b6112cc84898980806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250309250614992915050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d8560018751038151811061131857fe5b60200260200101516040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561135657600080fd5b505af115801561136a573d6000803e3d6000fd5b5050505061138f868560018751038151811061138257fe5b602002602001015161429e565b5050509695505050505050565b60606113c97f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8484614c19565b90505b92915050565b60008060006114027f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8f8f6146d7565b9050600087611411578c611433565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b604080517fd505accf00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052606481018c905260ff8a16608482015260a4810189905260c48101889052905191925073ffffffffffffffffffffffffffffffffffffffff84169163d505accf9160e48082019260009290919082900301818387803b1580156114cf57600080fd5b505af11580156114e3573d6000803e3d6000fd5b505050506114f68f8f8f8f8f8f8f6131eb565b809450819550505050509b509b9950505050505050505050565b6060814281101561158257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b60028510156115f257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b6103e8600489020480890361163a888860008161160b57fe5b60005473ffffffffffffffffffffffffffffffffffffffff6020909202939093013581169233925016856147c2565b61169f8888600081811061164a57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16336116997f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8c8c600081811061122757fe5b846147c2565b6116fd7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f828a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061457192505050565b9350888460018651038151811061171057fe5b6020026020010151101561176f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b61138f848989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250614992915050565b6060814281101561182057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21686867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181811061188557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b60006103e860048902049050600081890390506119957f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8b8a8a80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250614c1992505050565b9350836000815181106119a457fe5b6020026020010151811015611a04576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180615a42602a913960400191505060405180910390fd5b61128d8888600081811061164a57fe5b600080611a627f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8d7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26146d7565b9050600086611a71578b611a93565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b604080517fd505accf00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052606481018b905260ff8916608482015260a4810188905260c48101879052905191925073ffffffffffffffffffffffffffffffffffffffff84169163d505accf9160e48082019260009290919082900301818387803b158015611b2f57600080fd5b505af1158015611b43573d6000803e3d6000fd5b50505050611b558d8d8d8d8d8d612a85565b9d9c50505050505050505050505050565b8042811015611bd657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b6103e86004880204808803611bef878760008161160b57fe5b611c7887876000818110611bff57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16336116997f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8b8b6000818110611c4e57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168c8c600181811061125157fe5b600087877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101818110611ca857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611d4157600080fd5b505afa158015611d55573d6000803e3d6000fd5b505050506040513d6020811015611d6b57600080fd5b50516040805160208a810282810182019093528a8252929350611dad9290918b918b9182918501908490808284376000920191909152508a9250614da7915050565b88611eb1828a8a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101818110611de057fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082318a6040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611e7957600080fd5b505afa158015611e8d573d6000803e3d6000fd5b505050506040513d6020811015611ea357600080fd5b50519063ffffffff6144ff16565b1015611f08576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b50505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b8042811015611fa057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21685857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181811061200557fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146120a457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b6103e8600488020496879003966120ee86866000816120bf57fe5b60005473ffffffffffffffffffffffffffffffffffffffff6020909202939093013581169233925016846147c2565b61217d868660008181106120fe57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16336121777f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8a8a600081811061214d57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168b8b600181811061125157fe5b8b6147c2565b6121bb868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250309250614da7915050565b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216916370a0823191602480820192602092909190829003018186803b15801561224b57600080fd5b505afa15801561225f573d6000803e3d6000fd5b505050506040513d602081101561227557600080fd5b50519050878110156122d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561234557600080fd5b505af1158015612359573d6000803e3d6000fd5b50505050612367858261429e565b505050505050505050565b606081428110156123e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff168686600081811061242857fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146124c757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b60006103e860043402049050600081340390506125387f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f828a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061457192505050565b9350888460018651038151811061254b57fe5b602002602001015110156125aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b505060008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810189905290517f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2909216955063a9059cbb945060448082019450602093918390030190829087803b1580156126c757600080fd5b505af11580156126db573d6000803e3d6000fd5b505050506040513d60208110156126f157600080fd5b50516126f957fe5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6127667f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8b8b6000818110611c4e57fe5b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156127d057600080fd5b505af11580156127e4573d6000803e3d6000fd5b505050506040513d60208110156127fa57600080fd5b505161280257fe5b612841848989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250614992915050565b50505095945050505050565b6000610f6484848461516a565b606081428110156128cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b61292a7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f89888880806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250614c1992505050565b915060006103e88360008151811061293e57fe5b60200260200101516004028161295057fe5b0490506000818460008151811061296357fe5b6020026020010151039050888111156129c7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526027815260200180615a916027913960400191505060405180910390fd5b836000815181106129d457fe5b6020026020010151891015612a34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180615b7b602a913960400191505060405180910390fd5b612a448888600081811061164a57fe5b61176f8888600081811061160b57fe5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6000610f6484848461528e565b60008142811015612af757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b612b26887f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc289898930896131eb565b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051919450612bd092508a91879173ffffffffffffffffffffffffffffffffffffffff8416916370a0823191602480820192602092909190829003018186803b158015612b9f57600080fd5b505afa158015612bb3573d6000803e3d6000fd5b505050506040513d6020811015612bc957600080fd5b50516140c1565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612c4357600080fd5b505af1158015612c57573d6000803e3d6000fd5b50505050612c65848361429e565b509695505050505050565b8042811015612ce057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1685856000818110612d2457fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612dc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b3460006103e8600483020490507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015612e3857600080fd5b505af1158015612e4c573d6000803e3d6000fd5b50505050507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb612ebe7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8a8a600081811061214d57fe5b8385036040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612f2a57600080fd5b505af1158015612f3e573d6000803e3d6000fd5b505050506040513d6020811015612f5457600080fd5b5051612f5c57fe5b60008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810185905290517f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29092169263a9059cbb926044808401936020939083900390910190829087803b158015612ffa57600080fd5b505af115801561300e573d6000803e3d6000fd5b505050506040513d602081101561302457600080fd5b505161302c57fe5b600087877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810181811061305c57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231876040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156130f557600080fd5b505afa158015613109573d6000803e3d6000fd5b505050506040513d602081101561311f57600080fd5b50516040805160208a810282810182019093528a82529293506131619290918b918b9182918501908490808284376000920191909152508a9250614da7915050565b88613194828a8a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101818110611de057fe5b1015612367576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b600080824281101561325e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b600061328b7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8c8c6146d7565b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff831660248201819052604482018d9052915192935090916323b872dd916064808201926020929091908290030181600087803b15801561330c57600080fd5b505af1158015613320573d6000803e3d6000fd5b505050506040513d602081101561333657600080fd5b5050604080517f89afcb4400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015282516000938493928616926389afcb44926024808301939282900301818787803b1580156133a957600080fd5b505af11580156133bd573d6000803e3d6000fd5b505050506040513d60408110156133d357600080fd5b508051602090910151909250905060006133ed8e8e61536e565b5090508073ffffffffffffffffffffffffffffffffffffffff168e73ffffffffffffffffffffffffffffffffffffffff161461342a57818361342d565b82825b90975095508a87101561348b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615ab86026913960400191505060405180910390fd5b898610156134e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806159f46026913960400191505060405180910390fd5b505050505097509795505050505050565b7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b60606113c97f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8484614571565b60008060006135967f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8e7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26146d7565b90506000876135a5578c6135c7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b604080517fd505accf00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101839052606481018c905260ff8a16608482015260a4810189905260c48101889052905191925073ffffffffffffffffffffffffffffffffffffffff84169163d505accf9160e48082019260009290919082900301818387803b15801561366357600080fd5b505af1158015613677573d6000803e3d6000fd5b505050506136898e8e8e8e8e8e610e04565b909f909e509c50505050505050505050505050565b6000806000834281101561371357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b6137218c8c8c8c8c8c6154c1565b909450925060006137537f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8e8e6146d7565b90506137618d3383886147c2565b61376d8c3383876147c2565b8073ffffffffffffffffffffffffffffffffffffffff16636a627842886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156137ec57600080fd5b505af1158015613800573d6000803e3d6000fd5b505050506040513d602081101561381657600080fd5b5051949d939c50939a509198505050505050505050565b600080600083428110156138a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b6138d08a7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28b348c8c6154c1565b909450925060006139227f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8c7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26146d7565b90506139308b3383886147c2565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561399857600080fd5b505af11580156139ac573d6000803e3d6000fd5b50505050507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82866040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015613a5857600080fd5b505af1158015613a6c573d6000803e3d6000fd5b505050506040513d6020811015613a8257600080fd5b5051613a8a57fe5b8073ffffffffffffffffffffffffffffffffffffffff16636a627842886040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015613b0957600080fd5b505af1158015613b1d573d6000803e3d6000fd5b505050506040513d6020811015613b3357600080fd5b5051925034841015613b4b57613b4b3385340361429e565b505096509650969350505050565b60608142811015613bcb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f556e69737761705632526f757465723a20455850495245440000000000000000604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1686866000818110613c0f57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613cae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b60006103e86004340204905060008134039050613d1f7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f828a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061457192505050565b93508884600186510381518110613d3257fe5b60200260200101511015613d91576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b01602b913960400191505060405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613df957600080fd5b505af1158015613e0d573d6000803e3d6000fd5b50505050507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb613e7f7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8b8b6000818110611c4e57fe5b836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015613ee957600080fd5b505af1158015613efd573d6000803e3d6000fd5b505050506040513d6020811015613f1357600080fd5b5051613f1b57fe5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015613f8357600080fd5b505af1158015613f97573d6000803e3d6000fd5b505060008054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810189905290517f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2909216955063a9059cbb945060448082019450602093918390030190829087803b15801561403857600080fd5b505af115801561404c573d6000803e3d6000fd5b505050506040513d602081101561406257600080fd5b505161406a57fe5b6140a9848989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250614992915050565b8181013411156128415761284133838301340361429e565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000178152925182516000946060949389169392918291908083835b6020831061419757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161415a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146141f9576040519150601f19603f3d011682016040523d82523d6000602084013e6141fe565b606091505b509150915081801561422c57508051158061422c575080806020019051602081101561422957600080fd5b50515b61429757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b5050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b6020831061431557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016142d8565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614377576040519150601f19603f3d011682016040523d82523d6000602084013e61437c565b606091505b50509050806143d6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180615ade6023913960400191505060405180910390fd5b505050565b6000808411614435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180615b50602b913960400191505060405180910390fd5b6000831180156144455750600082115b61449a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180615a1a6028913960400191505060405180910390fd5b60006144ae856103e563ffffffff6157c216565b905060006144c2828563ffffffff6157c216565b905060006144e8836144dc886103e863ffffffff6157c216565b9063ffffffff61584816565b90508082816144f357fe5b04979650505050505050565b808203828111156113cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604482015290519081900360640190fd5b60606002825110156145e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f556e697377617056324c6962726172793a20494e56414c49445f504154480000604482015290519081900360640190fd5b815167ffffffffffffffff811180156145fc57600080fd5b50604051908082528060200260200182016040528015614626578160200160208202803683370190505b509050828160008151811061463757fe5b60200260200101818152505060005b60018351038110156146cf576000806146898786858151811061466557fe5b602002602001015187866001018151811061467c57fe5b60200260200101516158ba565b915091506146ab84848151811061469c57fe5b602002602001015183836143db565b8484600101815181106146ba57fe5b60209081029190910101525050600101614646565b509392505050565b60008060006146e6858561536e565b604080517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501207fff0000000000000000000000000000000000000000000000000000000000000060688401529a90941b9093166069840152607d8301989098527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b602083106148a057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614863565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614902576040519150601f19603f3d011682016040523d82523d6000602084013e614907565b606091505b5091509150818015614935575080511580614935575080806020019051602081101561493257600080fd5b50515b61498a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180615b2c6024913960400191505060405180910390fd5b505050505050565b60005b6001835103811015614c13576000808483815181106149b057fe5b60200260200101518584600101815181106149c757fe5b60200260200101519150915060006149df838361536e565b50905060008785600101815181106149f357fe5b602002602001015190506000808373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614614a3b57826000614a3f565b6000835b91509150600060028a51038810614a565788614a97565b614a977f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f878c8b60020181518110614a8a57fe5b60200260200101516146d7565b9050614ac47f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f88886146d7565b73ffffffffffffffffffffffffffffffffffffffff1663022c0d9f84848460006040519080825280601f01601f191660200182016040528015614b0e576020820181803683370190505b506040518563ffffffff1660e01b8152600401808581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015614b99578181015183820152602001614b81565b50505050905090810190601f168015614bc65780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015614be857600080fd5b505af1158015614bfc573d6000803e3d6000fd5b505060019099019850614995975050505050505050565b50505050565b6060600282511015614c8c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f556e697377617056324c6962726172793a20494e56414c49445f504154480000604482015290519081900360640190fd5b815167ffffffffffffffff81118015614ca457600080fd5b50604051908082528060200260200182016040528015614cce578160200160208202803683370190505b5090508281600183510381518110614ce257fe5b602090810291909101015281517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b80156146cf57600080614d4287866001860381518110614d2e57fe5b602002602001015187868151811061467c57fe5b91509150614d64848481518110614d5557fe5b6020026020010151838361516a565b846001850381518110614d7357fe5b602090810291909101015250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01614d12565b60005b60018351038110156143d657600080848381518110614dc557fe5b6020026020010151858460010181518110614ddc57fe5b6020026020010151915091506000614df4838361536e565b5090506000614e247f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f85856146d7565b90506000806000808473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015614e7257600080fd5b505afa158015614e86573d6000803e3d6000fd5b505050506040513d6060811015614e9c57600080fd5b5080516020909101516dffffffffffffffffffffffffffff918216935016905060008073ffffffffffffffffffffffffffffffffffffffff8a811690891614614ee6578284614ee9565b83835b9150915060008a73ffffffffffffffffffffffffffffffffffffffff166370a08231896040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015614f6c57600080fd5b505afa158015614f80573d6000803e3d6000fd5b505050506040513d6020811015614f9657600080fd5b505183810397509050614faa8784846143db565b955050505050506000808573ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614614fef57826000614ff3565b6000835b91509150600060028c51038a1061500a578a61503e565b61503e7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f898e8d60020181518110614a8a57fe5b60408051600080825260208201928390527f022c0d9f000000000000000000000000000000000000000000000000000000008352602482018781526044830187905273ffffffffffffffffffffffffffffffffffffffff8086166064850152608060848501908152845160a48601819052969750908c169563022c0d9f958a958a958a9591949193919260c486019290918190849084905b838110156150ee5781810151838201526020016150d6565b50505050905090810190601f16801561511b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561513d57600080fd5b505af1158015615151573d6000803e3d6000fd5b50506001909b019a50614daa9950505050505050505050565b60008084116151c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806159a3602c913960400191505060405180910390fd5b6000831180156151d45750600082115b615229576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180615a1a6028913960400191505060405180910390fd5b600061524d6103e8615241868863ffffffff6157c216565b9063ffffffff6157c216565b905060006152676103e5615241868963ffffffff6144ff16565b9050615284600182848161527757fe5b049063ffffffff61584816565b9695505050505050565b60008084116152e8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180615a6c6025913960400191505060405180910390fd5b6000831180156152f85750600082115b61534d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180615a1a6028913960400191505060405180910390fd5b8261535e858463ffffffff6157c216565b8161536557fe5b04949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614156153f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806159cf6025913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610615430578284615433565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff82166154ba57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b604080517fe6a4390500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015287811660248301529151600092839283927f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9092169163e6a4390591604480820192602092909190829003018186803b15801561556157600080fd5b505afa158015615575573d6000803e3d6000fd5b505050506040513d602081101561558b57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff16141561567157604080517fc9c6539600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a81166004830152898116602483015291517f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9092169163c9c65396916044808201926020929091908290030181600087803b15801561564457600080fd5b505af1158015615658573d6000803e3d6000fd5b505050506040513d602081101561566e57600080fd5b50505b60008061569f7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8b8b6158ba565b915091508160001480156156b1575080155b156156c1578793508692506157b5565b60006156ce89848461528e565b905087811161573b5785811015615730576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806159f46026913960400191505060405180910390fd5b8894509250826157b3565b600061574889848661528e565b90508981111561575457fe5b878110156157ad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180615ab86026913960400191505060405180910390fd5b94508793505b505b5050965096945050505050565b60008115806157dd575050808202828282816157da57fe5b04145b6113cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b808201828110156113cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604482015290519081900360640190fd5b60008060006158c9858561536e565b5090506000806158da8888886146d7565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561591f57600080fd5b505afa158015615933573d6000803e3d6000fd5b505050506040513d606081101561594957600080fd5b5080516020909101516dffffffffffffffffffffffffffff918216935016905073ffffffffffffffffffffffffffffffffffffffff87811690841614615990578082615993565b81815b9099909850965050505050505056fe556e697377617056324c6962726172793a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e69737761705632526f757465723a20494e53554646494349454e545f425f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459556e69737761705632526f757465723a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056324c6962726172793a20494e53554646494349454e545f414d4f554e54556e69737761705632526f757465723a204558434553534956455f494e5055545f414d4f554e54556e69737761705632526f757465723a20494e53554646494349454e545f415f414d4f554e545472616e7366657248656c7065723a204554485f5452414e534645525f4641494c4544556e69737761705632526f757465723a20494e53554646494349454e545f4f55545055545f414d4f554e545472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54556e69737761705632526f757465723a204e4f545f454e4f5547485f544f4b454e535f464f525f464545a2646970667358221220c72457f20e68dbeb23e1dd31c3d5710526708066a2c8b2113acde72fb849c9c364736f6c63430006060033

Verified Source Code Partial Match

Compiler: v0.6.6+commit.6c089d02 EVM: istanbul Optimization: Yes (999999 runs)
SorceryRouter.sol 1038 lines
/**
 * 
*/

pragma solidity =0.6.6;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

interface IERC20Uniswap {
        function balanceOf(address account) external view returns (uint256);
        function transfer(address recipient, uint256 amount) external returns (bool);
        function approve(address spender, uint256 amount) external returns (bool);
        function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    }

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

interface IERC20 {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
}

interface IWETH {
    function deposit() external payable;
    function transfer(address to, uint value) external returns (bool);
    function withdraw(uint) external;
}

contract SorceryRouter is IUniswapV2Router02 {
    using SafeMath for uint;

    address public immutable override factory;
    address public immutable override WETH;
    address public treasury; // Treasury address to receive fees

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED');
        _;
    }

    constructor(address _factory, address _WETH, address _treasury) public {
        factory = _factory;
        WETH = _WETH;
        treasury = _treasury; // Initialize the treasury address
    }

    receive() external payable {
        assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract
    }



    // **** ADD LIQUIDITY ****
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin
    ) internal virtual returns (uint amountA, uint amountB) {
        // create the pair if it doesn't exist yet
        if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
            IUniswapV2Factory(factory).createPair(tokenA, tokenB);
        }
        (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);
        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
            }
        }
    }
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
        liquidity = IUniswapV2Pair(pair).mint(to);
    }
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
        (amountToken, amountETH) = _addLiquidity(
            token,
            WETH,
            amountTokenDesired,
            msg.value,
            amountTokenMin,
            amountETHMin
        );
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));
        liquidity = IUniswapV2Pair(pair).mint(to);
        // refund dust eth, if any
        if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
    }

    // **** REMOVE LIQUIDITY ****
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair
        (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to);
        (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);
        (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
        require(amountA >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');
        require(amountB >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');
    }
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
        (amountToken, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, amountToken);
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountA, uint amountB) {
        address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
    }
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountToken, uint amountETH) {
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);
    }

    // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) public virtual override ensure(deadline) returns (uint amountETH) {
        (, amountETH) = removeLiquidity(
            token,
            WETH,
            liquidity,
            amountTokenMin,
            amountETHMin,
            address(this),
            deadline
        );
        TransferHelper.safeTransfer(token, to, IERC20(token).balanceOf(address(this)));
        IWETH(WETH).withdraw(amountETH);
        TransferHelper.safeTransferETH(to, amountETH);
    }
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external virtual override returns (uint amountETH) {
        address pair = UniswapV2Library.pairFor(factory, token, WETH);
        uint value = approveMax ? uint(-1) : liquidity;
        IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
        amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(
            token, liquidity, amountTokenMin, amountETHMin, to, deadline
        );
    }

   // **** SWAP ****
    // requires the initial amount to have already been sent to the first pair
    function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
        for (uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0,) = UniswapV2Library.sortTokens(input, output);
            uint amountOut = amounts[i + 1];
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
            IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
                amount0Out, amount1Out, to, new bytes(0)
            );
        }
    }

   function swapExactTokensForTokens(
    uint amountIn,          // The exact amount of tokens the user wants to swap
    uint amountOutMin,      // Minimum amount of tokens expected out
    address[] calldata path, // The token swap path
    address to,             // Address to send the output tokens to
    uint deadline           // Time by which the transaction must be confirmed
) external virtual override ensure(deadline) returns (uint[] memory amounts) {
    require(path.length >= 2, 'UniswapV2Router: INVALID_PATH');

    // Calculate the fee (0.4%)
    uint feeAmount = amountIn * 4 / 1000; // 0.4% fee

    // Effective amount for the swap
    uint effectiveAmountIn = amountIn - feeAmount; // Amount used for swap

    // Transfer the fee to the treasury address first
    TransferHelper.safeTransferFrom(
        path[0], msg.sender, treasury, feeAmount
    );

    // Transfer only the effective amount to the first pair
    TransferHelper.safeTransferFrom(
        path[0], msg.sender, 
        UniswapV2Library.pairFor(factory, path[0], path[1]), effectiveAmountIn
    );

    // Calculate the expected output amounts for the swap based on the effective amount
    amounts = UniswapV2Library.getAmountsOut(factory, effectiveAmountIn, path); // Using effective amount

    // Ensure the expected output meets the minimum requirement
    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

    // Perform the swap using the effective amount
    _swap(amounts, path, to);
}

   function swapTokensForExactTokens(
    uint amountOut,                // The exact amount of output tokens to receive
    uint amountInMax,             // The maximum amount of input tokens that can be used
    address[] calldata path,       // The token swap path
    address to,                    // Address to send the output tokens to
    uint deadline                  // Time by which the transaction must be confirmed
) 
    external 
    virtual 
    override 
    ensure(deadline) 
    returns (uint[] memory amounts) 
{
    // Calculate the required amounts to swap
    amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    
    // Calculate the fee (0.4%)
    uint256 feeAmount = amounts[0] * 4 / 1000; // Calculate 0.4% fee

    // Update: Subtract fee from the total required amount
    uint256 effectiveAmount = amounts[0] - feeAmount; 

    // Ensure the effective amount does not exceed the maximum allowed input
    require(effectiveAmount <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');

    // Ensure the user has enough tokens to cover the fee
    require(amountInMax >= amounts[0], 'UniswapV2Router: NOT_ENOUGH_TOKENS_FOR_FEE');

    // Transfer the effective input tokens from the sender to the Uniswap pair
    TransferHelper.safeTransferFrom(
        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), effectiveAmount
    );

    // Transfer the fee amount to the treasury
    TransferHelper.safeTransferFrom(
        path[0], msg.sender, treasury, feeAmount
    );

    // Perform the swap using the required amounts
    _swap(amounts, path, to);
}


    function swapExactETHForTokens(
    uint amountOutMin,            // Minimum amount of tokens to receive
    address[] calldata path,      // The token swap path
    address to,                   // Address to send the output tokens to
    uint deadline                 // Time by which the transaction must be confirmed
) 
    external 
    virtual 
    override 
    payable 
    ensure(deadline) 
    returns (uint[] memory amounts) 
{
    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
    
    // Hardcoded 0.4% fee calculation
    uint256 feeAmount = msg.value * 4 / 1000; // Calculate 0.4% fee

    // Calculate amounts using the ETH amount minus the fee
    uint256 amountETHForSwap = msg.value - feeAmount; // ETH for swap after fee deduction
    amounts = UniswapV2Library.getAmountsOut(factory, amountETHForSwap, path);
    
    // Ensure the expected output meets the minimum requirement
    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
    
    // Deposit the full ETH amount into WETH
    IWETH(WETH).deposit{value: msg.value}(); // Deposit all ETH into WETH
    
    // Transfer the fee portion (in WETH) to the treasury
    assert(IWETH(WETH).transfer(treasury, feeAmount));
    
    // Transfer the remaining WETH (amountETHForSwap) to the Uniswap pair for the swap
    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountETHForSwap));
    
    // Execute the swap
    _swap(amounts, path, to);
}


  function swapExactTokensForETH(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
) 
    external 
    virtual 
    override 
    ensure(deadline) 
    returns (uint[] memory amounts) 
{
    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

    // Calculate fee and adjust amountIn
    uint256 feeAmount = (amountIn * 4) / 1000; // 0.4% fee
    uint256 amountInForSwap = amountIn.sub(feeAmount); // This is the amount you will actually swap

    // Calculate output amounts based on amount after the fee
    amounts = UniswapV2Library.getAmountsOut(factory, amountInForSwap, path);

    // Ensure the expected output meets the minimum ETH 
    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

    // Transfer tokens to the Uniswap pair
    TransferHelper.safeTransferFrom(
        path[0], 
        msg.sender, 
        UniswapV2Library.pairFor(factory, path[0], path[1]), 
        amounts[0]
    );

    // Perform the swap
    _swap(amounts, path, address(this));

    // Withdraw the total output ETH
    IWETH(WETH).withdraw(amounts[amounts.length - 1]);

    // Transfer the ETH to the user
    TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
}



 function swapTokensForExactETH(
    uint amountOut,                // The exact amount of output ETH to receive (user expects this)
    uint amountInMax,              // The maximum amount of input tokens the user is willing to spend (user input)
    address[] calldata path,        // The token swap path (input to output)
    address to,                     // Address to send the output ETH to
    uint deadline                   // Time by which the transaction must be confirmed
) 
    external 
    virtual 
    override 
    ensure(deadline) 
    returns (uint[] memory amounts) 
{
    // Ensure the last address in the path is WETH (Wrapped Ether)
    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

    // Calculate the fee amount (0.4% of the user input amount)
    uint256 feeAmount = (amountInMax * 4) / 1000; // Calculate fee from maximum input amount
    uint256 effectiveInputAmount = amountInMax - feeAmount; // Tokens available for swap after fee deduction

    // Calculate the amount of tokens needed for the desired ETH output
    amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);

    // Ensure the effective input amount is sufficient to cover the required amount for the swap
    require(effectiveInputAmount >= amounts[0], 'UniswapV2Router: INSUFFICIENT_INPUT_AMOUNT');

    // Transfer the required input amount to the Uniswap pair
    TransferHelper.safeTransferFrom(
        path[0],
        msg.sender,
        UniswapV2Library.pairFor(factory, path[0], path[1]),
        effectiveInputAmount // Transfer the effective input amount after fee deduction
    );

    // Perform the swap
    _swap(amounts, path, address(this));

    // Withdraw the specified ETH output
    IWETH(WETH).withdraw(amounts[amounts.length - 1]); // Withdraw exact ETH output

    // Transfer the ETH to the user
    TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
}


  function swapETHForExactTokens(
    uint amountOut,                // Desired token output (in tokens)
    address[] calldata path,       // The swap path (ETH -> Token)
    address to,                    // The recipient of the tokens
    uint deadline                  // Transaction deadline
)
    external
    virtual
    override
    payable
    ensure(deadline)
    returns (uint[] memory amounts)
{
    // Ensure the first token in the path is WETH
    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');

    // Calculate the fee based on the total ETH sent by the user (0.4% of msg.value)
    uint256 feeAmount = (msg.value * 4) / 1000; // 0.4% fee

    // Calculate the net ETH available for the swap after deducting the fee
    uint256 netETHForSwap = msg.value - feeAmount;

    // Calculate the required amount of tokens based on the net ETH available
    amounts = UniswapV2Library.getAmountsOut(factory, netETHForSwap, path);
    
    // Ensure that the calculated output tokens meet or exceed the desired output
    require(amounts[amounts.length - 1] >= amountOut, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

    // Deposit the ETH for the swap
    IWETH(WETH).deposit{value: netETHForSwap}();

    // Transfer the required ETH for the swap to the Uniswap pair
    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), netETHForSwap));

    // Transfer the fee to the treasury
    IWETH(WETH).deposit{value: feeAmount}();
    assert(IWETH(WETH).transfer(treasury, feeAmount));

    // Perform the swap
    _swap(amounts, path, to);

    // Refund any excess ETH, if provided
    if (msg.value > (netETHForSwap + feeAmount)) {
        TransferHelper.safeTransferETH(msg.sender, msg.value - (netETHForSwap + feeAmount));
    }
}






    // **** SWAP (supporting fee-on-transfer tokens) ****
// Requires the initial amount to have already been sent to the first pair
function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
    for (uint i; i < path.length - 1; i++) {
        (address input, address output) = (path[i], path[i + 1]);
        (address token0,) = UniswapV2Library.sortTokens(input, output);
        IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));
        
        uint amountInput;
        uint amountOutput;

        { // Scope to avoid "stack too deep" errors
            (uint reserve0, uint reserve1,) = pair.getReserves();
            (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
            
            uint balanceBefore = IERC20(input).balanceOf(address(pair));
            amountInput = balanceBefore - reserveInput;
            
            // Calculate output amount using the net input (already deducted 0.4% fee externally)
            amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);
        }
        
        (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));
        address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
        
        // Perform the swap
        pair.swap(amount0Out, amount1Out, to, new bytes(0));
    }
}

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
) external virtual override ensure(deadline) {
    // Calculate the fee (0.4%)
    uint256 feeAmount = amountIn * 4 / 1000; // 0.4% fee deduction
    uint256 netAmountIn = amountIn - feeAmount; // Amount after fee deduction

    // Transfer the fee to the treasury address
    TransferHelper.safeTransferFrom(
        path[0],
        msg.sender,
        treasury,
        feeAmount
    );

    // Transfer the net amount (after fee deduction) to the first pair
    TransferHelper.safeTransferFrom(
        path[0],
        msg.sender,
        UniswapV2Library.pairFor(factory, path[0], path[1]),
        netAmountIn
    );

    uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
    
    // Perform the swap using the net amount
    _swapSupportingFeeOnTransferTokens(path, to);

    // Ensure the final output amount is at least the minimum required
    require(
        IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
        'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
    );
}

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
)
    external
    virtual
    override
    payable
    ensure(deadline)
{
    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
    
    uint amountIn = msg.value; // The amount of ETH sent

    // Calculate the fee (0.4%)
    uint256 feeAmount = amountIn * 4 / 1000; // 0.4% fee deduction

    // Deposit the total amount of ETH into WETH
    IWETH(WETH).deposit{value: amountIn}();

    // Transfer the net amount (after fee deduction) to the first pair
    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), (amountIn - feeAmount)));

    // Transfer the fee to the treasury address
    assert(IWETH(WETH).transfer(treasury, feeAmount));

    // Calculate the amount of tokens received before the swap
    uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
    
    // Perform the swap
    _swapSupportingFeeOnTransferTokens(path, to);
    
    // Ensure the final output amount is at least the minimum required
    require(
        IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
        'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
    );
}

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
    uint amountIn,
    uint amountOutMin,
    address[] calldata path,
    address to,
    uint deadline
)
    external
    virtual
    override
    ensure(deadline)
{
    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');

    // Calculate the fee (0.4%)
    uint256 feeAmount = amountIn * 4 / 1000; // 0.4% fee deduction

    // Deduct the fee from the amount in
    amountIn = amountIn - feeAmount;

    // Transfer the fee to the treasury address
    TransferHelper.safeTransferFrom(
        path[0],
        msg.sender,
        treasury,
        feeAmount
    );

    // Transfer the net amount (after fee deduction) to the first pair
    TransferHelper.safeTransferFrom(
        path[0],
        msg.sender,
        UniswapV2Library.pairFor(factory, path[0], path[1]),
        amountIn
    );

    // Perform the swap
    _swapSupportingFeeOnTransferTokens(path, address(this));

    // Calculate the amount of WETH received
    uint amountOut = IERC20Uniswap(WETH).balanceOf(address(this));
    
    // Ensure the output amount is at least the minimum required
    require(amountOut >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');

    // Withdraw WETH and transfer ETH to the recipient
    IWETH(WETH).withdraw(amountOut);
    TransferHelper.safeTransferETH(to, amountOut);
}

    // **** LIBRARY FUNCTIONS ****
    function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
        return UniswapV2Library.quote(amountA, reserveA, reserveB);
    }

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountOut)
    {
        return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
    }

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountIn)
    {
        return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
    }

    function getAmountsOut(uint amountIn, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsOut(factory, amountIn, path);
    }

    function getAmountsIn(uint amountOut, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsIn(factory, amountOut, path);
    }
}

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}

library UniswapV2Library {
    using SafeMath for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

    function safeTransferFrom(address token, address from, address to, uint value) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
    }

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

Read Contract

WETH 0xad5c4648 → address
factory 0xc45a0155 → address
getAmountIn 0x85f8c259 → uint256
getAmountOut 0x054d50d4 → uint256
getAmountsIn 0x1f00ca74 → uint256[]
getAmountsOut 0xd06ca61f → uint256[]
quote 0xad615dec → uint256
treasury 0x61d027b3 → address

Write Contract 17 functions

These functions modify contract state and require a wallet transaction to execute.

addLiquidity 0xe8e33700
address tokenA
address tokenB
uint256 amountADesired
uint256 amountBDesired
uint256 amountAMin
uint256 amountBMin
address to
uint256 deadline
returns: uint256, uint256, uint256
addLiquidityETH 0xf305d719
address token
uint256 amountTokenDesired
uint256 amountTokenMin
uint256 amountETHMin
address to
uint256 deadline
returns: uint256, uint256, uint256
removeLiquidity 0xbaa2abde
address tokenA
address tokenB
uint256 liquidity
uint256 amountAMin
uint256 amountBMin
address to
uint256 deadline
returns: uint256, uint256
removeLiquidityETH 0x02751cec
address token
uint256 liquidity
uint256 amountTokenMin
uint256 amountETHMin
address to
uint256 deadline
returns: uint256, uint256
removeLiquidityETHSupportingFeeOnTransferTokens 0xaf2979eb
address token
uint256 liquidity
uint256 amountTokenMin
uint256 amountETHMin
address to
uint256 deadline
returns: uint256
removeLiquidityETHWithPermit 0xded9382a
address token
uint256 liquidity
uint256 amountTokenMin
uint256 amountETHMin
address to
uint256 deadline
bool approveMax
uint8 v
bytes32 r
bytes32 s
returns: uint256, uint256
removeLiquidityETHWithPermitSupportingFeeOnTransferTokens 0x5b0d5984
address token
uint256 liquidity
uint256 amountTokenMin
uint256 amountETHMin
address to
uint256 deadline
bool approveMax
uint8 v
bytes32 r
bytes32 s
returns: uint256
removeLiquidityWithPermit 0x2195995c
address tokenA
address tokenB
uint256 liquidity
uint256 amountAMin
uint256 amountBMin
address to
uint256 deadline
bool approveMax
uint8 v
bytes32 r
bytes32 s
returns: uint256, uint256
swapETHForExactTokens 0xfb3bdb41
uint256 amountOut
address[] path
address to
uint256 deadline
returns: uint256[]
swapExactETHForTokens 0x7ff36ab5
uint256 amountOutMin
address[] path
address to
uint256 deadline
returns: uint256[]
swapExactETHForTokensSupportingFeeOnTransferTokens 0xb6f9de95
uint256 amountOutMin
address[] path
address to
uint256 deadline
swapExactTokensForETH 0x18cbafe5
uint256 amountIn
uint256 amountOutMin
address[] path
address to
uint256 deadline
returns: uint256[]
swapExactTokensForETHSupportingFeeOnTransferTokens 0x791ac947
uint256 amountIn
uint256 amountOutMin
address[] path
address to
uint256 deadline
swapExactTokensForTokens 0x38ed1739
uint256 amountIn
uint256 amountOutMin
address[] path
address to
uint256 deadline
returns: uint256[]
swapExactTokensForTokensSupportingFeeOnTransferTokens 0x5c11d795
uint256 amountIn
uint256 amountOutMin
address[] path
address to
uint256 deadline
swapTokensForExactETH 0x4a25d94a
uint256 amountOut
uint256 amountInMax
address[] path
address to
uint256 deadline
returns: uint256[]
swapTokensForExactTokens 0x8803dbee
uint256 amountOut
uint256 amountInMax
address[] path
address to
uint256 deadline
returns: uint256[]

Recent Transactions

No transactions found for this address