Address Contract Partially Verified
Address
0x67fe41A94e779CcFa22cff02cc2957DC9C0e4286
Balance
0 ETH
Nonce
1
Code Size
18267 bytes
Creator
0xbabe6188...9f67 at tx 0x7b9cd0fe...d65669
Indexed Transactions
0
Contract Bytecode
18267 bytes
0x6003361161000c576132f5565b60003560e01c346147495763a461b3c88118610364576101c436106147495760043560040160208135116147495780358060805260208201803560a052505050602435600401600a8135116147495780358060c05260208201803560e0525050506044358060a01c61474957610100526064358060a01c61474957610120526084358060a01c614749576101405260a4358060a01c61474957610160526001546147495760006002905b806101805261018051600381116147495760051b61010001516101a0526101a0516100e057610122565b6101a0516101805160018111614749576002015561018051600381116147495760051b60c40135610180516001811161474957600d01556001018181186100b6575b50506101443560648102816064820418614749579050610180526101805160095561018051600a556101643560065533600155610362601a55670de0b6b3a7640000604052670de0b6b3a764000060605261017e6101a06132fb565b6101a05160195542601b556000601d610200527f43757276652e666920466163746f727920506c61696e20506f6f6c3a2000000061022052610200805160208201836102600181518152505080830192505050608051816102600160a051815250808201915050806102405261024090508051806101a05260208201816101c0838360045afa505050506101a05180600f55600081601f0160051c6002811161474957801561024257905b8060051b6101c001518160100155600101818118610229575b505050600060c051816102600160e0518152508082019150506002610200527f2d6600000000000000000000000000000000000000000000000000000000000061022052610200805160208201836102600181518152505080830192505050806102405261024090508051806012556020820180516013555050507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610220526101a0516101c020610240527f0b9d98da55727756af85ff51e956250f080813d8ad137f20852fe4ea074e6420610260524661028052306102a05260a0610200526102008051602082012090506017553060007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000610200526020610200a3005b63313ce5678118610382576004361061474957601260405260206040f35b63a9059cbb81186103c65760443610614749576004358060a01c6147495760c0523360405260c0516060526024356080526103bb61333f565b600160e052602060e0f35b6323b872dd81186104a05760643610614749576004358060a01c6147495760c0526024358060a01c6147495760e05260c05160405260e05160605260443560805261040f61333f565b601560c051602052600052604060002080336020526000526040600020905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100511461049357610100516044358082038281116147495790509050601560c0516020526000526040600020803360205260005260406000209050555b6001610120526020610120f35b63095ea7b3811861051f5760443610614749576004358060a01c614749576040526024356015336020526000526040600020806040516020526000526040600020905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b63d505accf811861084d5760e43610614749576004358060a01c614749576040526024358060a01c614749576060526084358060081c614749576080526040511561474957606435421161474957601860405160205260005260406000205460a0526000600260e0527f19010000000000000000000000000000000000000000000000000000000000006101005260e08051602082018361022001815181525050808301925050506017548161022001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c96101405260405161016052606051610180526044356101a05260a0516101c0526064356101e05260c0610120526101208051602082012090508161022001526020810190508061020052610200905080516020820120905060c0526040513b15610796576000604060a46101803760406101605261016080516020820183610240018281848460045afa505050808301925050506080516101c0526101c0601f81018051610200525060016101e0526101e090508051602082018361024001815181525050808301925050508061022052610220905080518060e0526020820181610100838360045afa505050507f1626ba7e00000000000000000000000000000000000000000000000000000000604051631626ba7e61016052604060c05161018052806101a052806101800160e0518082526020820181818361010060045afa5050508051806020830101601f82600003163682375050601f19601f82516020010116905081015050602061016060c461017c845afa61077e573d600060003e3d6000fd5b60203d106147495761016090505118614749576107ca565b60405160c05160e0526080516101005260a4356101205260c4356101405260206000608060e060015afa5060005118614749575b6044356015604051602052600052604060002080606051602052600052604060002090505560a0516001810181811061474957905060186040516020526000526040600020556060516040517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560443560e052602060e0a3600160e052602060e0f35b63fde625e6811861087e5760043610614749576fffffffffffffffffffffffffffffffff6019541660405260206040f35b63c24c7c2981186108a35760043610614749576019548060801c905060405260206040f35b6314f0597981186108c857600436106147495760045460405260055460605260406040f35b63fee3f7f981186108ea57600436106147495764012a05f20060405260206040f35b63f446c1d0811861091957600436106147495761090760c06133bf565b60c05160648104905060e052602060e0f35b6376a2f0f0811861093c576004361061474957602061093860c06133bf565b60c0f35b63f2388acb81186109ee57600436106147495761095a6101806133bf565b6101805161016052600d54604052600e5460605260045460805260055460a0526109856101c06134e4565b6101c080516101805260208101516101a05250610180516040526101a051606052610160516080526109b86101e061356b565b6101e0516101c0526020610180516040526101a051606052610160516080526101c05160a0526109e96101e06137cf565b6101e0f35b6386fc88d38118610a135760043610614749576020610a0e6101c0613c02565b6101c0f35b63bb7b8b808118610ad4576004361061474957610a316101806133bf565b6101805161016052600d54604052600e5460605260045460805260055460a052610a5c6101c06134e4565b6101c080516101805260208101516101a05250610180516040526101a05160605261016051608052610a8f6101e061356b565b6101e0516101c0526101c051670de0b6b3a7640000810281670de0b6b3a7640000820418614749579050601654801561474957808204905090506101e05260206101e0f35b63ed8e84f38118610e6b5760643610614749576044358060011c6147495761028052610b016102c06133bf565b6102c0516102a0526004546102c0526005546102e052600d5461030052600e5461032052610300516101605261032051610180526102c0516101a0526102e0516101c0526102a0516101e052610b5861036061376c565b6103605161034052601654610360526102c051610380526102e0516103a05260006002905b806103c0526103c051600181116147495760051b600401356103e05261028051610bd0576103c051600181116147495760051b6103800180516103e0518082038281116147495790509050815250610bfb565b6103c051600181116147495760051b6103800180516103e05180820182811061474957905090508152505b600101818118610b7d57505061030051610160526103205161018052610380516101a0526103a0516101c0526102a0516101e052610c3a6103e061376c565b6103e0516103c0526103c0516103e0526103605115610de0576006548060011b818160011c186147495790508060021c90506104005260006002905b80610420526103c05161042051600181116147495760051b6102c00151808202811583838304141715614749579050905061034051801561474957808204905090506104405260006104605261042051600181116147495760051b610380015161048052610480516104405111610d06576104805161044051808203828111614749579050905061046052610d21565b61044051610480518082038281116147495790509050610460525b61042051600181116147495760051b610380018051610400516104605180820281158383830414171561474957905090506402540be400810490508082038281116147495790509050815250600101818118610c765750506103005160405261032051606052610380516080526103a05160a052610da06104606134e4565b6104608051610420526020810151610440525061042051604052610440516060526102a051608052610dd361046061356b565b610460516103e052610dea565b60206103c0610e69565b60006104005261028051610e1757610340516103e051808203828111614749579050905061040052610e32565b6103e051610340518082038281116147495790509050610400525b6104005161036051808202811583838304141715614749579050905061034051801561474957808204905090506104205260206104205bf35b630b4c7e4d8118610e885760643610614749573361032052610eab565b630c3e4b5481186114635760843610614749576064358060a01c61474957610320525b600054600214614749576002600055610ec56103606133bf565b61036051610340526004546103605260055461038052600d546103a052600e546103c0526103a051610160526103c05161018052610360516101a052610380516101c052610340516101e052610f1c61040061376c565b610400516103e052601654610400526103605161042052610380516104405260006002905b806104605261046051600181116147495760051b6004013561048052610480511561101957610460516001811161474957600201546323b872dd6104a052336104c052306104e052610480516105005260206104a060646104bc6000855af1610faf573d600060003e3d6000fd5b3d610fc657803b1561474957600161052052610fdf565b60203d10614749576104a0518060011c61474957610520525b610520905051156147495761046051600181116147495760051b610420018051610480518082018281106147495790509050815250611023565b6104005115614749575b600101818118610f415750506103a051610160526103c05161018052610420516101a052610440516101c052610340516101e05261106261048061376c565b61048051610460526103e051610460511115614749576060366104803761040051156112ff576006548060011b818160011c186147495790508060021c90506104e05260006002905b80610500526104605161050051600181116147495760051b610360015180820281158383830414171561474957905090506103e051801561474957808204905090506105205260006105405261050051600181116147495760051b61042001516105605261056051610520511161113b576105605161052051808203828111614749579050905061054052611156565b61052051610560518082038281116147495790509050610540525b6104e0516105405180820281158383830414171561474957905090506402540be4008104905061050051600181116147495760051b61048001526105605161050051600181116147495760051b610480015164012a05f20081028164012a05f2008204186147495790506402540be4008104905080820382811161474957905090506105005160018111614749576004015561050051600181116147495760051b61042001805161050051600181116147495760051b610480015180820382811161474957905090508152506001018181186110ab5750506103a0516040526103c051606052610420516080526104405160a0526112556105406134e4565b6105408051610500526020810151610520525061050051604052610520516060526103405160805261128861056061356b565b610560516105405261040051610540516103e051808203828111614749579050905080820281158383830414171561474957905090506103e051801561474957808204905090506104c05261050051610260526105205161028052610340516102a052610540516102c052611316613dc056611316565b6104205160045561044051600555610460516104c0525b6044356104c05110156113895760146104e0527f536c697070616765207363726577656420796f75000000000000000000000000610500526104e0506104e0518061050001601f826000031636823750506308c379a06104a05260206104c052601f19601f6104e05101166044016104bcfd5b610400516104c051808201828110614749579050905061040052601461032051602052600052604060002080546104c0518082018281106147495790509050815550610400516016556103205160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6104c0516104e05260206104e0a3337f26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a768604060046104e03761048051610520526104a051610540526104605161056052610400516105805260c06104e0a260206104c06003600055f35b635e0d443f811861163e57606436106147495760043580600f0b8118614749576103805260243580600f0b8118614749576103a052600d546103c052600e546103e0526103c0516040526103e05160605260045460805260055460a0526114cb6104406134e4565b6104408051610400526020810151610420525061038051600181116147495760051b610400015160443561038051600181116147495760051b6103c001518082028115838383041417156147495790509050670de0b6b3a76400008104905080820182811061474957905090506104405261038051610160526103a05161018052610440516101a052610400516101c052610420516101e05260403661020037611576610480613e01565b61048051610460526103a051600181116147495760051b610400015161046051808203828111614749579050905060018103818111614749579050610480526006546104805180820281158383830414171561474957905090506402540be400810490506104a052610480516104a0518082038281116147495790509050670de0b6b3a7640000810281670de0b6b3a76400008204186147495790506103a051600181116147495760051b6103c00151801561474957808204905090506104c05260206104c0f35b6367df02ca811861181457606436106147495760043580600f0b8118614749576103805260243580600f0b8118614749576103a052600d546103c052600e546103e0526103c0516040526103e05160605260045460805260055460a0526116a66104406134e4565b610440805161040052602081015161042052506103a051600181116147495760051b61040001516044356103a051600181116147495760051b6103c001518082028115838383041417156147495790509050670de0b6b3a764000081049050600181018181106147495790506402540be4008102816402540be400820418614749579050600654806402540be400036402540be4008111614749579050801561474957808204905090508082038281116147495790509050610440526103a051610160526103805161018052610440516101a052610400516101c052610420516101e0526040366102003761179c610480613e01565b61048051610460526104605161038051600181116147495760051b61040001518082038281116147495790509050670de0b6b3a7640000810281670de0b6b3a764000082041861474957905061038051600181116147495760051b6103c0015180156147495780820490509050610480526020610480f35b633df021248118611831576084361061474957336103c052611854565b63ddc1f59d8118611dae5760a43610614749576084358060a01c614749576103c0525b60043580600f0b8118614749576103805260243580600f0b8118614749576103a052600054600214614749576002600055600d546103e052600e546104005260045461042052600554610440526103e05160405261040051606052610420516080526104405160a0526118c86104a06134e4565b6104a08051610460526020810151610480525061038051600181116147495760051b610460015160443561038051600181116147495760051b6103e001518082028115838383041417156147495790509050670de0b6b3a76400008104905080820182811061474957905090506104a0526119446104e06133bf565b6104e0516104c05261046051604052610480516060526104c05160805261196c61050061356b565b610500516104e05261038051610160526103a051610180526104a0516101a052610460516101c052610480516101e0526104c051610200526104e051610220526119b7610520613e01565b61052051610500526103a051600181116147495760051b610460015161050051808203828111614749579050905060018103818111614749579050610520526105205160065480820281158383830414171561474957905090506402540be400810490506105405261052051610540518082038281116147495790509050670de0b6b3a7640000810281670de0b6b3a76400008204186147495790506103a051600181116147495760051b6103e001518015614749578082049050905061052052606435610520511015611b1057602e610560527f45786368616e676520726573756c74656420696e20666577657220636f696e73610580527f207468616e2065787065637465640000000000000000000000000000000000006105a05261056050610560518061058001601f826000031636823750506308c379a061052052602061054052601f19601f61056051011660440161053cfd5b6104a05161038051600181116147495760051b6104600152610500516103a051600181116147495760051b6104600152610460516102605261048051610280526104c0516102a0526104e0516102c052611b68613dc0565b6105405164012a05f20081028164012a05f2008204186147495790506402540be400810490506105605261056051670de0b6b3a7640000810281670de0b6b3a76400008204186147495790506103a051600181116147495760051b6103e00151801561474957808204905090506105605261038051600181116147495760051b61042001516044358082018281106147495790509050610380516001811161474957600401556103a051600181116147495760051b61042001516105205180820382811161474957905090506105605180820382811161474957905090506103a051600181116147495760040155610380516001811161474957600201546323b872dd61058052336105a052306105c0526044356105e0526020610580606461059c6000855af1611c9e573d600060003e3d6000fd5b3d611cb557803b1561474957600161060052611cce565b60203d1061474957610580518060011c61474957610600525b61060090505115614749576103a05160018111614749576002015463a9059cbb610580526103c0516105a052610520516105c0526020610580604461059c6000855af1611d20573d600060003e3d6000fd5b3d611d3757803b156147495760016105e052611d50565b60203d1061474957610580518060011c614749576105e0525b6105e09050511561474957337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd9714061038051610580526044356105a0526103a0516105c052610520516105e0526080610580a260206105206003600055f35b635b36389c8118611dca57606436106147495733604052611dec565b633eb1719f81186120785760843610614749576064358060a01c614749576040525b60005460021461474957600260005560165460605260403660803760006002905b8060c05260c05160018111614749576004015460e05260e0516004358082028115838383041417156147495790509050606051801561474957808204905090506101005260c051600181116147495760051b60240135610100511015611ef6576030610120527f5769746864726177616c20726573756c74656420696e20666577657220636f69610140527f6e73207468616e206578706563746564000000000000000000000000000000006101605261012050610120518061014001601f826000031636823750506308c379a060e052602061010052601f19601f61012051011660440160fcfd5b60e05161010051808203828111614749579050905060c0516001811161474957600401556101005160c051600181116147495760051b6080015260c05160018111614749576002015463a9059cbb610120526040516101405261010051610160526020610120604461013c6000855af1611f75573d600060003e3d6000fd5b3d611f8c57803b1561474957600161018052611fa5565b60203d1061474957610120518060011c61474957610180525b6101809050511561474957600101818118611e0d57505060605160043580820382811161474957905090506060526014336020526000526040600020805460043580820382811161474957905090508155506060516016556000337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60043560c052602060c0a3337f7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c60805160c05260a05160e052604036610100376060516101405260a060c0a2604060806003600055f35b63e3103273811861209557606436106147495733610320526120b8565b6352d2cfdd81186126405760843610614749576064358060a01c61474957610320525b6000546002146147495760026000556120d26103606133bf565b6103605161034052600d5461036052600e54610380526004546103a0526005546103c052610360516101605261038051610180526103a0516101a0526103c0516101c052610340516101e05261212961040061376c565b610400516103e0526103a051610400526103c0516104205260006002905b806104405261044051600181116147495760051b600401356104605261046051156122195761044051600181116147495760051b6104000180516104605180820382811161474957905090508152506104405160018111614749576002015463a9059cbb61048052610320516104a052610460516104c0526020610480604461049c6000855af16121dd573d600060003e3d6000fd5b3d6121f457803b156147495760016104e05261220d565b60203d1061474957610480518060011c614749576104e0525b6104e090505115614749575b60010181811861214757505061036051610160526103805161018052610400516101a052610420516101c052610340516101e05261225861046061376c565b6104605161044052604036610460376006548060011b818160011c186147495790508060021c90506104a05260006002905b806104c052610440516104c051600181116147495760051b6103a0015180820281158383830414171561474957905090506103e051801561474957808204905090506104e0526000610500526104c051600181116147495760051b610400015161052052610520516104e0511161231a57610520516104e051808203828111614749579050905061050052612335565b6104e051610520518082038281116147495790509050610500525b6104a0516105005180820281158383830414171561474957905090506402540be400810490506104c051600181116147495760051b6104600152610520516104c051600181116147495760051b610460015164012a05f20081028164012a05f2008204186147495790506402540be4008104905080820382811161474957905090506104c0516001811161474957600401556104c051600181116147495760051b6104000180516104c051600181116147495760051b6104600151808203828111614749579050905081525060010181811861228a5750506103605160405261038051606052610400516080526104205160a0526124346104c06134e4565b6104c0805161040052602081015161042052506104005160405261042051606052610340516080526124676104e061356b565b6104e0516104c05261040051610260526104205161028052610340516102a0526104c0516102c052612497613dc0565b6016546104e0526103e0516104c05180820382811161474957905090506104e05180820281158383830414171561474957905090506103e051801561474957808204905090506001810181811061474957905061050052600261050051106147495760443561050051111561256c576014610520527f536c697070616765207363726577656420796f750000000000000000000000006105405261052050610520518061054001601f826000031636823750506308c379a06104e052602061050052601f19601f6105205101166044016104fcfd5b6104e0516105005180820382811161474957905090506104e0526104e051601655601433602052600052604060002080546105005180820382811161474957905090508155506000337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61050051610520526020610520a3337f2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e604060046105203761046051610560526104805161058052610440516105a0526104e0516105c05260c0610520a260206105006003600055f35b63cc2b27d7811861268557604436106147495760243580600f0b8118614749576104205260206004356101e0526104205161020052612680610440614371565b610440f35b631a4d01d281186126a257606436106147495733610440526126c5565b63081579a581186129395760843610614749576064358060a01c61474957610440525b60243580600f0b811861474957610420526000546002146147495760026000556004356101e05261042051610200526126ff6104c0614371565b6104c080516104605260208101516104805260408101516104a0525060443561046051101561278e5760186104c0527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006104e0526104c0506104c051806104e001601f826000031636823750506308c379a06104805260206104a052601f19601f6104c051011660440161049cfd5b6104205160018111614749576004018054610460516104805164012a05f20081028164012a05f2008204186147495790506402540be400810490508082018281106147495790509050808203828111614749579050905081555060165460043580820382811161474957905090506104c0526104c0516016556014336020526000526040600020805460043580820382811161474957905090508155506000337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6004356104e05260206104e0a36104205160018111614749576002015463a9059cbb6104e0526104405161050052610460516105205260206104e060446104fc6000855af16128a3573d600060003e3d6000fd5b3d6128ba57803b15614749576001610540526128d3565b60203d10614749576104e0518060011c61474957610540525b6105409050511561474957337f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a06004356104e05261046051610500526104c0516105205260606104e0a26104a0516101c05261292d613d6b565b60206104606003600055f35b633c157e648118612aa857604436106147495760015463f851a44060c052602060c0600460dc845afa612971573d600060003e3d6000fd5b60203d106147495760c0518060a01c6147495761010052610100905051331861474957600b546201518081018181106147495790504210614749574262015180810181811061474957905060243510614749576129ce60e06133bf565b60e05160c0526004356064810281606482041861474957905060e05260043515612a0057620f423f6004351115612a03565b60005b156147495760c05160e05110612a335760c051600a810281600a82041861474957905060e0511161474957612a4f565b60c05160e051600a810281600a82041861474957905010614749575b60c05160095560e051600a5542600b55602435600c557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b63551a65888118612b5a57600436106147495760015463f851a44060c052602060c0600460dc845afa612ae0573d600060003e3d6000fd5b60203d106147495760c0518060a01c6147495761010052610100905051331861474957612b0d60e06133bf565b60e05160c05260c05160095560c051600a5542600b5542600c557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b637f3e17cb8118612bc357602436106147495760015463f851a440604052602060406004605c845afa612b92573d600060003e3d6000fd5b60203d10614749576040518060a01c6147495760805260809050513318614749576004351561474957600435601a55005b63e2e7d2648118612c3e5760243610614749576004356001811161474957600201546370a0823160405230606052602060406024605c845afa612c0b573d600060003e3d6000fd5b60203d10614749576040905051600435600181116147495760040154808203828111614749579050905060805260206080f35b63a48eac9d8118612cf357602436106147495760015463f851a440604052602060406004605c845afa612c76573d600060003e3d6000fd5b60203d10614749576040518060a01c61474957608052608090505133186147495764012a05f200600435116147495760085461474957600435600755426203f48081018181106147495790506008557f878eb36b3f197f05821c06953d9bc8f14b332a227b1e26df06a4215bbfe5d73f60043560405260206040a1005b634f12fe978118612dac57600436106147495760015463f851a440604052602060406004605c845afa612d2b573d600060003e3d6000fd5b60203d10614749576040518060a01c61474957608052608090505133186147495760085460405260405115612d6557604051421015612d68565b60005b156147495760075460605260605160065560006008557fa8715770654f54603947addf38c689adbd7182e21673b28bcf306a957aaba21560605160805260206080a1005b6330c540858118612ef457600436106147495760015463154aa8f560605230608052602060606024607c845afa612de8573d600060003e3d6000fd5b60203d10614749576060518060a01c6147495760a05260a090505160405260006002905b806060526060516001811161474957600201546080526080516370a0823160c0523060e052602060c0602460dc845afa612e4b573d600060003e3d6000fd5b60203d106147495760c0905051606051600181116147495760040154808203828111614749579050905060a05260805163a9059cbb60c05260405160e05260a05161010052602060c0604460dc6000855af1612eac573d600060003e3d6000fd5b3d612ec357803b1561474957600161012052612edb565b60203d106147495760c0518060011c61474957610120525b6101209050511561474957600101818118612e0c575050005b6354fd4d508118612f7c57600436106147495760208060805260066040527f76362e302e31000000000000000000000000000000000000000000000000000060605260408160800181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b63c45a01558118612f9b57600436106147495760015460405260206040f35b63c66106578118612fc657602436106147495760043560018111614749576002015460405260206040f35b634903b0d18118612ff157602436106147495760043560018111614749576004015460405260206040f35b63ddca3f43811861301057600436106147495760065460405260206040f35b6358680d0b811861302f57600436106147495760075460405260206040f35b63e66f43f5811861304e57600436106147495760085460405260206040f35b635409491a811861306d57600436106147495760095460405260206040f35b63b4b577ad811861308c576004361061474957600a5460405260206040f35b632081066c81186130ab576004361061474957600b5460405260206040f35b631405228881186130ca576004361061474957600c5460405260206040f35b6306fdde03811861314f57600436106147495760208060405280604001600f5480825260208201600082601f0160051c6002811161474957801561312157905b80601001548160051b84015260010181811861310a575b505050508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b6395d89b4181186131a75760043610614749576020806040528060400160125480825260208201601354815250508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b6370a0823181186131e25760243610614749576004358060a01c61474957604052601460405160205260005260406000205460605260206060f35b63dd62ed3e811861323c5760443610614749576004358060a01c614749576040526024358060a01c614749576060526015604051602052600052604060002080606051602052600052604060002090505460805260206080f35b6318160ddd811861325b57600436106147495760165460405260206040f35b633644e515811861327a57600436106147495760175460405260206040f35b637ecebe0081186132b55760243610614749576004358060a01c61474957604052601860405160205260005260406000205460605260206060f35b631be913a581186132d4576004361061474957601a5460405260206040f35b631ddc3b0181186132f3576004361061474957601b5460405260206040f35b505b60006000fd5b6fffffffffffffffffffffffffffffffff60405111614749576fffffffffffffffffffffffffffffffff60605111614749576060518060801b905060405117815250565b601460405160205260005260406000208054608051808203828111614749579050905081555060146060516020526000526040600020805460805180820182811061474957905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b600c54604052600a5460605260405142106133e3576060518152506134e2566134e2565b600954608052600b5460a052608051606051116134725760805160805160605180820382811161474957905090504260a0518082038281116147495790509050808202811583838304141715614749579050905060405160a05180820382811161474957905090508015614749578082049050905080820382811161474957905090508152506134e2566134e2565b60805160605160805180820382811161474957905090504260a0518082038281116147495790509050808202811583838304141715614749579050905060405160a05180820382811161474957905090508015614749578082049050905080820182811061474957905090508152505b565b60403660c03760006002905b806101005261010051600181116147495760051b6040015161010051600181116147495760051b608001518082028115838383041417156147495790509050670de0b6b3a76400008104905061010051600181116147495760051b60c001526001018181186134f057505060c051815260e051602082015250565b600060a05260006002905b8060051b6040015160c05260a05160c051808201828110614749579050905060a05260010181811861357657505060a0516135b557600081525061376a565b60a05160c0526080518060011b818160011c1861474957905060e052600060ff905b806101005260c05160c05180820281158383830414171561474957905090506040518015614749578082049050905060c0518082028115838383041417156147495790509050606051801561474957808204905090508060021c90506101205260c0516101405260e05160a0518082028115838383041417156147495790509050606481049050610120518060011b818160011c18614749579050808201828110614749579050905060c051808202811583838304141715614749579050905060e0516064810381811161474957905060c0518082028115838383041417156147495790509050606481049050610120516003810281600382041861474957905080820182811061474957905090508015614749578082049050905060c0526101405160c0511161372f5760016101405160c0518082038281116147495790509050116137585760c051835250505061376a56613758565b600160c051610140518082038281116147495790509050116137585760c051835250505061376a565b6001018181186135d757505060006000fd5b565b61016051604052610180516060526101a0516080526101c05160a0526137936102406134e4565b6102408051610200526020810151610220525061020051604052610220516060526101e0516080526137c661024061356b565b61024051815250565b6080518060011b818160011c1861474957905060c05260a0518060021c905060e05260006002905b806101005260e05160a051808202811583838304141715614749579050905061010051600181116147495760051b604001518015614749578082049050905060e0526001018181186137f757505060c051604051808202811583838304141715614749579050905060648104905060e0516040518082028115838383041417156147495790509050606051801561474957808204905090508082018281106147495790509050670de0b6b3a7640000810281670de0b6b3a764000082041861474957905060c051604051808202811583838304141715614749579050905060648104905060e051808201828110614749579050905080156147495780820490509050815250565b7ffffffffffffffffffffffffffffffffffffffffffffffffdb731c958f34d94c160405113613931576000815250613c00565b680755bf798b4a1bf1e5604051126139a057600c6060527f657870206f766572666c6f77000000000000000000000000000000000000000060805260605060605180608001601f826000031636823750506308c379a06020526020604052601f19601f6060510116604401603cfd5b670de0b6b3a764000060405160601b056060526c010000000000000000000000006b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b0501056080526bb17217f7d1cf79abc9e3b39860805102606051036060526c10fe68e7fd37d0007b713f76506060510160a0526d02d16720577bd19bf614176fe9ea6c0100000000000000000000000060605160a05102050160a0526d04a4fd9f2a8b96949216d2255a6c60605160a051010360c0526e0587f503bb6ea29d25fcb7401964506c0100000000000000000000000060a05160c05102050160c05279d835ebba824c98fb31b83b2ca45c00000000000000000000000060605160c051020160c0526060516c240c330e9fb2d9cbaf0fd5aafc810381811361474957905060e0526d0277594991cfc85f6e2461837cd96c0100000000000000000000000060605160e05102050160e0526d1a521255e34f6a5061b25ef1c9c46c0100000000000000000000000060605160e05102050360e0526db1bbb201f443cf962f1a1d3db4a56c0100000000000000000000000060605160e05102050160e0526e02c72388d9f74f51a9331fed693f156c0100000000000000000000000060605160e05102050360e0526e05180bb14799ab47a8a8cb2a527d576c0100000000000000000000000060605160e05102050160e05274029d9dc38563c32e5c2f6dc192ee70ef65f9978af360e05160c0510560008112614749570260c3608051037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811315613bf15781811b613bf8565b81816000031c5b905090508152505b565b601b5461010052601954610120526fffffffffffffffffffffffffffffffff6101205116671bc16d674ec80000818118671bc16d674ec8000083100218905061014052610120518060801c905061016052426101005110613c6d5761016051815250613d6956613d69565b42610100518082038281116147495790509050670de0b6b3a7640000810281670de0b6b3a7640000820418614749579050601a54801561474957808204905090508060ff1c614749577f8000000000000000000000000000000000000000000000000000000000000000811461474957600003604052613cee6101a06138fe565b6101a05161018052610140516101805180670de0b6b3a764000003670de0b6b3a764000081116147495790508082028115838383041417156147495790509050610160516101805180820281158383830414171561474957905090508082018281106147495790509050670de0b6b3a7640000810490508152505b565b6101c05115613dbe576101c05161022052613d876101e0613c02565b6101e051610240526102205160405261024051606052613da86102006132fb565b6102005160195542601b541015613dbe5742601b555b565b61026051604052610280516060526102a0516080526102c05160a052613de76102e06137cf565b6102e05161030052610300516101c052613dff613d6b565b565b6101805161016051146147495760006101805112614749576001610180511361474957600061016051126147495760016101605113614749576102005161024052610220516102605261022051613e8e57613e5d6102806133bf565b61028051610240526101c0516040526101e05160605261024051608052613e8561028061356b565b61028051610260525b60603661028037610260516102e052610240518060011b818160011c186147495790506103005260006002905b8061032052610160516103205118613eda576101a0516102a052613f08565b610180516103205114613f645761032051600181116147495760051b6101c001516102a052613f0856613f64565b610280516102a0518082018281106147495790509050610280526102e0516102605180820281158383830414171561474957905090506102a0518060011b818160011c18614749579050801561474957808204905090506102e0525b600101818118613ebb5750506102e05161026051808202811583838304141715614749579050905060648102816064820418614749579050610300518060011b818160011c18614749579050801561474957808204905090506102e05261028051610260516064810281606482041861474957905061030051801561474957808204905090508082018281106147495790509050610320526102605161034052600060ff905b8061036052610340516102c052610340516103405180820281158383830414171561474957905090506102e0518082018281106147495790509050610340518060011b818160011c1861474957905061032051808201828110614749579050905061026051808203828111614749579050905080156147495780820490509050610340526102c05161034051116140ca5760016102c051610340518082038281116147495790509050116140f557610340518352505050614107566140f5565b6001610340516102c0518082038281116147495790509050116140f557610340518352505050614107565b60010181811861400a57505060006000fd5b565b600060605112614749576001606051136147495760603660e03760c051610140526040518060011b818160011c186147495790506101605260006002905b806101805260605161018051146141d15761018051600181116147495760051b6080015161010052614178566141d1565b60e05161010051808201828110614749579050905060e0526101405160c0518082028115838383041417156147495790509050610100518060011b818160011c1861474957905080156147495780820490509050610140525b6001018181186141475750506101405160c051808202811583838304141715614749579050905060648102816064820418614749579050610160518060011b818160011c18614749579050801561474957808204905090506101405260e05160c05160648102816064820418614749579050610160518015614749578082049050905080820182811061474957905090506101805260c0516101a052600060ff905b806101c0526101a051610120526101a0516101a05180820281158383830414171561474957905090506101405180820182811061474957905090506101a0518060011b818160011c1861474957905061018051808201828110614749579050905060c0518082038281116147495790509050801561474957808204905090506101a052610120516101a05111614332576001610120516101a05180820382811161474957905090501161435d576101a051835250505061436f5661435d565b60016101a0516101205180820382811161474957905090501161435d576101a051835250505061436f565b60010181811861427357505060006000fd5b565b61437c6102406133bf565b6102405161022052600d5461024052600e5461026052610240516040526102605160605260045460805260055460a0526143b76102c06134e4565b6102c080516102805260208101516102a05250610280516040526102a051606052610220516080526143ea6102e061356b565b6102e0516102c0526016546102e0526102c0516101e0516102c05180820281158383830414171561474957905090506102e051801561474957808204905090508082038281116147495790509050610300526102205160405261020051606052610280516080526102a05160a0526103005160c05261446a610340614109565b61034051610320526006548060011b818160011c186147495790508060021c9050610340526040366103603760006002905b806103a05260006103c0526103a051600181116147495760051b61028001516103e052610200516103a05118614514576103e0516103005180820281158383830414171561474957905090506102c051801561474957808204905090506103205180820382811161474957905090506103c052614558565b6103e0516103e0516103005180820281158383830414171561474957905090506102c0518015614749578082049050905080820382811161474957905090506103c0525b6103e051610340516103c05180820281158383830414171561474957905090506402540be4008104905080820382811161474957905090506103a051600181116147495760051b610360015260010181811861449c57505061020051600181116147495760051b61036001516102205160405261020051606052610360516080526103805160a0526103005160c0526145f26103c0614109565b6103c05180820382811161474957905090506103a05261020051600181116147495760051b6102800151610320518082038281116147495790509050670de0b6b3a7640000810281670de0b6b3a764000082041861474957905061020051600181116147495760051b6102400151801561474957808204905090506103c0526103a05160018103818111614749579050670de0b6b3a7640000810281670de0b6b3a764000082041861474957905061020051600181116147495760051b6102400151801561474957808204905090506103a0526103205161020051600181116147495760051b610280015260006103e052610320511561471c57610280516040526102a051606052610220516080526103005160a0526147136104006137cf565b610400516103e0525b6103a05181526103c0516103a051808203828111614749579050905060208201526103e051604082015250565b600080fda165767970657283000307000b
Verified Source Code Partial Match
Compiler: v0.3.7+commit.6020b8bb
Vyper_contract.vy 1150 lines
# @version 0.3.7
"""
@title StableSwap
@author Curve.Fi
@license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved
@notice 2 coin pool implementation with no lending
@dev ERC20 support for return True/revert, return True/False, return None
"""
from vyper.interfaces import ERC20
interface Factory:
def get_fee_receiver(_pool: address) -> address: view
def admin() -> address: view
interface ERC1271:
def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view
event Transfer:
sender: indexed(address)
receiver: indexed(address)
value: uint256
event Approval:
owner: indexed(address)
spender: indexed(address)
value: uint256
event TokenExchange:
buyer: indexed(address)
sold_id: int128
tokens_sold: uint256
bought_id: int128
tokens_bought: uint256
event AddLiquidity:
provider: indexed(address)
token_amounts: uint256[N_COINS]
fees: uint256[N_COINS]
invariant: uint256
token_supply: uint256
event RemoveLiquidity:
provider: indexed(address)
token_amounts: uint256[N_COINS]
fees: uint256[N_COINS]
token_supply: uint256
event RemoveLiquidityOne:
provider: indexed(address)
token_amount: uint256
coin_amount: uint256
token_supply: uint256
event RemoveLiquidityImbalance:
provider: indexed(address)
token_amounts: uint256[N_COINS]
fees: uint256[N_COINS]
invariant: uint256
token_supply: uint256
event RampA:
old_A: uint256
new_A: uint256
initial_time: uint256
future_time: uint256
event StopRampA:
A: uint256
t: uint256
event CommitNewFee:
new_fee: uint256
event ApplyNewFee:
fee: uint256
N_COINS: constant(uint256) = 2
N_COINS_128: constant(int128) = 2
PRECISION: constant(uint256) = 10 ** 18
ADMIN_ACTIONS_DEADLINE_DT: constant(uint256) = 86400 * 3
FEE_DENOMINATOR: constant(uint256) = 10 ** 10
ADMIN_FEE: constant(uint256) = 5000000000
A_PRECISION: constant(uint256) = 100
MAX_FEE: constant(uint256) = 5 * 10 ** 9
MAX_A: constant(uint256) = 10 ** 6
MAX_A_CHANGE: constant(uint256) = 10
MIN_RAMP_TIME: constant(uint256) = 86400
EIP712_TYPEHASH: constant(bytes32) = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
PERMIT_TYPEHASH: constant(bytes32) = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)")
# keccak256("isValidSignature(bytes32,bytes)")[:4] << 224
ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000
VERSION: constant(String[8]) = "v6.0.1"
factory: public(address)
coins: public(address[N_COINS])
balances: public(uint256[N_COINS])
fee: public(uint256) # fee * 1e10
future_fee: public(uint256)
admin_action_deadline: public(uint256)
initial_A: public(uint256)
future_A: public(uint256)
initial_A_time: public(uint256)
future_A_time: public(uint256)
rate_multipliers: uint256[N_COINS]
name: public(String[64])
symbol: public(String[32])
balanceOf: public(HashMap[address, uint256])
allowance: public(HashMap[address, HashMap[address, uint256]])
totalSupply: public(uint256)
DOMAIN_SEPARATOR: public(bytes32)
nonces: public(HashMap[address, uint256])
last_prices_packed: uint256 # [last_price, ma_price]
ma_exp_time: public(uint256)
ma_last_time: public(uint256)
@external
def __init__():
# we do this to prevent the implementation contract from being used as a pool
self.factory = 0x0000000000000000000000000000000000000001
assert N_COINS == 2
@external
def initialize(
_name: String[32],
_symbol: String[10],
_coins: address[4],
_rate_multipliers: uint256[4],
_A: uint256,
_fee: uint256,
):
"""
@notice Contract constructor
@param _name Name of the new pool
@param _symbol Token symbol
@param _coins List of all ERC20 conract addresses of coins
@param _rate_multipliers List of number of decimals in coins
@param _A Amplification coefficient multiplied by n ** (n - 1)
@param _fee Fee to charge for exchanges
"""
# check if factory was already set to prevent initializing contract twice
assert self.factory == empty(address)
for i in range(N_COINS):
coin: address = _coins[i]
if coin == empty(address):
break
self.coins[i] = coin
self.rate_multipliers[i] = _rate_multipliers[i]
A: uint256 = _A * A_PRECISION
self.initial_A = A
self.future_A = A
self.fee = _fee
self.factory = msg.sender
self.ma_exp_time = 866 # = 600 / ln(2)
self.last_prices_packed = self.pack_prices(10**18, 10**18)
self.ma_last_time = block.timestamp
name: String[64] = concat("Curve.fi Factory Plain Pool: ", _name)
self.name = name
self.symbol = concat(_symbol, "-f")
self.DOMAIN_SEPARATOR = keccak256(
_abi_encode(EIP712_TYPEHASH, keccak256(name), keccak256(VERSION), chain.id, self)
)
# fire a transfer event so block explorers identify the contract as an ERC20
log Transfer(empty(address), self, 0)
### ERC20 Functionality ###
@view
@external
def decimals() -> uint8:
"""
@notice Get the number of decimals for this token
@dev Implemented as a view method to reduce gas costs
@return uint8 decimal places
"""
return 18
@internal
def _transfer(_from: address, _to: address, _value: uint256):
# # NOTE: vyper does not allow underflows
# # so the following subtraction would revert on insufficient balance
self.balanceOf[_from] -= _value
self.balanceOf[_to] += _value
log Transfer(_from, _to, _value)
@external
def transfer(_to : address, _value : uint256) -> bool:
"""
@dev Transfer token for a specified address
@param _to The address to transfer to.
@param _value The amount to be transferred.
"""
self._transfer(msg.sender, _to, _value)
return True
@external
def transferFrom(_from : address, _to : address, _value : uint256) -> bool:
"""
@dev Transfer tokens from one address to another.
@param _from address The address which you want to send tokens from
@param _to address The address which you want to transfer to
@param _value uint256 the amount of tokens to be transferred
"""
self._transfer(_from, _to, _value)
_allowance: uint256 = self.allowance[_from][msg.sender]
if _allowance != max_value(uint256):
self.allowance[_from][msg.sender] = _allowance - _value
return True
@external
def approve(_spender : address, _value : uint256) -> bool:
"""
@notice Approve the passed address to transfer the specified amount of
tokens on behalf of msg.sender
@dev Beware that changing an allowance via this method brings the risk that
someone may use both the old and new allowance by unfortunate transaction
ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
@param _spender The address which will transfer the funds
@param _value The amount of tokens that may be transferred
@return bool success
"""
self.allowance[msg.sender][_spender] = _value
log Approval(msg.sender, _spender, _value)
return True
@external
def permit(
_owner: address,
_spender: address,
_value: uint256,
_deadline: uint256,
_v: uint8,
_r: bytes32,
_s: bytes32
) -> bool:
"""
@notice Approves spender by owner's signature to expend owner's tokens.
See https://eips.ethereum.org/EIPS/eip-2612.
@dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793
@dev Supports smart contract wallets which implement ERC1271
https://eips.ethereum.org/EIPS/eip-1271
@param _owner The address which is a source of funds and has signed the Permit.
@param _spender The address which is allowed to spend the funds.
@param _value The amount of tokens to be spent.
@param _deadline The timestamp after which the Permit is no longer valid.
@param _v The bytes[64] of the valid secp256k1 signature of permit by owner
@param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner
@param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner
@return True, if transaction completes successfully
"""
assert _owner != empty(address)
assert block.timestamp <= _deadline
nonce: uint256 = self.nonces[_owner]
digest: bytes32 = keccak256(
concat(
b"\x19\x01",
self.DOMAIN_SEPARATOR,
keccak256(_abi_encode(PERMIT_TYPEHASH, _owner, _spender, _value, nonce, _deadline))
)
)
if _owner.is_contract:
sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1))
# reentrancy not a concern since this is a staticcall
assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL
else:
assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner
self.allowance[_owner][_spender] = _value
self.nonces[_owner] = nonce + 1
log Approval(_owner, _spender, _value)
return True
### StableSwap Functionality ###
@pure
@internal
def pack_prices(p1: uint256, p2: uint256) -> uint256:
assert p1 < 2**128
assert p2 < 2**128
return p1 | shift(p2, 128)
@view
@external
def last_price() -> uint256:
return self.last_prices_packed & (2**128 - 1)
@view
@external
def ema_price() -> uint256:
return shift(self.last_prices_packed, -128)
@view
@external
def get_balances() -> uint256[N_COINS]:
return self.balances
@view
@internal
def _A() -> uint256:
"""
Handle ramping A up or down
"""
t1: uint256 = self.future_A_time
A1: uint256 = self.future_A
if block.timestamp < t1:
A0: uint256 = self.initial_A
t0: uint256 = self.initial_A_time
# Expressions in uint256 cannot have negative numbers, thus "if"
if A1 > A0:
return A0 + (A1 - A0) * (block.timestamp - t0) / (t1 - t0)
else:
return A0 - (A0 - A1) * (block.timestamp - t0) / (t1 - t0)
else: # when t1 == 0 or block.timestamp >= t1
return A1
@view
@external
def admin_fee() -> uint256:
return ADMIN_FEE
@view
@external
def A() -> uint256:
return self._A() / A_PRECISION
@view
@external
def A_precise() -> uint256:
return self._A()
@pure
@internal
def _xp_mem(_rates: uint256[N_COINS], _balances: uint256[N_COINS]) -> uint256[N_COINS]:
result: uint256[N_COINS] = empty(uint256[N_COINS])
for i in range(N_COINS):
result[i] = _rates[i] * _balances[i] / PRECISION
return result
@pure
@internal
def get_D(_xp: uint256[N_COINS], _amp: uint256) -> uint256:
"""
D invariant calculation in non-overflowing integer operations
iteratively
A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i))
Converging solution:
D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1)
"""
S: uint256 = 0
for x in _xp:
S += x
if S == 0:
return 0
D: uint256 = S
Ann: uint256 = _amp * N_COINS
for i in range(255):
D_P: uint256 = D * D / _xp[0] * D / _xp[1] / N_COINS**N_COINS
Dprev: uint256 = D
D = (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P)
# Equality with the precision of 1
if D > Dprev:
if D - Dprev <= 1:
return D
else:
if Dprev - D <= 1:
return D
# convergence typically occurs in 4 rounds or less, this should be unreachable!
# if it does happen the pool is borked and LPs can withdraw via `remove_liquidity`
raise
@view
@internal
def get_D_mem(_rates: uint256[N_COINS], _balances: uint256[N_COINS], _amp: uint256) -> uint256:
xp: uint256[N_COINS] = self._xp_mem(_rates, _balances)
return self.get_D(xp, _amp)
@internal
@view
def _get_p(xp: uint256[N_COINS], amp: uint256, D: uint256) -> uint256:
# dx_0 / dx_1 only, however can have any number of coins in pool
ANN: uint256 = amp * N_COINS
Dr: uint256 = D / (N_COINS**N_COINS)
for i in range(N_COINS):
Dr = Dr * D / xp[i]
return 10**18 * (ANN * xp[0] / A_PRECISION + Dr * xp[0] / xp[1]) / (ANN * xp[0] / A_PRECISION + Dr)
@external
@view
def get_p() -> uint256:
amp: uint256 = self._A()
xp: uint256[N_COINS] = self._xp_mem(self.rate_multipliers, self.balances)
D: uint256 = self.get_D(xp, amp)
return self._get_p(xp, amp, D)
@internal
@view
def exp(power: int256) -> uint256:
if power <= -42139678854452767551:
return 0
if power >= 135305999368893231589:
raise "exp overflow"
x: int256 = unsafe_div(unsafe_mul(power, 2**96), 10**18)
k: int256 = unsafe_div(
unsafe_add(
unsafe_div(unsafe_mul(x, 2**96), 54916777467707473351141471128),
2**95),
2**96)
x = unsafe_sub(x, unsafe_mul(k, 54916777467707473351141471128))
y: int256 = unsafe_add(x, 1346386616545796478920950773328)
y = unsafe_add(unsafe_div(unsafe_mul(y, x), 2**96), 57155421227552351082224309758442)
p: int256 = unsafe_sub(unsafe_add(y, x), 94201549194550492254356042504812)
p = unsafe_add(unsafe_div(unsafe_mul(p, y), 2**96), 28719021644029726153956944680412240)
p = unsafe_add(unsafe_mul(p, x), (4385272521454847904659076985693276 * 2**96))
q: int256 = x - 2855989394907223263936484059900
q = unsafe_add(unsafe_div(unsafe_mul(q, x), 2**96), 50020603652535783019961831881945)
q = unsafe_sub(unsafe_div(unsafe_mul(q, x), 2**96), 533845033583426703283633433725380)
q = unsafe_add(unsafe_div(unsafe_mul(q, x), 2**96), 3604857256930695427073651918091429)
q = unsafe_sub(unsafe_div(unsafe_mul(q, x), 2**96), 14423608567350463180887372962807573)
q = unsafe_add(unsafe_div(unsafe_mul(q, x), 2**96), 26449188498355588339934803723976023)
return shift(
unsafe_mul(convert(unsafe_div(p, q), uint256), 3822833074963236453042738258902158003155416615667),
unsafe_sub(k, 195))
@internal
@view
def _ma_price() -> uint256:
ma_last_time: uint256 = self.ma_last_time
pp: uint256 = self.last_prices_packed
last_price: uint256 = min(pp & (2**128 - 1), 2 * 10**18)
last_ema_price: uint256 = shift(pp, -128)
if ma_last_time < block.timestamp:
alpha: uint256 = self.exp(- convert((block.timestamp - ma_last_time) * 10**18 / self.ma_exp_time, int256))
return (last_price * (10**18 - alpha) + last_ema_price * alpha) / 10**18
else:
return last_ema_price
@external
@view
def price_oracle() -> uint256:
return self._ma_price()
@internal
def save_p_from_price(last_price: uint256):
"""
Saves current price and its EMA
"""
if last_price != 0:
self.last_prices_packed = self.pack_prices(last_price, self._ma_price())
if self.ma_last_time < block.timestamp:
self.ma_last_time = block.timestamp
@internal
def save_p(xp: uint256[N_COINS], amp: uint256, D: uint256):
"""
Saves current price and its EMA
"""
self.save_p_from_price(self._get_p(xp, amp, D))
@view
@external
def get_virtual_price() -> uint256:
"""
@notice The current virtual price of the pool LP token
@dev Useful for calculating profits
@return LP token virtual price normalized to 1e18
"""
amp: uint256 = self._A()
xp: uint256[N_COINS] = self._xp_mem(self.rate_multipliers, self.balances)
D: uint256 = self.get_D(xp, amp)
# D is in the units similar to DAI (e.g. converted to precision 1e18)
# When balanced, D = n * x_u - total virtual value of the portfolio
return D * PRECISION / self.totalSupply
@view
@external
def calc_token_amount(_amounts: uint256[N_COINS], _is_deposit: bool) -> uint256:
"""
@notice Calculate addition or reduction in token supply from a deposit or withdrawal
@param _amounts Amount of each coin being deposited
@param _is_deposit set True for deposits, False for withdrawals
@return Expected amount of LP tokens received
"""
amp: uint256 = self._A()
old_balances: uint256[N_COINS] = self.balances
rates: uint256[N_COINS] = self.rate_multipliers
# Initial invariant
D0: uint256 = self.get_D_mem(rates, old_balances, amp)
total_supply: uint256 = self.totalSupply
new_balances: uint256[N_COINS] = old_balances
for i in range(N_COINS):
amount: uint256 = _amounts[i]
if _is_deposit:
new_balances[i] += amount
else:
new_balances[i] -= amount
# Invariant after change
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
# We need to recalculate the invariant accounting for fees
# to calculate fair user's share
D2: uint256 = D1
if total_supply > 0:
# Only account for fees if we are not the first to deposit
base_fee: uint256 = self.fee * N_COINS / (4 * (N_COINS - 1))
for i in range(N_COINS):
ideal_balance: uint256 = D1 * old_balances[i] / D0
difference: uint256 = 0
new_balance: uint256 = new_balances[i]
if ideal_balance > new_balance:
difference = ideal_balance - new_balance
else:
difference = new_balance - ideal_balance
new_balances[i] -= base_fee * difference / FEE_DENOMINATOR
xp: uint256[N_COINS] = self._xp_mem(rates, new_balances)
D2 = self.get_D(xp, amp)
else:
return D1 # Take the dust if there was any
diff: uint256 = 0
if _is_deposit:
diff = D2 - D0
else:
diff = D0 - D2
return diff * total_supply / D0
@external
@nonreentrant('lock')
def add_liquidity(
_amounts: uint256[N_COINS],
_min_mint_amount: uint256,
_receiver: address = msg.sender
) -> uint256:
"""
@notice Deposit coins into the pool
@param _amounts List of amounts of coins to deposit
@param _min_mint_amount Minimum amount of LP tokens to mint from the deposit
@param _receiver Address that owns the minted LP tokens
@return Amount of LP tokens received by depositing
"""
amp: uint256 = self._A()
old_balances: uint256[N_COINS] = self.balances
rates: uint256[N_COINS] = self.rate_multipliers
# Initial invariant
D0: uint256 = self.get_D_mem(rates, old_balances, amp)
total_supply: uint256 = self.totalSupply
new_balances: uint256[N_COINS] = old_balances
for i in range(N_COINS):
amount: uint256 = _amounts[i]
if amount > 0:
assert ERC20(self.coins[i]).transferFrom(msg.sender, self, amount, default_return_value=True) # dev: failed transfer
new_balances[i] += amount
else:
assert total_supply != 0 # dev: initial deposit requires all coins
# Invariant after change
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
assert D1 > D0
# We need to recalculate the invariant accounting for fees
# to calculate fair user's share
fees: uint256[N_COINS] = empty(uint256[N_COINS])
mint_amount: uint256 = 0
if total_supply > 0:
# Only account for fees if we are not the first to deposit
base_fee: uint256 = self.fee * N_COINS / (4 * (N_COINS - 1))
for i in range(N_COINS):
ideal_balance: uint256 = D1 * old_balances[i] / D0
difference: uint256 = 0
new_balance: uint256 = new_balances[i]
if ideal_balance > new_balance:
difference = ideal_balance - new_balance
else:
difference = new_balance - ideal_balance
fees[i] = base_fee * difference / FEE_DENOMINATOR
self.balances[i] = new_balance - (fees[i] * ADMIN_FEE / FEE_DENOMINATOR)
new_balances[i] -= fees[i]
xp: uint256[N_COINS] = self._xp_mem(rates, new_balances)
D2: uint256 = self.get_D(xp, amp)
mint_amount = total_supply * (D2 - D0) / D0
self.save_p(xp, amp, D2)
else:
self.balances = new_balances
mint_amount = D1 # Take the dust if there was any
assert mint_amount >= _min_mint_amount, "Slippage screwed you"
# Mint pool tokens
total_supply += mint_amount
self.balanceOf[_receiver] += mint_amount
self.totalSupply = total_supply
log Transfer(empty(address), _receiver, mint_amount)
log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply)
return mint_amount
@view
@internal
def get_y(i: int128, j: int128, x: uint256, xp: uint256[N_COINS], _amp: uint256, _D: uint256) -> uint256:
"""
Calculate x[j] if one makes x[i] = x
Done by solving quadratic equation iteratively.
x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
"""
# x in the input is converted to the same price/precision
assert i != j # dev: same coin
assert j >= 0 # dev: j below zero
assert j < N_COINS_128 # dev: j above N_COINS
# should be unreachable, but good for safety
assert i >= 0
assert i < N_COINS_128
amp: uint256 = _amp
D: uint256 = _D
if _D == 0:
amp = self._A()
D = self.get_D(xp, amp)
S_: uint256 = 0
_x: uint256 = 0
y_prev: uint256 = 0
c: uint256 = D
Ann: uint256 = amp * N_COINS
for _i in range(N_COINS_128):
if _i == i:
_x = x
elif _i != j:
_x = xp[_i]
else:
continue
S_ += _x
c = c * D / (_x * N_COINS)
c = c * D * A_PRECISION / (Ann * N_COINS)
b: uint256 = S_ + D * A_PRECISION / Ann # - D
y: uint256 = D
for _i in range(255):
y_prev = y
y = (y*y + c) / (2 * y + b - D)
# Equality with the precision of 1
if y > y_prev:
if y - y_prev <= 1:
return y
else:
if y_prev - y <= 1:
return y
raise
@view
@external
def get_dy(i: int128, j: int128, dx: uint256) -> uint256:
"""
@notice Calculate the current output dy given input dx
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index valie of the coin to recieve
@param dx Amount of `i` being exchanged
@return Amount of `j` predicted
"""
rates: uint256[N_COINS] = self.rate_multipliers
xp: uint256[N_COINS] = self._xp_mem(rates, self.balances)
x: uint256 = xp[i] + (dx * rates[i] / PRECISION)
y: uint256 = self.get_y(i, j, x, xp, 0, 0)
dy: uint256 = xp[j] - y - 1
fee: uint256 = self.fee * dy / FEE_DENOMINATOR
return (dy - fee) * PRECISION / rates[j]
@view
@external
def get_dx(i: int128, j: int128, dy: uint256) -> uint256:
"""
@notice Calculate the current input dx given output dy
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index valie of the coin to recieve
@param dy Amount of `j` being received after exchange
@return Amount of `i` predicted
"""
rates: uint256[N_COINS] = self.rate_multipliers
xp: uint256[N_COINS] = self._xp_mem(rates, self.balances)
y: uint256 = xp[j] - (dy * rates[j] / PRECISION + 1) * FEE_DENOMINATOR / (FEE_DENOMINATOR - self.fee)
x: uint256 = self.get_y(j, i, y, xp, 0, 0)
return (x - xp[i]) * PRECISION / rates[i]
@external
@nonreentrant('lock')
def exchange(
i: int128,
j: int128,
_dx: uint256,
_min_dy: uint256,
_receiver: address = msg.sender,
) -> uint256:
"""
@notice Perform an exchange between two coins
@dev Index values can be found via the `coins` public getter method
@param i Index value for the coin to send
@param j Index valie of the coin to recieve
@param _dx Amount of `i` being exchanged
@param _min_dy Minimum amount of `j` to receive
@return Actual amount of `j` received
"""
rates: uint256[N_COINS] = self.rate_multipliers
old_balances: uint256[N_COINS] = self.balances
xp: uint256[N_COINS] = self._xp_mem(rates, old_balances)
x: uint256 = xp[i] + _dx * rates[i] / PRECISION
amp: uint256 = self._A()
D: uint256 = self.get_D(xp, amp)
y: uint256 = self.get_y(i, j, x, xp, amp, D)
dy: uint256 = xp[j] - y - 1 # -1 just in case there were some rounding errors
dy_fee: uint256 = dy * self.fee / FEE_DENOMINATOR
# Convert all to real units
dy = (dy - dy_fee) * PRECISION / rates[j]
assert dy >= _min_dy, "Exchange resulted in fewer coins than expected"
# xp is not used anymore, so we reuse it for price calc
xp[i] = x
xp[j] = y
# D is not changed because we did not apply a fee
self.save_p(xp, amp, D)
dy_admin_fee: uint256 = dy_fee * ADMIN_FEE / FEE_DENOMINATOR
dy_admin_fee = dy_admin_fee * PRECISION / rates[j]
# Change balances exactly in same way as we change actual ERC20 coin amounts
self.balances[i] = old_balances[i] + _dx
# When rounding errors happen, we undercharge admin fee in favor of LP
self.balances[j] = old_balances[j] - dy - dy_admin_fee
assert ERC20(self.coins[i]).transferFrom(msg.sender, self, _dx, default_return_value=True) # dev: failed transfer
assert ERC20(self.coins[j]).transfer(_receiver, dy, default_return_value=True) # dev: failed transfer
log TokenExchange(msg.sender, i, _dx, j, dy)
return dy
@external
@nonreentrant('lock')
def remove_liquidity(
_burn_amount: uint256,
_min_amounts: uint256[N_COINS],
_receiver: address = msg.sender
) -> uint256[N_COINS]:
"""
@notice Withdraw coins from the pool
@dev Withdrawal amounts are based on current deposit ratios
@param _burn_amount Quantity of LP tokens to burn in the withdrawal
@param _min_amounts Minimum amounts of underlying coins to receive
@param _receiver Address that receives the withdrawn coins
@return List of amounts of coins that were withdrawn
"""
total_supply: uint256 = self.totalSupply
amounts: uint256[N_COINS] = empty(uint256[N_COINS])
for i in range(N_COINS):
old_balance: uint256 = self.balances[i]
value: uint256 = old_balance * _burn_amount / total_supply
assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected"
self.balances[i] = old_balance - value
amounts[i] = value
assert ERC20(self.coins[i]).transfer(_receiver, value, default_return_value=True) # dev: failed transfer
total_supply -= _burn_amount
self.balanceOf[msg.sender] -= _burn_amount
self.totalSupply = total_supply
log Transfer(msg.sender, empty(address), _burn_amount)
log RemoveLiquidity(msg.sender, amounts, empty(uint256[N_COINS]), total_supply)
return amounts
@external
@nonreentrant('lock')
def remove_liquidity_imbalance(
_amounts: uint256[N_COINS],
_max_burn_amount: uint256,
_receiver: address = msg.sender
) -> uint256:
"""
@notice Withdraw coins from the pool in an imbalanced amount
@param _amounts List of amounts of underlying coins to withdraw
@param _max_burn_amount Maximum amount of LP token to burn in the withdrawal
@param _receiver Address that receives the withdrawn coins
@return Actual amount of the LP token burned in the withdrawal
"""
amp: uint256 = self._A()
rates: uint256[N_COINS] = self.rate_multipliers
old_balances: uint256[N_COINS] = self.balances
D0: uint256 = self.get_D_mem(rates, old_balances, amp)
new_balances: uint256[N_COINS] = old_balances
for i in range(N_COINS):
amount: uint256 = _amounts[i]
if amount != 0:
new_balances[i] -= amount
assert ERC20(self.coins[i]).transfer(_receiver, amount, default_return_value=True) # dev: failed transfer
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
fees: uint256[N_COINS] = empty(uint256[N_COINS])
base_fee: uint256 = self.fee * N_COINS / (4 * (N_COINS - 1))
for i in range(N_COINS):
ideal_balance: uint256 = D1 * old_balances[i] / D0
difference: uint256 = 0
new_balance: uint256 = new_balances[i]
if ideal_balance > new_balance:
difference = ideal_balance - new_balance
else:
difference = new_balance - ideal_balance
fees[i] = base_fee * difference / FEE_DENOMINATOR
self.balances[i] = new_balance - (fees[i] * ADMIN_FEE / FEE_DENOMINATOR)
new_balances[i] -= fees[i]
new_balances = self._xp_mem(rates, new_balances)
D2: uint256 = self.get_D(new_balances, amp)
self.save_p(new_balances, amp, D2)
total_supply: uint256 = self.totalSupply
burn_amount: uint256 = ((D0 - D2) * total_supply / D0) + 1
assert burn_amount > 1 # dev: zero tokens burned
assert burn_amount <= _max_burn_amount, "Slippage screwed you"
total_supply -= burn_amount
self.totalSupply = total_supply
self.balanceOf[msg.sender] -= burn_amount
log Transfer(msg.sender, empty(address), burn_amount)
log RemoveLiquidityImbalance(msg.sender, _amounts, fees, D1, total_supply)
return burn_amount
@pure
@internal
def get_y_D(A: uint256, i: int128, xp: uint256[N_COINS], D: uint256) -> uint256:
"""
Calculate x[i] if one reduces D from being calculated for xp to D
Done by solving quadratic equation iteratively.
x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
"""
# x in the input is converted to the same price/precision
assert i >= 0 # dev: i below zero
assert i < N_COINS_128 # dev: i above N_COINS
S_: uint256 = 0
_x: uint256 = 0
y_prev: uint256 = 0
c: uint256 = D
Ann: uint256 = A * N_COINS
for _i in range(N_COINS_128):
if _i != i:
_x = xp[_i]
else:
continue
S_ += _x
c = c * D / (_x * N_COINS)
c = c * D * A_PRECISION / (Ann * N_COINS)
b: uint256 = S_ + D * A_PRECISION / Ann
y: uint256 = D
for _i in range(255):
y_prev = y
y = (y*y + c) / (2 * y + b - D)
# Equality with the precision of 1
if y > y_prev:
if y - y_prev <= 1:
return y
else:
if y_prev - y <= 1:
return y
raise
@view
@internal
def _calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256[3]:
# First, need to calculate
# * Get current D
# * Solve Eqn against y_i for D - _token_amount
amp: uint256 = self._A()
rates: uint256[N_COINS] = self.rate_multipliers
xp: uint256[N_COINS] = self._xp_mem(rates, self.balances)
D0: uint256 = self.get_D(xp, amp)
total_supply: uint256 = self.totalSupply
D1: uint256 = D0 - _burn_amount * D0 / total_supply
new_y: uint256 = self.get_y_D(amp, i, xp, D1)
base_fee: uint256 = self.fee * N_COINS / (4 * (N_COINS - 1))
xp_reduced: uint256[N_COINS] = empty(uint256[N_COINS])
for j in range(N_COINS_128):
dx_expected: uint256 = 0
xp_j: uint256 = xp[j]
if j == i:
dx_expected = xp_j * D1 / D0 - new_y
else:
dx_expected = xp_j - xp_j * D1 / D0
xp_reduced[j] = xp_j - base_fee * dx_expected / FEE_DENOMINATOR
dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1)
dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i] # w/o fees
dy = (dy - 1) * PRECISION / rates[i] # Withdraw less to account for rounding errors
xp[i] = new_y
last_p: uint256 = 0
if new_y > 0:
last_p = self._get_p(xp, amp, D1)
return [dy, dy_0 - dy, last_p]
@view
@external
def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256:
"""
@notice Calculate the amount received when withdrawing a single coin
@param _burn_amount Amount of LP tokens to burn in the withdrawal
@param i Index value of the coin to withdraw
@return Amount of coin received
"""
return self._calc_withdraw_one_coin(_burn_amount, i)[0]
@external
@nonreentrant('lock')
def remove_liquidity_one_coin(
_burn_amount: uint256,
i: int128,
_min_received: uint256,
_receiver: address = msg.sender,
) -> uint256:
"""
@notice Withdraw a single coin from the pool
@param _burn_amount Amount of LP tokens to burn in the withdrawal
@param i Index value of the coin to withdraw
@param _min_received Minimum amount of coin to receive
@param _receiver Address that receives the withdrawn coins
@return Amount of coin received
"""
dy: uint256[3] = self._calc_withdraw_one_coin(_burn_amount, i)
assert dy[0] >= _min_received, "Not enough coins removed"
self.balances[i] -= (dy[0] + dy[1] * ADMIN_FEE / FEE_DENOMINATOR)
total_supply: uint256 = self.totalSupply - _burn_amount
self.totalSupply = total_supply
self.balanceOf[msg.sender] -= _burn_amount
log Transfer(msg.sender, empty(address), _burn_amount)
assert ERC20(self.coins[i]).transfer(_receiver, dy[0], default_return_value=True) # dev: failed transfer
log RemoveLiquidityOne(msg.sender, _burn_amount, dy[0], total_supply)
self.save_p_from_price(dy[2])
return dy[0]
@external
def ramp_A(_future_A: uint256, _future_time: uint256):
assert msg.sender == Factory(self.factory).admin() # dev: only owner
assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME
assert _future_time >= block.timestamp + MIN_RAMP_TIME # dev: insufficient time
_initial_A: uint256 = self._A()
_future_A_p: uint256 = _future_A * A_PRECISION
assert _future_A > 0 and _future_A < MAX_A
if _future_A_p < _initial_A:
assert _future_A_p * MAX_A_CHANGE >= _initial_A
else:
assert _future_A_p <= _initial_A * MAX_A_CHANGE
self.initial_A = _initial_A
self.future_A = _future_A_p
self.initial_A_time = block.timestamp
self.future_A_time = _future_time
log RampA(_initial_A, _future_A_p, block.timestamp, _future_time)
@external
def stop_ramp_A():
assert msg.sender == Factory(self.factory).admin() # dev: only owner
current_A: uint256 = self._A()
self.initial_A = current_A
self.future_A = current_A
self.initial_A_time = block.timestamp
self.future_A_time = block.timestamp
# now (block.timestamp < t1) is always False, so we return saved A
log StopRampA(current_A, block.timestamp)
@external
def set_ma_exp_time(_ma_exp_time: uint256):
assert msg.sender == Factory(self.factory).admin() # dev: only owner
assert _ma_exp_time != 0
self.ma_exp_time = _ma_exp_time
@view
@external
def admin_balances(i: uint256) -> uint256:
return ERC20(self.coins[i]).balanceOf(self) - self.balances[i]
@external
def commit_new_fee(_new_fee: uint256):
assert msg.sender == Factory(self.factory).admin()
assert _new_fee <= MAX_FEE
assert self.admin_action_deadline == 0
self.future_fee = _new_fee
self.admin_action_deadline = block.timestamp + ADMIN_ACTIONS_DEADLINE_DT
log CommitNewFee(_new_fee)
@external
def apply_new_fee():
assert msg.sender == Factory(self.factory).admin()
deadline: uint256 = self.admin_action_deadline
assert deadline != 0 and block.timestamp >= deadline
fee: uint256 = self.future_fee
self.fee = fee
self.admin_action_deadline = 0
log ApplyNewFee(fee)
@external
def withdraw_admin_fees():
receiver: address = Factory(self.factory).get_fee_receiver(self)
for i in range(N_COINS):
coin: address = self.coins[i]
fees: uint256 = ERC20(coin).balanceOf(self) - self.balances[i]
assert ERC20(coin).transfer(receiver, fees, default_return_value=True)
@pure
@external
def version() -> String[8]:
"""
@notice Get the version of this token contract
"""
return VERSION
Read Contract
A 0xf446c1d0 → uint256
A_precise 0x76a2f0f0 → uint256
DOMAIN_SEPARATOR 0x3644e515 → bytes32
admin_action_deadline 0xe66f43f5 → uint256
admin_balances 0xe2e7d264 → uint256
admin_fee 0xfee3f7f9 → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
balances 0x4903b0d1 → uint256
calc_token_amount 0xed8e84f3 → uint256
calc_withdraw_one_coin 0xcc2b27d7 → uint256
coins 0xc6610657 → address
decimals 0x313ce567 → uint8
ema_price 0xc24c7c29 → uint256
factory 0xc45a0155 → address
fee 0xddca3f43 → uint256
future_A 0xb4b577ad → uint256
future_A_time 0x14052288 → uint256
future_fee 0x58680d0b → uint256
get_balances 0x14f05979 → uint256[2]
get_dx 0x67df02ca → uint256
get_dy 0x5e0d443f → uint256
get_p 0xf2388acb → uint256
get_virtual_price 0xbb7b8b80 → uint256
initial_A 0x5409491a → uint256
initial_A_time 0x2081066c → uint256
last_price 0xfde625e6 → uint256
ma_exp_time 0x1be913a5 → uint256
ma_last_time 0x1ddc3b01 → uint256
name 0x06fdde03 → string
nonces 0x7ecebe00 → uint256
price_oracle 0x86fc88d3 → uint256
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
version 0x54fd4d50 → string
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
add_liquidity 0x0b4c7e4d
uint256[2] _amounts
uint256 _min_mint_amount
returns: uint256
add_liquidity 0x0c3e4b54
uint256[2] _amounts
uint256 _min_mint_amount
address _receiver
returns: uint256
apply_new_fee 0x4f12fe97
No parameters
approve 0x095ea7b3
address _spender
uint256 _value
returns: bool
commit_new_fee 0xa48eac9d
uint256 _new_fee
exchange 0x3df02124
int128 i
int128 j
uint256 _dx
uint256 _min_dy
returns: uint256
exchange 0xddc1f59d
int128 i
int128 j
uint256 _dx
uint256 _min_dy
address _receiver
returns: uint256
initialize 0xa461b3c8
string _name
string _symbol
address[4] _coins
uint256[4] _rate_multipliers
uint256 _A
uint256 _fee
permit 0xd505accf
address _owner
address _spender
uint256 _value
uint256 _deadline
uint8 _v
bytes32 _r
bytes32 _s
returns: bool
ramp_A 0x3c157e64
uint256 _future_A
uint256 _future_time
remove_liquidity 0x5b36389c
uint256 _burn_amount
uint256[2] _min_amounts
returns: uint256[2]
remove_liquidity 0x3eb1719f
uint256 _burn_amount
uint256[2] _min_amounts
address _receiver
returns: uint256[2]
remove_liquidity_imbalance 0xe3103273
uint256[2] _amounts
uint256 _max_burn_amount
returns: uint256
remove_liquidity_imbalance 0x52d2cfdd
uint256[2] _amounts
uint256 _max_burn_amount
address _receiver
returns: uint256
remove_liquidity_one_coin 0x1a4d01d2
uint256 _burn_amount
int128 i
uint256 _min_received
returns: uint256
remove_liquidity_one_coin 0x081579a5
uint256 _burn_amount
int128 i
uint256 _min_received
address _receiver
returns: uint256
set_ma_exp_time 0x7f3e17cb
uint256 _ma_exp_time
stop_ramp_A 0x551a6588
No parameters
transfer 0xa9059cbb
address _to
uint256 _value
returns: bool
transferFrom 0x23b872dd
address _from
address _to
uint256 _value
returns: bool
withdraw_admin_fees 0x30c54085
No parameters
Recent Transactions
No transactions found for this address