How to frontrun and backrun?

Hey guys,

Please move this to the correct place if i have thrown it in the wrong area. As the title indicates, i am keen to muck around with a smart contract which i believe is written in solidity. I found this contract from looking at suspicious trades on garbage coins in the land of crypto. I will post the code below so if someone can give me a clear answer on this it will be most appreciated as i will know where to begin. I have zero coding experience but have time to dedicate to it. I am interested in trialling both areas, number one would be to have a successful bot that can front run orders which this smart contract does successfully. Secondly, i would like to learn how to beat it. My main aim to be able to get it to work and have an understanding of it will i believe help in working out how to beat it.

All i am chasing here is what language this is compiled in, and where to start learning. abcoathup has been kind enough to provide a video showing an introduction to backrunning.

Why am i interested in this. I guess i see it as only a matter of time before the institutional side get on board with taking advantage of decentralised exchanges. It is already happening on centralised exchanges where they are selling server space on site just like they do with Forex and other markets.

Lastly i wont pretend to kid anyone here, i would very much like to increase my profit in the trading game and believe that this could be advantageous.

Code below:

compiled:

0x6080604052600436106101185760003560e01c80638da5cb5b116100a0578063ad5c464811610064578063ad5c464814610471578063c45a015514610486578063cfa5d34d1461049b578063eb5625d9146104ca578063fc4dd3331461050d5761013d565b80638da5cb5b146102c6578063986f5585146102f7578063a3aa19891461030c578063a3c68f4c14610389578063a74e0691146103bf5761013d565b8063423f6cef116100e7578063423f6cef146101b657806352b0761d146101ef57806366dd0f2414610236578063752adc321461026057806377cf7630146102935761013d565b8063047cf9a6146101425780630ad60376146101725780632821040d146101995780633ccfd60b146101ae5761013d565b3661013d573360009081526004602052604090205460ff16151560011461013b57fe5b005b600080fd5b34801561014e57600080fd5b5061013b6004803603604081101561016557600080fd5b5080359060200135610537565b34801561017e57600080fd5b506101876108eb565b60408051918252519081900360200190f35b3480156101a557600080fd5b506101876108f1565b61013b6108f7565b3480156101c257600080fd5b5061013b600480360360408110156101d957600080fd5b506001600160a01b038135169060200135610958565b3480156101fb57600080fd5b506102226004803603602081101561021257600080fd5b50356001600160a01b03166109bd565b604080519115158252519081900360200190f35b34801561024257600080fd5b5061013b6004803603602081101561025957600080fd5b50356109d2565b34801561026c57600080fd5b5061013b6004803603602081101561028357600080fd5b50356001600160a01b0316610a8a565b34801561029f57600080fd5b50610222600480360360208110156102b657600080fd5b50356001600160a01b0316610af5565b3480156102d257600080fd5b506102db610b0a565b604080516001600160a01b039092168252519081900360200190f35b34801561030357600080fd5b506102db610b19565b34801561031857600080fd5b5061013b6004803603602081101561032f57600080fd5b81019060208101813564010000000081111561034a57600080fd5b82018360208201111561035c57600080fd5b8035906020019184602083028401116401000000008311171561037e57600080fd5b509092509050610b28565b34801561039557600080fd5b5061013b600480360360608110156103ac57600080fd5b5080359060208101359060400135610ea8565b3480156103cb57600080fd5b5061013b600480360360408110156103e257600080fd5b8101906020810181356401000000008111156103fd57600080fd5b82018360208201111561040f57600080fd5b8035906020019184602083028401116401000000008311171561043157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505050351515905061129d565b34801561047d57600080fd5b506102db61137d565b34801561049257600080fd5b506102db6113a1565b61013b600480360360808110156104b157600080fd5b50803590602081013590604081013590606001356113c5565b3480156104d657600080fd5b5061013b600480360360608110156104ed57600080fd5b506001600160a01b038135811691602081013590911690604001356116d6565b34801561051957600080fd5b5061013b6004803603602081101561053057600080fd5b503561172a565b3360009081526004602052604090205460ff16151560011461058b576040805162461bcd60e51b815260206004820152600860248201526713db9b1e48109bdd60c21b604482015290519081900360640190fd5b80428110156105c6576040805162461bcd60e51b8152602060048201526002602482015261544560f01b604482015290519081900360640190fd5b604080516002808252606080830184529260208301908036833701905050600054600280549293506001600160a01b03909116916367ccdf389186880304036040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561063957600080fd5b505afa15801561064d573d6000803e3d6000fd5b505050506040513d602081101561066357600080fd5b50518151829060009061067257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2816001815181106106c057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506000816000815181106106ef57fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b50519050806107b1576040805162461bcd60e51b8152602060048201526002602482015261139560f21b604482015290519081900360640190fd5b60006108067f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f846000815181106107e457fe5b6020026020010151856001815181106107f957fe5b60200260200101516117f4565b9050600560008460008151811061081957fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff166108b8576108658360008151811061085457fe5b6020026020010151306000196118b4565b6001600560008560008151811061087857fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b6108d8836000815181106108c857fe5b6020026020010151308385611a17565b6108e3833083611b6c565b505050505050565b60025481565b60015481565b6003546001600160a01b03163314610940576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b600354610956906001600160a01b031647611e37565b565b6003546001600160a01b031633146109a1576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b6003546109b99083906001600160a01b031683611f2a565b5050565b60046020526000908152604090205460ff1681565b6003546001600160a01b03163314610a1b576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a7657600080fd5b505af11580156108e3573d6000803e3d6000fd5b6003546001600160a01b03163314610ad3576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60056020526000908152604090205460ff1681565b6003546001600160a01b031681565b6000546001600160a01b031681565b3360009081526004602052604090205460ff161515600114610b7c576040805162461bcd60e51b815260206004820152600860248201526713db9b1e48109bdd60c21b604482015290519081900360640190fd5b60408051600280825260608083018452926020830190803683370190505090507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281600181518110610bca57fe5b6001600160a01b039092166020928302919091019091015260005b82811015610ea2576000848483818110610bfb57fe5b604080516370a0823160e01b81523060048201529051602092830294909401356001600160a01b0316936370a08231935060248083019392829003018186803b158015610c4757600080fd5b505afa158015610c5b573d6000803e3d6000fd5b505050506040513d6020811015610c7157600080fd5b50511115610e9a57838382818110610c8557fe5b905060200201356001600160a01b031682600081518110610ca257fe5b60200260200101906001600160a01b031690816001600160a01b031681525050600082600081518110610cd157fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610d2e57600080fd5b505afa158015610d42573d6000803e3d6000fd5b505050506040513d6020811015610d5857600080fd5b5051905080610d93576040805162461bcd60e51b8152602060048201526002602482015261139560f21b604482015290519081900360640190fd5b6000610ddb7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f85600081518110610dc657fe5b6020026020010151866001815181106107f957fe5b90506005600085600081518110610dee57fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16610e7c57610e298460008151811061085457fe5b60016005600086600081518110610e3c57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b610e8c846000815181106108c857fe5b610e97843083611b6c565b50505b600101610be5565b50505050565b3360009081526004602052604090205460ff161515600114610efc576040805162461bcd60e51b815260206004820152600860248201526713db9b1e48109bdd60c21b604482015290519081900360640190fd5b8042811015610f37576040805162461bcd60e51b8152602060048201526002602482015261544560f01b604482015290519081900360640190fd5b604080516002808252606080830184529260208301908036833701905050600054600280549293506001600160a01b03909116916367ccdf389186880304036040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d6020811015610fd457600080fd5b505181518290600090610fe357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28160018151811061103157fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060008160008151811061106057fe5b60200260200101516001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156110bd57600080fd5b505afa1580156110d1573d6000803e3d6000fd5b505050506040513d60208110156110e757600080fd5b5051905080611122576040805162461bcd60e51b8152602060048201526002602482015261139560f21b604482015290519081900360640190fd5b60006111557f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f846000815181106107e457fe5b9050606061116482848661208d565b9050878160018151811061117457fe5b602002602001015110156111b4576040805162461bcd60e51b8152602060048201526002602482015261494160f01b604482015290519081900360640190fd5b60056000856000815181106111c557fe5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff16611253576112008460008151811061085457fe5b6001600560008660008151811061121357fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b6112878460008151811061126357fe5b602002602001015130848460008151811061127a57fe5b6020026020010151611a17565b611293818530856121d9565b5050505050505050565b6003546001600160a01b031633146112e6576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b60005b82518110156113785760006001600160a01b031683828151811061130957fe5b60200260200101516001600160a01b03161461137057816004600085848151811061133057fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b6001016112e9565b505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b3360009081526004602052604090205460ff161515600114611419576040805162461bcd60e51b815260206004820152600860248201526713db9b1e48109bdd60c21b604482015290519081900360640190fd5b8042811015611454576040805162461bcd60e51b8152602060048201526002602482015261544560f01b604482015290519081900360640190fd5b60408051600280825260608083018452926020830190803683370190505090507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2816000815181106114a257fe5b6001600160a01b0392831660209182029290920101526000546001549116906367ccdf3890600286880304036040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561150257600080fd5b505afa158015611516573d6000803e3d6000fd5b505050506040513d602081101561152c57600080fd5b505181518290600190811061153d57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006115a57f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f8360008151811061159057fe5b6020026020010151846001815181106107f957fe5b905060606115b482898561208d565b905086816001815181106115c457fe5b60200260200101511015611604576040805162461bcd60e51b8152602060048201526002602482015261494160f01b604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663a9059cbb838360008151811061164157fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561169857600080fd5b505af11580156116ac573d6000803e3d6000fd5b505050506040513d60208110156116c257600080fd5b50516116ca57fe5b611293818430856121d9565b6003546001600160a01b0316331461171f576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b6113788383836118b4565b6003546001600160a01b03163314611773576040805162461bcd60e51b81526020600482015260076024820152664f6e6c79204d6560c81b604482015290519081900360640190fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156117d957600080fd5b505af11580156117ed573d6000803e3d6000fd5b5050505050565b6000806000611803858561236c565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b602083106119315780518252601f199092019160209182019101611912565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611993576040519150601f19603f3d011682016040523d82523d6000602084013e611998565b606091505b50915091508180156119c65750805115806119c657508080602001905160208110156119c357600080fd5b50515b6117ed576040805162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c45440000604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b60208310611a9c5780518252601f199092019160209182019101611a7d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611afe576040519150601f19603f3d011682016040523d82523d6000602084013e611b03565b606091505b5091509150818015611b31575080511580611b315750808060200190516020811015611b2e57600080fd5b50515b6108e35760405162461bcd60e51b81526004018080602001828103825260248152602001806127706024913960400191505060405180910390fd5b60008084600081518110611b7c57fe5b602002602001015185600181518110611b9157fe5b6020026020010151915091506000611ba9838361236c565b5090506000849050600080600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611bf057600080fd5b505afa158015611c04573d6000803e3d6000fd5b505050506040513d6060811015611c1a57600080fd5b5080516020909101516001600160701b0391821693501690506000806001600160a01b038a811690891614611c50578284611c53565b83835b91509150611ce9828b6001600160a01b03166370a082318a6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611cb157600080fd5b505afa158015611cc5573d6000803e3d6000fd5b505050506040513d6020811015611cdb57600080fd5b50519063ffffffff61244a16565b9550611cf68683836124a0565b945050505050600080856001600160a01b0316886001600160a01b031614611d2057826000611d24565b6000835b604080516000808252602082019092529294509092506001600160a01b0387169163022c0d9f91859185918f9190506040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611dc3578181015183820152602001611dab565b50505050905090810190601f168015611df05780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611e1257600080fd5b505af1158015611e26573d6000803e3d6000fd5b505050505050505050505050505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b60208310611e835780518252601f199092019160209182019101611e64565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611ee5576040519150601f19603f3d011682016040523d82523d6000602084013e611eea565b606091505b50509050806113785760405162461bcd60e51b815260040180806020018281038252602381526020018061274d6023913960400191505060405180910390fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310611fa75780518252601f199092019160209182019101611f88565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612009576040519150601f19603f3d011682016040523d82523d6000602084013e61200e565b606091505b509150915081801561203c57508051158061203c575080806020019051602081101561203957600080fd5b50515b6117ed576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b60606002825110156120e6576040805162461bcd60e51b815260206004820152601860248201527f514e574c6962726172793a20494e56414c49445f504154480000000000000000604482015290519081900360640190fd5b815167ffffffffffffffff811180156120fe57600080fd5b50604051908082528060200260200182016040528015612128578160200160208202803683370190505b509050828160008151811061213957fe5b60200260200101818152505060005b60018351038110156121d15760008061218b8786858151811061216757fe5b602002602001015187866001018151811061217e57fe5b6020026020010151612590565b915091506121ad84848151811061219e57fe5b602002602001015183836124a0565b8484600101815181106121bc57fe5b60209081029190910101525050600101612148565b509392505050565b600080846000815181106121e957fe5b6020026020010151856001815181106121fe57fe5b6020026020010151915091506000612216838361236c565b50905060008760018151811061222857fe5b60200260200101519050600080836001600160a01b0316866001600160a01b0316146122565782600061225a565b6000835b604080516000808252602082019092529294509092506001600160a01b0389169163022c0d9f91859185918d9190506040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b03166001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156122f95781810151838201526020016122e1565b50505050905090810190601f1680156123265780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561234857600080fd5b505af115801561235c573d6000803e3d6000fd5b5050505050505050505050505050565b600080826001600160a01b0316846001600160a01b031614156123c05760405162461bcd60e51b81526004018080602001828103825260258152602001806127006025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b0316106123e05782846123e3565b83835b90925090506001600160a01b038216612443576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b8082038281111561249a576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b92915050565b60008084116124e05760405162461bcd60e51b815260040180806020018281038252602b815260200180612794602b913960400191505060405180910390fd5b6000831180156124f05750600082115b61252b5760405162461bcd60e51b81526004018080602001828103825260288152602001806127256028913960400191505060405180910390fd5b600061253f856103e563ffffffff61264d16565b90506000612553828563ffffffff61264d16565b905060006125798361256d886103e863ffffffff61264d16565b9063ffffffff6126b016565b905080828161258457fe5b04979650505050505050565b600080600061259f858561236c565b509050600080876001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156125de57600080fd5b505afa1580156125f2573d6000803e3d6000fd5b505050506040513d606081101561260857600080fd5b5080516020909101516001600160701b0391821693501690506001600160a01b038781169084161461263b57808261263e565b81815b90999098509650505050505050565b60008115806126685750508082028282828161266557fe5b04145b61249a576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b8082018281101561249a576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fdfe556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954595472616e7366657248656c7065723a204554485f5452414e534645525f4641494c45445472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a26469706673582212205b233baf2d0bd3ded02b5ba3f05bf1d6d8965d6b9e6cee09f89ddc149cab6d0d64736f6c63430006060033

Decompiled: (This includes the persons public address they are using to execute this contract)

#
#  Panoramix v4 Oct 2019 
#  Decompiled source of 0xC8De8feF2A0FeD84acdD31370320f03Fe84E2a2a
# 
#  Let's make the world open source 
# 
#
#  I failed with these: 
#  - unknown047cf9a6(?)
#  - withdraw()
#  - unknowna3aa1989(?)
#  - unknowna3c68f4c(?)
#  - _fallback()
#  All the rest is below.
#

const factory = 0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
const WETH = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

def storage:
  unknown986f5585Address is addr at storage 0
  unknown2821040d is uint256 at storage 1
  unknown0ad60376 is uint256 at storage 2
  owner is addr at storage 3
  stor3 is uint256 at storage 3
  stor3 is uint32 at storage 3
  stor4 is mapping of uint8 at storage 4
  stor5 is mapping of uint8 at storage 5

def unknown0ad60376(): # not payable
  return unknown0ad60376

def unknown2821040d(): # not payable
  return unknown2821040d

def unknown52b0761d(addr _param1): # not payable
  require calldata.size - 4 >= 32
  return bool(stor4[_param1])

def unknown77cf7630(addr _param1): # not payable
  require calldata.size - 4 >= 32
  return bool(stor5[_param1])

def owner(): # not payable
  return addr(owner)

def unknown986f5585(): # not payable
  return unknown986f5585Address

#
#  Regular functions
#

def unknown752adc32(addr _param1): # not payable
  require calldata.size - 4 >= 32
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  unknown986f5585Address = _param1

def unknown66dd0f24(uint256 _param1): # not payable
  require calldata.size - 4 >= 32
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  require ext_code.size(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
  call 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.deposit() with:
     value _param1 wei
       gas gas_remaining wei
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]

def unknownfc4dd333(uint256 _param1): # not payable
  require calldata.size - 4 >= 32
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  require ext_code.size(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
  call 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.withdraw(uint256 amount) with:
       gas gas_remaining wei
      args _param1
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]

def safeTransfer(address _to, uint256 _value): # not payable
  require calldata.size - 4 >= 64
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  mem[196 len 64] = transfer(address to, uint256 value), Mask(224, 0, stor3), uint32(stor3), Mask(224, 32, _value) >> 32
  call _to with:
     funct uint32(stor3)
       gas gas_remaining wei
      args Mask(224, 32, _value) << 224, mem[260 len 4]
  if not return_data.size:
      if not ext_call.success:
          revert with 0, 'TransferHelper: TRANSFER_FAILED'
      if not transfer(address to, uint256 value), Mask(224, 0, stor3):
          revert with 0, 'TransferHelper: TRANSFER_FAILED'
  else:
      mem[228 len return_data.size] = ext_call.return_data[0 len return_data.size]
      if not ext_call.success:
          revert with 0, 'TransferHelper: TRANSFER_FAILED'
      if return_data.size:
          require return_data.size >= 32
          if not mem[228]:
              revert with 0, 'TransferHelper: TRANSFER_FAILED'

def unknowneb5625d9(addr _param1, addr _param2, uint256 _param3): # not payable
  require calldata.size - 4 >= 96
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  mem[196 len 64] = approve(address spender, uint256 value), addr(_param2) << 64, 0, Mask(224, 32, _param3) >> 32
  call _param1 with:
       gas gas_remaining wei
      args Mask(224, 32, _param3) << 224, mem[260 len 4]
  if not return_data.size:
      if not ext_call.success:
          revert with 0, 'TransferHelper: APPROVE_FAILED'
      if not approve(address spender, uint256 value), addr(_param2) << 64:
          revert with 0, 'TransferHelper: APPROVE_FAILED'
  else:
      mem[228 len return_data.size] = ext_call.return_data[0 len return_data.size]
      if not ext_call.success:
          revert with 0, 'TransferHelper: APPROVE_FAILED'
      if return_data.size:
          require return_data.size >= 32
          if not mem[228]:
              revert with 0, 'TransferHelper: APPROVE_FAILED'

def unknowna74e0691(array _param1, bool _param2): # not payable
  require calldata.size - 4 >= 64
  require _param1 <= 4294967296
  require _param1 + 36 <= calldata.size
  require _param1.length <= 4294967296 and _param1 + (32 * _param1.length) + 36 <= calldata.size
  mem[128 len 32 * _param1.length] = call.data[_param1 + 36 len 32 * _param1.length]
  mem[(32 * _param1.length) + 128] = 0
  if addr(owner) != caller:
      revert with 0, 'Only Me'
  idx = 0
  while idx < _param1.length:
      require idx < _param1.length
      if mem[(32 * idx) + 140 len 20]:
          require idx < _param1.length
          mem[0] = mem[(32 * idx) + 140 len 20]
          mem[32] = 4
          stor4[mem[(32 * idx) + 140 len 20]] = uint8(_param2)
      idx = idx + 1
      continue 

def unknowncfa5d34d(uint256 _param1, uint256 _param2, uint256 _param3, uint256 _param4) payable: 
  require calldata.size - 4 >= 128
  if bool(stor4[caller]) != 1:
      revert with 0, 'Only Bot'
  if _param4 < block.timestamp:
      revert with 0, 'TE'
  mem[128] = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
  require ext_code.size(unknown986f5585Address)
  static call unknown986f5585Address.0x67ccdf38 with:
          gas gas_remaining wei
         args ((_param3 - _param4 / 2) - unknown2821040d)
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]
  require return_data.size >= 32
  mem[160] = ext_call.return_data[12 len 20]
  if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 == mem[172 len 20]:
      revert with 0, 32, 37, 0xfe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345, mem[297 len 27]
  if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 < mem[172 len 20]:
      mem[224] = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000
      mem[244] = addr(ext_call.return_data)
      mem[192] = 40
      mem[296] = 0xff00000000000000000000000000000000000000000000000000000000000000
      mem[297] = 0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000
      mem[317] = sha3(13847067169082572429, addr(ext_call.return_data))
      mem[349] = 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f
      mem[264] = 85
      mem[381] = 2
      mem[413 len 64] = call.data[calldata.size len 64]
      mem[413] = _param1
      idx = 0
      while idx < 1:
          require idx < 2
          _723 = mem[(32 * idx) + 128]
          require idx + 1 < 2
          _734 = mem[(32 * idx + 1) + 128]
          if mem[(32 * idx) + 140 len 20] == mem[(32 * idx + 1) + 140 len 20]:
              revert with 0, 32, 37, 0xfe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345, mem[582 len 27]
          if mem[(32 * idx) + 140 len 20] < mem[(32 * idx + 1) + 140 len 20]:
              if not mem[(32 * idx) + 140 len 20]:
                  revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              static call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).getReserves() with:
                      gas gas_remaining wei
              mem[477 len 96] = ext_call.return_data[0 len 96]
              if not ext_call.success:
                  revert with ext_call.return_data[0 len return_data.size]
              require return_data.size >= 96
              require idx < 2
              if mem[(32 * idx) + 413] <= 0:
                  revert with 0, 32, 43, 0x44556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e, mem[588 len 21]
              if addr(_723) == addr(_723):
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[32]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[32])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
              else:
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[0]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[0])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
          else:
              if not mem[(32 * idx + 1) + 140 len 20]:
                  revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              static call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).getReserves() with:
                      gas gas_remaining wei
              mem[477 len 96] = ext_call.return_data[0 len 96]
              if not ext_call.success:
                  revert with ext_call.return_data[0 len return_data.size]
              require return_data.size >= 96
              require idx < 2
              if mem[(32 * idx) + 413] <= 0:
                  revert with 0, 32, 43, 0x44556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e, mem[588 len 21]
              if addr(_734) == addr(_723):
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[32]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[32])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
              else:
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[0]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[0])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
          idx = idx + 1
          continue 
      if mem[445] < _param2:
          revert with 0, 'IA'
      require ext_code.size(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
      call 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.transfer(address to, uint256 value) with:
           gas gas_remaining wei
          args addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)), _param1
      if not ext_call.success:
          revert with ext_call.return_data[0 len return_data.size]
      require return_data.size >= 32
      require ext_call.return_data[0]
      if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 == mem[172 len 20]:
          revert with 0, 32, 37, 0xfe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345, mem[582 len 27]
      if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 < mem[172 len 20]:
          mem[509] = 0x22c0d9f00000000000000000000000000000000000000000000000000000000
          mem[513] = 0
          mem[545] = mem[445]
          mem[577] = this.address
          mem[609] = 128
          mem[641] = ext_call.return_data[0]
          mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
          if not ext_call.return_data % 32:
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                   gas gas_remaining wei
                  args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
          else:
              mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                   gas gas_remaining wei
                  args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
      else:
          if not mem[172 len 20]:
              revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
          mem[509] = 0x22c0d9f00000000000000000000000000000000000000000000000000000000
          if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 == mem[172 len 20]:
              mem[513] = 0
              mem[545] = mem[445]
              mem[577] = this.address
              mem[609] = 128
              mem[641] = ext_call.return_data[0]
              mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
              if not ext_call.return_data % 32:
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
              else:
                  mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
          else:
              mem[513] = mem[445]
              mem[545] = 0
              mem[577] = this.address
              mem[609] = 128
              mem[641] = ext_call.return_data[0]
              mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
              if not ext_call.return_data % 32:
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args mem[445], 0, addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
              else:
                  mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(13847067169082572429, addr(ext_call.return_data)), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args mem[445], 0, addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
  else:
      if not addr(ext_call.return_data):
          revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
      mem[224] = addr(ext_call.return_data)
      mem[244] = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000
      mem[192] = 40
      mem[296] = 0xff00000000000000000000000000000000000000000000000000000000000000
      mem[297] = 0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000
      mem[317] = sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
      mem[349] = 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f
      mem[264] = 85
      mem[381] = 2
      mem[413 len 64] = call.data[calldata.size len 64]
      mem[413] = _param1
      idx = 0
      while idx < 1:
          require idx < 2
          _729 = mem[(32 * idx) + 128]
          require idx + 1 < 2
          _738 = mem[(32 * idx + 1) + 128]
          if mem[(32 * idx) + 140 len 20] == mem[(32 * idx + 1) + 140 len 20]:
              revert with 0, 32, 37, 0xfe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345, mem[582 len 27]
          if mem[(32 * idx) + 140 len 20] < mem[(32 * idx + 1) + 140 len 20]:
              if not mem[(32 * idx) + 140 len 20]:
                  revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              static call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).getReserves() with:
                      gas gas_remaining wei
              mem[477 len 96] = ext_call.return_data[0 len 96]
              if not ext_call.success:
                  revert with ext_call.return_data[0 len return_data.size]
              require return_data.size >= 96
              require idx < 2
              if mem[(32 * idx) + 413] <= 0:
                  revert with 0, 32, 43, 0x44556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e, mem[588 len 21]
              if addr(_729) == addr(_729):
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[32]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[32])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
              else:
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[0]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[0])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
          else:
              if not mem[(32 * idx + 1) + 140 len 20]:
                  revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              static call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).getReserves() with:
                      gas gas_remaining wei
              mem[477 len 96] = ext_call.return_data[0 len 96]
              if not ext_call.success:
                  revert with ext_call.return_data[0 len return_data.size]
              require return_data.size >= 96
              require idx < 2
              if mem[(32 * idx) + 413] <= 0:
                  revert with 0, 32, 43, 0x44556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e, mem[588 len 21]
              if addr(_738) == addr(_729):
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[32]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[32])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[0]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
              else:
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if Mask(112, 0, ext_call.return_data <= 0:
                      revert with 0, 32, 40, 0x53556e697377617056324c6962726172793a20494e53554646494349454e545f4c49515549444954, mem[585 len 24]
                  if 997 * mem[(32 * idx) + 413] / 997 != mem[(32 * idx) + 413]:
                      revert with 0, 'ds-math-mul-overflow'
                  if not Mask(112, 0, ext_call.return_data[0]):
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 0 / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                  else:
                      require Mask(112, 0, ext_call.return_data[0])
                      if 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]:
                          revert with 0, 'ds-math-mul-overflow'
                      if 1000 * Mask(112, 0, ext_call.return_data / 1000 != Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-mul-overflow'
                      if (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413]) < 1000 * Mask(112, 0, ext_call.return_data[32]):
                          revert with 0, 'ds-math-add-overflow'
                      require (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
                      require idx + 1 < 2
                      mem[(32 * idx + 1) + 413] = 997 * mem[(32 * idx) + 413] * Mask(112, 0, ext_call.return_data / (1000 * Mask(112, 0, ext_call.return_data * mem[(32 * idx) + 413])
          idx = idx + 1
          continue 
      if mem[445] < _param2:
          revert with 0, 'IA'
      require ext_code.size(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
      call 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.transfer(address to, uint256 value) with:
           gas gas_remaining wei
          args addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)), _param1
      if not ext_call.success:
          revert with ext_call.return_data[0 len return_data.size]
      require return_data.size >= 32
      require ext_call.return_data[0]
      if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 == mem[172 len 20]:
          revert with 0, 32, 37, 0xfe556e697377617056324c6962726172793a204944454e544943414c5f4144445245535345, mem[582 len 27]
      if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 < mem[172 len 20]:
          mem[509] = 0x22c0d9f00000000000000000000000000000000000000000000000000000000
          mem[513] = 0
          mem[545] = mem[445]
          mem[577] = this.address
          mem[609] = 128
          mem[641] = ext_call.return_data[0]
          mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
          if not ext_call.return_data % 32:
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                   gas gas_remaining wei
                  args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
          else:
              mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
              require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
              call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                   gas gas_remaining wei
                  args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
      else:
          if not mem[172 len 20]:
              revert with 0, 'UniswapV2Library: ZERO_ADDRESS'
          mem[509] = 0x22c0d9f00000000000000000000000000000000000000000000000000000000
          if 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 == mem[172 len 20]:
              mem[513] = 0
              mem[545] = mem[445]
              mem[577] = this.address
              mem[609] = 128
              mem[641] = ext_call.return_data[0]
              mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
              if not ext_call.return_data % 32:
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
              else:
                  mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args 0, mem[445], addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
          else:
              mem[513] = mem[445]
              mem[545] = 0
              mem[577] = this.address
              mem[609] = 128
              mem[641] = ext_call.return_data[0]
              mem[673 len ceil32(ext_call.return_data] = mem[509 len ceil32(ext_call.return_data]
              if not ext_call.return_data % 32:
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args mem[445], 0, addr(this.address), 128, ext_call.return_datamem[673 len ext_call.return_data]
              else:
                  mem[floor32(ext_call.return_data] = mem[floor32(ext_call.return_data % 32) + 705 len ext_call.return_data % 32]
                  require ext_code.size(addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)))
                  call addr(sha3(0, 6659063423423185226, sha3(addr(ext_call.return_data), 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2), 0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f)).0x22c0d9f with:
                       gas gas_remaining wei
                      args mem[445], 0, addr(this.address), 128, ext_call.return_datamem[673 len floor32(ext_call.return_data]
  if not ext_call.success:
      revert with ext_call.return_data[0 len return_data.size]

If anyone can give me an idea of the language/tools needed to put this together from scratch so i can know where to begin this would be a massive help.

Cheers!

1 Like

Hi @padawan,

It looks like you are going to have a few rabbit holes to go down.

  • Smart contract development
  • Decompiling/reverse engineering
  • Trading bots
  • Front running

I can give you some pointers on the smart contract development front.
(Learn guides are a great place to start: https://docs.openzeppelin.com/learn/)

I don't have any experience with the rest of the rabbit holes. I see a lot of learning in your future.


The contract bytecode you linked to ends in 64736f6c63430006060033 (https://etherscan.io/address/0xC8De8feF2A0FeD84acdD31370320f03Fe84E2a2a#code) so it was compiled with the Solidity compiler 0.6.6. (https://solidity.readthedocs.io/en/v0.6.12/metadata.html?highlight=version#encoding-of-the-metadata-hash-in-the-bytecode)

I suggest you try a few different decompilers to see what results you can get and how readable it might be, e.g.:
https://ethervm.io/decompile/0xC8De8feF2A0FeD84acdD31370320f03Fe84E2a2a

You should also look through successful and failed transactions on Etherscan to see what happened to understand what trades were made and why it failed.
My understanding with a contract like this is to fail early if the opportunity isn't available.


You can also search out all the resources that you can on frontrunning.
Though I think backrunning is potentially more interesting.


Good luck with your journey. Feel free to ask questions and share information that you find.

1 Like

Thank you so much for your time in responding to this!!!

I certainly will be asking questions and happy to post up what i find. I am absolutely more interested in backrunning (should have had a different title to this haha)

Thanks again, will be spending the following months doing a lot of reading/learning/trialling.

That or i give up and pay a freelancer :stuck_out_tongue:

Cheers

1 Like

Hi @padawan,

I updated the topic title again. :smile:

The following post is worth a read on this topic: