Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB
Balance 0 ETH
Nonce 1
Code Size 12013 bytes
Indexed Transactions 0 (1 on-chain, 1.7% indexed)
External Etherscan · Sourcify

Contract Bytecode

12013 bytes
Copy Bytecode
0x600436101561000d57612ee7565b600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a052636b441a4060005114156101105734156100ba57600080fd5b60043560205181106100cb57600080fd5b5060005433146100da57600080fd5b600435600155600435610140527f2f56810a6bf40af059b96d3aea4db54081f378029a518390491093a7b67032e96020610140a1005b636a1c05ae600051141561018657341561012957600080fd5b600054331461013757600080fd5b600154610140526000610140511861014e57600080fd5b6101405160005561014051610160527febee2d5739011062cb4f14113f3b36bf0ffe3da5c0568f64189d1012a11891056020610160a1005b633f9095b7600051141561020f57341561019f57600080fd5b60043560205181106101b057600080fd5b50600860043560e05260c052604060c0205461014052600061014051186101d657600080fd5b610140516001606051818303806040519013156101f257600080fd5b809190121561020057600080fd5b9050905060005260206000f350005b600015610341575b610160526101405261014051633b9aca00811061023357600080fd5b601560c052602060c02001546101805260006101805111156103305760146101405160e05260c052604060c0206101805160e05260c052604060c020546101c0526101e060006101f4818352015b4261018051111561029157610319565b610180805162093a808181830110156102a957600080fd5b808201905090508152506101c05160146101405160e05260c052604060c0206101805160e05260c052604060c0205542610180511115610308576101805161014051633b9aca0081106102fb57600080fd5b601560c052602060c02001555b5b8151600101808352811415610281575b50506101c05160005260005161016051565061033f565b60006000526000516101605156505b005b600015610553575b610160526101405261014051633b9aca00811061036557600080fd5b601160c052602060c0200154610180526000610180511115610542576101c0600f6101405160e05260c052604060c0206101805160e05260c052604060c0208060c052602060c02054825260018160c052602060c02001548260200152505061020060006101f4818352015b426101805111156103e15761052b565b610180805162093a808181830110156103f957600080fd5b808201905090508152506101e05162093a80808202821582848304141761041f57600080fd5b8090509050905061022052610220516101c05111156104a2576101c08051610220518082101561044e57600080fd5b8082039050905081525060106101405160e05260c052604060c0206101805160e05260c052604060c02054610240526101e08051610240518082101561049357600080fd5b808203905090508152506104af565b60006101c05260006101e0525b600f6101405160e05260c052604060c0206101805160e05260c052604060c02060c052602060c0206101c0805182558060200151600183015550504261018051111561051a576101805161014051633b9aca00811061050d57600080fd5b601160c052602060c02001555b5b81516001018083528114156103d1575b50506101c051600052600051610160515650610551565b60006000526000516101605156505b005b6000156107eb575b6101405260135461016052600454610180524261016051111561059957610160805162093a808082101561058e57600080fd5b808203905090508152505b60126101605160e05260c052604060c020546101a0526101c060006064818352015b610180516101c05114156105ce57610691565b6101405161016051610180516101a0516101c0516101c051610200526102005160065801610349565b610260526101c0526101a052610180526101605261014052610260506101405161016051610180516101a0516101c0516101e051610200516102205161024051610260516101c0516102a0526102a05160065801610217565b61030052610260526102405261022052610200526101e0526101c0526101a052610180526101605261014052610300505b81516001018083528114156105bb575b505061032060006101f4818352015b426101605111156106b0576107d7565b610160805162093a808181830110156106c857600080fd5b8082019050905081525060006101a05261034060006064818352015b610180516103405114156106f75761079b565b600f6103405160e05260c052604060c0206101605160e05260c052604060c02060c052602060c020546103605260146103405160e05260c052604060c0206101605160e05260c052604060c02054610380526101a080516103605161038051808202821582848304141761076a57600080fd5b8090509050905081818301101561078057600080fd5b808201905090508152505b81516001018083528114156106e4575b50506101a05160126101605160e05260c052604060c02055426101605111156107c657610160516013555b5b81516001018083528114156106a0575b50506101a051600052600051610140515650005b6000156109e1575b6101605261014052600e6101405160e05260c052604060c020546101805260006101805111156109d0576101c0600c6101405160e05260c052604060c0206101805160e05260c052604060c0208060c052602060c02054825260018160c052602060c02001548260200152505061020060006101f4818352015b4261018051111561087d576109b9565b610180805162093a8081818301101561089557600080fd5b808201905090508152506101e05162093a8080820282158284830414176108bb57600080fd5b8090509050905061022052610220516101c051111561093e576101c0805161022051808210156108ea57600080fd5b80820390509050815250600d6101405160e05260c052604060c0206101805160e05260c052604060c02054610240526101e08051610240518082101561092f57600080fd5b8082039050905081525061094b565b60006101c05260006101e0525b600c6101405160e05260c052604060c0206101805160e05260c052604060c02060c052602060c0206101c080518255806020015160018301555050426101805111156109a85761018051600e6101405160e05260c052604060c020555b5b815160010180835281141561086d575b50506101c0516000526000516101605156506109df565b60006000526000516101605156505b005b633a04f90060005114156109fa57600061014052610a20565b6318dfe9216000511415610a18576020604461014037600050610a20565b600015610e4a575b3415610a2b57600080fd5b6004356020518110610a3c57600080fd5b5060605160243580604051901315610a5357600080fd5b8091901215610a6157600080fd5b506000543314610a7057600080fd5b6000602435121515610a885760045460243512610a8b565b60005b610a9457600080fd5b600860043560e05260c052604060c0205415610aaf57600080fd5b6005546101605261016051600160605181830180604051901315610ad257600080fd5b8091901215610ae057600080fd5b9050905060055560043561016051633b9aca008110610afe57600080fd5b600760c052602060c0200155602435600160605181830180604051901315610b2557600080fd5b8091901215610b3357600080fd5b90509050600860043560e05260c052604060c020554262093a80818183011015610b5c57600080fd5b8082019050905062093a808080610b7257600080fd5b82049050905062093a808082028215828483041417610b9057600080fd5b80905090509050610180526000610140511115610dad576101405161016051610180516101a0516024356101e0526101e05160065801610217565b610240526101a052610180526101605261014052610240516101a0526101405161016051610180516101a0516101c0516101e051610200516102205161024051610260516024356102a0526102a05160065801610349565b61030052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526103005161026052610140610340525b61034051516020610340510161034052610340610340511015610c8157610c5f565b6006580161055b565b61036052610320610340525b6103405152602061034051036103405261014061034051101515610cb957610c96565b61036051610320526101405161026051818183011015610cd857600080fd5b80820190509050600f60243560e05260c052604060c0206101805160e05260c052604060c02060c052602060c0205561018051602435633b9aca008110610d1e57600080fd5b601160c052602060c0200155610320516101a051610140518082028215828483041417610d4a57600080fd5b80905090509050818183011015610d6057600080fd5b8082019050905060126101805160e05260c052604060c020556101805160135561014051600c60043560e05260c052604060c0206101805160e05260c052604060c02060c052602060c020555b602435633b9aca008110610dc057600080fd5b601160c052602060c02001541515610df65761018051602435633b9aca008110610de957600080fd5b601160c052602060c02001555b61018051600e60043560e05260c052604060c02055600435610380526024356103a052610140516103c0527ffd55b3191f9c9dd92f4f134dd700e7d76f6a0c836a08687023d6d38f03ebd8776060610380a1005b63c2c4c5c16000511415610e76573415610e6357600080fd5b6006580161055b565b6101405261014050005b63615e52376000511415610ef0573415610e8f57600080fd5b6004356020518110610ea057600080fd5b506004356101405261014051600658016107f3565b6101a0526101a0506101405161016051610180516101a0516006580161055b565b6101e0526101a0526101805261016052610140526101e050005b600015611072575b6101805261014052610160526101605162093a808080610f1757600080fd5b82049050905062093a808082028215828483041417610f3557600080fd5b809050905090506101a05260126101a05160e05260c052604060c020546101c05260006101c05111156110615760086101405160e05260c052604060c02054600160605181830380604051901315610f8c57600080fd5b8091901215610f9a57600080fd5b905090506102005260146102005160e05260c052604060c0206101a05160e05260c052604060c0205461022052600c6101405160e05260c052604060c0206101a05160e05260c052604060c02060c052602060c0205461024052670de0b6b3a764000061022051808202821582848304141761101557600080fd5b8090509050905061024051808202821582848304141761103457600080fd5b809050905090506101c051808061104a57600080fd5b820490509050600052600051610180515650611070565b60006000526000516101805156505b005b636207d866600051141561108a5742610140526110b0565b63d3078c9460005114156110a85760206024610140376000506110b0565b600015611108575b34156110bb57600080fd5b60043560205181106110cc57600080fd5b506101405160043561018052610140516101a0526101a0516101805160065801610ef8565b61020052610140526102005160005260206000f350005b6395cfcec36000511415611120574261014052611146565b636472eee1600051141561113e576020602461014037600050611146565b60001561123b575b341561115157600080fd5b600435602051811061116257600080fd5b50610140516004356101805261018051600658016107f3565b6101e052610140526101e0506101405161016051610180516101a0516101c0516101e0516006580161055b565b610220526101e0526101c0526101a052610180526101605261014052610220506101405161016051610180516101a0516101c0516101e0516102005161022051600435610260526101405161028052610280516102605160065801610ef8565b6102e05261022052610200526101e0526101c0526101a0526101805261016052610140526102e05160005260206000f350005b6000156114e8575b6101805261014052610160526101405161016051610180516101a051610140516101e0526101e05160065801610217565b610240526101a052610180526101605261014052610240516101a0526101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610140516102a0526102a05160065801610349565b61030052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526103005161026052610140610340525b6103405151602061034051016103405261034061034051101561132b57611309565b6006580161055b565b61036052610320610340525b610340515260206103405103610340526101406103405110151561136357611340565b61036051610320524262093a8081818301101561137f57600080fd5b8082019050905062093a80808061139557600080fd5b82049050905062093a8080820282158284830414176113b357600080fd5b809050905090506103805261032051610260516101605180820282158284830414176113de57600080fd5b809050905090508181830110156113f457600080fd5b80820190509050610260516101a051808202821582848304141761141757600080fd5b809050905090508082101561142b57600080fd5b80820390509050610320526103205160126103805160e05260c052604060c020556101605160146101405160e05260c052604060c0206103805160e05260c052604060c02055610380516013556103805161014051633b9aca00811061149057600080fd5b601560c052602060c0200155610140516103a052610380516103c052610160516103e05261032051610400527e170bcdc909b6ac6e12d020fe8942256312cdcd555fb6d712899eba56d2f90160806103a0a161018051565b6326e56d5e60005114156115015760006101c052611527565b6392d0d232600051141561151f57602060246101c037600050611527565b600015611716575b341561153257600080fd5b606060043560040161014037604060043560040135111561155257600080fd5b600054331461156057600080fd5b6004546101e0526101408060066101e05160e05260c052604060c02060c052602060c020602082510161012060006003818352015b826101205160200211156115a8576115ca565b61012051602002850151610120518501555b8151600101808352811415611595575b5050505050506101e0516001606051818301806040519013156115ec57600080fd5b80919012156115fa57600080fd5b9050905060045560006101c0511815611714576101405161016051610180516101a0516101c0516101e0516101e051610220526101c05161024052610240516102205160065801611243565b6101e0526101c0526101a0526101805261016052610140526000506101e0516103005260406102a0526102a0516102e0526101408051602001806102a0516102e0018284600060045af161169957600080fd5b50506102a0516102e001518060206102a0516102e0010101818260206001820306601f820103905003368237505060206102a0516102e0015160206001820306601f82010390506102a05101016102a0527f6fbe76157c712f16b5a3c44ed48baa04e3450bc3fab0c020e848aca72bbccc846102a0516102e0a15b005b63db1ca260600051141561178657341561172f57600080fd5b6060516004358060405190131561174557600080fd5b809190121561175357600080fd5b50600054331461176257600080fd5b6004356101405260243561016052610160516101405160065801611243565b600050005b600015611b79575b61018052610140526101605260086101405160e05260c052604060c020546001606051818303806040519013156117c457600080fd5b80919012156117d257600080fd5b905090506101a0526101405161016051610180516101a0516101c051610140516102005261020051600658016107f3565b610260526101c0526101a052610180526101605261014052610260516101c0526101406102a0525b6102a0515160206102a051016102a0526102a06102a051101561184d5761182b565b6101a0516102c0526102c05160065801610217565b610320526102806102a0525b6102a0515260206102a051036102a0526101406102a0511015156118915761186e565b6103205161028052610140610360525b610360515160206103605101610360526103606103605110156118c3576118a1565b6101a051610380526103805160065801610349565b6103e052610340610360525b6103605152602061036051036103605261014061036051101515611907576118e4565b6103e05161034052610140610420525b6104205151602061042051016104205261042061042051101561193957611917565b6006580161055b565b61044052610400610420525b61042051526020610420510361042052610140610420511015156119715761194e565b61044051610400524262093a8081818301101561198d57600080fd5b8082019050905062093a8080806119a357600080fd5b82049050905062093a8080820282158284830414176119c157600080fd5b809050905090506104605261016051600c6101405160e05260c052604060c0206104605160e05260c052604060c02060c052602060c0205561046051600e6101405160e05260c052604060c020556103405161016051818183011015611a2657600080fd5b808201905090506101c05180821015611a3e57600080fd5b808203905090506104805261048051600f6101a05160e05260c052604060c0206104605160e05260c052604060c02060c052602060c02055610460516101a051633b9aca008110611a8e57600080fd5b601160c052602060c02001556104005161048051610280518082028215828483041417611aba57600080fd5b80905090509050818183011015611ad057600080fd5b8082019050905061034051610280518082028215828483041417611af357600080fd5b8090509050905080821015611b0757600080fd5b80820390509050610400526104005160126104605160e05260c052604060c0205561046051601355610140516104a052426104c052610160516104e05261040051610500527f54c0cf3647e6cdb2fc0a7876e60ba77563fceedf2e06c01c597f8dccb9e6bd7260806104a0a161018051565b63d4d2646e6000511415611bd6573415611b9257600080fd5b6004356020518110611ba357600080fd5b506000543314611bb257600080fd5b600435610140526024356101605261016051610140516006580161178e565b600050005b63d71363286000511415612699573415611bef57600080fd5b6004356020518110611c0057600080fd5b506003546101405260206102006024637c74a17461018052336101a05261019c610140515afa611c2f57600080fd5b601f3d11611c3c57600080fd5b600050610200516000811215611c5157600080fd5b6101605260206102c0602463adc6358961024052336102605261025c610140515afa611c7c57600080fd5b601f3d11611c8957600080fd5b6000506102c051610220526005546102e0524262093a80818183011015611caf57600080fd5b8082019050905062093a808080611cc557600080fd5b82049050905062093a808082028215828483041417611ce357600080fd5b80905090509050610300526308c379a0610320526020610340526020610360527f596f757220746f6b656e206c6f636b206578706972657320746f6f20736f6f6e6103805261036050610300516102205111611d4057606461033cfd5b6308c379a06103c05260206103e052601e610400527f596f75207573656420616c6c20796f757220766f74696e6720706f776572000061042052610400506000602435101515611d97576127106024351115611d9a565b60005b611da55760646103dcfd5b6308c379a06104605260206104805260146104a0527f43616e6e6f7420766f746520736f206f6674656e0000000000000000000000006104c0526104a050600b3360e05260c052604060c02060043560e05260c052604060c02054620d2f00818183011015611e1357600080fd5b80820190509050421015611e2857606461047cfd5b600860043560e05260c052604060c02054600160605181830380604051901315611e5157600080fd5b8091901215611e5f57600080fd5b90509050610500526308c379a061052052602061054052600f610560527f4761756765206e6f74206164646564000000000000000000000000000000000061058052610560506000610500511215611eb857606461053cfd5b6105c060093360e05260c052604060c02060043560e05260c052604060c0208060c052602060c02054825260018160c052602060c0200154826020015260028160c052602060c02001548260400152505060006106205261030051610600511115611f3e57610600516103005180821015611f3257600080fd5b80820390509050610620525b6105c051610620518082028215828483041417611f5a57600080fd5b8090509050905061064052610660610160516024358082028215828483041417611f8357600080fd5b809050905090506127108080611f9857600080fd5b8204905090508152602435816020015261022051816040015250610220516103005180821015611fc757600080fd5b808203905090506106c052610660516106c0518082028215828483041417611fee57600080fd5b809050905090506106e052600a3360e05260c052604060c0205461070052610700516106805181818301101561202357600080fd5b808201905090506105e0518082101561203b57600080fd5b808203905090506107005261070051600a3360e05260c052604060c020556308c379a0610720526020610740526013610760527f5573656420746f6f206d75636820706f7765720000000000000000000000000061078052610760506000610700511015156120b2576127106107005111156120b5565b60005b6120c057606461073cfd5b6101406107e0525b6107e0515160206107e051016107e0526107e06107e05110156120ea576120c8565b6004356108005261080051600658016107f3565b610860526107c06107e0525b6107e0515260206107e051036107e0526101406107e05110151561212d5761210a565b610860516107c0526001600c60043560e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200154610880526101406108c0525b6108c0515160206108c051016108c0526108c06108c051101561218e5761216c565b610500516108e0526108e05160065801610349565b610940526108a06108c0525b6108c0515260206108c051036108c0526101406108c0511015156121d2576121af565b610940516108a0526001600f6105005160e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200154610960526107c0516106e05181818301101561222157600080fd5b80820190509050610640518082101561223a578061223c565b815b90509050610640518082101561225157600080fd5b80820390509050600c60043560e05260c052604060c0206103005160e05260c052604060c02060c052602060c020556108a0516106e05181818301101561229757600080fd5b8082019050905061064051808210156122b057806122b2565b815b9050905061064051808210156122c757600080fd5b80820390509050600f6105005160e05260c052604060c0206103005160e05260c052604060c02060c052602060c02055610300516106005111156123fd57610880516106605181818301101561231c57600080fd5b808201905090506105c051808210156123355780612337565b815b905090506105c0518082101561234c57600080fd5b808203905090506001600c60043560e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200155610960516106605181818301101561239557600080fd5b808201905090506105c051808210156123ae57806123b0565b815b905090506105c051808210156123c557600080fd5b808203905090506001600f6105005160e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200155612491565b6001600c60043560e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200180546106605181818301101561243c57600080fd5b808201905090508155506001600f6105005160e05260c052604060c0206103005160e05260c052604060c02060c052602060c0200180546106605181818301101561248657600080fd5b808201905090508155505b4261060051111561251657600d60043560e05260c052604060c0206106005160e05260c052604060c02080546105c051808210156124ce57600080fd5b8082039050905081555060106105005160e05260c052604060c0206106005160e05260c052604060c02080546105c0518082101561250b57600080fd5b808203905090508155505b600d60043560e05260c052604060c0206106a05160e05260c052604060c02080546106605181818301101561254a57600080fd5b8082019050905081555060106105005160e05260c052604060c0206106a05160e05260c052604060c02080546106605181818301101561258957600080fd5b80820190509050815550610140610980525b610980515160206109805101610980526109806109805110156125bd5761259b565b6006580161055b565b6109a052610960610980525b61098051526020610980510361098052610140610980511015156125f5576125d2565b6109a05060093360e05260c052604060c02060043560e05260c052604060c02060c052602060c020610660805182558060200151600183015580604001516002830155505042600b3360e05260c052604060c02060043560e05260c052604060c02055426109c052336109e052600435610a0052602435610a20527f45ca9a4c8d0119eb329e580d28fe689e484e1be230da8037ade9547d2d25cc9160806109c0a1005b634e791a3a60005114156127045734156126b257600080fd5b60043560205181106126c357600080fd5b50600c60043560e05260c052604060c020600e60043560e05260c052604060c0205460e05260c052604060c02060c052602060c0205460005260206000f350005b6372fdccfa600051141561278857341561271d57600080fd5b6060516004358060405190131561273357600080fd5b809190121561274157600080fd5b50601460043560e05260c052604060c020600435633b9aca00811061276557600080fd5b601560c052602060c020015460e05260c052604060c0205460005260206000f350005b636977ff9260005114156127bd5734156127a157600080fd5b601260135460e05260c052604060c0205460005260206000f350005b636f214a6a60005114156128495734156127d657600080fd5b606051600435806040519013156127ec57600080fd5b80919012156127fa57600080fd5b50600f60043560e05260c052604060c020600435633b9aca00811061281e57600080fd5b601160c052602060c020015460e05260c052604060c02060c052602060c0205460005260206000f350005b63f851a440600051141561287057341561286257600080fd5b60005460005260206000f350005b6317f7182a600051141561289757341561288957600080fd5b60015460005260206000f350005b63fc0c546a60005114156128be5734156128b057600080fd5b60025460005260206000f350005b63dfe0503160005114156128e55734156128d757600080fd5b60035460005260206000f350005b639fba03a1600051141561290c5734156128fe57600080fd5b60045460005260206000f350005b63e93841d0600051141561293357341561292557600080fd5b60055460005260206000f350005b63d958a8fc6000511415612a1a57341561294c57600080fd5b6060516004358060405190131561296257600080fd5b809190121561297057600080fd5b50600660043560e05260c052604060c0208060c052602060c020610180602082540161012060006003818352015b826101205160200211156129b1576129d3565b61012051850154610120516020028501525b815160010180835281141561299e575b50505050505061018051806101a001818260206001820306601f82010390500336823750506020610160526040610180510160206001820306601f8201039050610160f350005b63b05391876000511415612a5d573415612a3357600080fd5b600435633b9aca008110612a4657600080fd5b600760c052602060c020015460005260206000f350005b630f467f986000511415612b4a573415612a7657600080fd5b6004356020518110612a8757600080fd5b506024356020518110612a9957600080fd5b50610140808080600960043560e05260c052604060c02060243560e05260c052604060c02060c052602060c020548152505060208101905080806001600960043560e05260c052604060c02060243560e05260c052604060c02060c052602060c02001548152505060208101905080806002600960043560e05260c052604060c02060243560e05260c052604060c02060c052602060c02001548152505060609050905060c05260c051610140f350005b63411e74b56000511415612b91573415612b6357600080fd5b6004356020518110612b7457600080fd5b50600a60043560e05260c052604060c0205460005260206000f350005b637e418fa06000511415612bf8573415612baa57600080fd5b6004356020518110612bbb57600080fd5b506024356020518110612bcd57600080fd5b50600b60043560e05260c052604060c02060243560e05260c052604060c0205460005260206000f350005b63edba52736000511415612c9d573415612c1157600080fd5b6004356020518110612c2257600080fd5b50610140808080600c60043560e05260c052604060c02060243560e05260c052604060c02060c052602060c020548152505060208101905080806001600c60043560e05260c052604060c02060243560e05260c052604060c02060c052602060c02001548152505060409050905060c05260c051610140f350005b63a4d7a2506000511415612ce4573415612cb657600080fd5b6004356020518110612cc757600080fd5b50600e60043560e05260c052604060c0205460005260206000f350005b63a9b48c016000511415612d9c573415612cfd57600080fd5b60605160043580604051901315612d1357600080fd5b8091901215612d2157600080fd5b50610140808080600f60043560e05260c052604060c02060243560e05260c052604060c02060c052602060c020548152505060208101905080806001600f60043560e05260c052604060c02060243560e05260c052604060c02060c052602060c02001548152505060409050905060c05260c051610140f350005b635a5491586000511415612ddf573415612db557600080fd5b600435633b9aca008110612dc857600080fd5b601160c052602060c020015460005260206000f350005b631142916b6000511415612e14573415612df857600080fd5b601260043560e05260c052604060c0205460005260206000f350005b63513872bd6000511415612e3b573415612e2d57600080fd5b60135460005260206000f350005b63afd2bb496000511415612ea3573415612e5457600080fd5b60605160043580604051901315612e6a57600080fd5b8091901215612e7857600080fd5b50601460043560e05260c052604060c02060243560e05260c052604060c0205460005260206000f350005b6351ce6b596000511415612ee6573415612ebc57600080fd5b600435633b9aca008110612ecf57600080fd5b601560c052602060c020015460005260206000f350005b5b60006000fd

Verified Source Code Partial Match

Compiler: v0.2.4+commit.7949850
Vyper_contract.vy 596 lines
# @version 0.2.4

"""
@title Gauge Controller
@author Curve Finance
@license MIT
@notice Controls liquidity gauges and the issuance of coins through the gauges
"""

# 7 * 86400 seconds - all future times are rounded by week
WEEK: constant(uint256) = 604800

# Cannot change weight votes more often than once in 10 days
WEIGHT_VOTE_DELAY: constant(uint256) = 10 * 86400


struct Point:
    bias: uint256
    slope: uint256

struct VotedSlope:
    slope: uint256
    power: uint256
    end: uint256


interface VotingEscrow:
    def get_last_user_slope(addr: address) -> int128: view
    def locked__end(addr: address) -> uint256: view


event CommitOwnership:
    admin: address

event ApplyOwnership:
    admin: address

event AddType:
    name: String[64]
    type_id: int128

event NewTypeWeight:
    type_id: int128
    time: uint256
    weight: uint256
    total_weight: uint256

event NewGaugeWeight:
    gauge_address: address
    time: uint256
    weight: uint256
    total_weight: uint256

event VoteForGauge:
    time: uint256
    user: address
    gauge_addr: address
    weight: uint256

event NewGauge:
    addr: address
    gauge_type: int128
    weight: uint256


MULTIPLIER: constant(uint256) = 10 ** 18

admin: public(address)  # Can and will be a smart contract
future_admin: public(address)  # Can and will be a smart contract

token: public(address)  # CRV token
voting_escrow: public(address)  # Voting escrow

# Gauge parameters
# All numbers are "fixed point" on the basis of 1e18
n_gauge_types: public(int128)
n_gauges: public(int128)
gauge_type_names: public(HashMap[int128, String[64]])

# Needed for enumeration
gauges: public(address[1000000000])

# we increment values by 1 prior to storing them here so we can rely on a value
# of zero as meaning the gauge has not been set
gauge_types_: HashMap[address, int128]

vote_user_slopes: public(HashMap[address, HashMap[address, VotedSlope]])  # user -> gauge_addr -> VotedSlope
vote_user_power: public(HashMap[address, uint256])  # Total vote power used by user
last_user_vote: public(HashMap[address, HashMap[address, uint256]])  # Last user vote's timestamp for each gauge address

# Past and scheduled points for gauge weight, sum of weights per type, total weight
# Point is for bias+slope
# changes_* are for changes in slope
# time_* are for the last change timestamp
# timestamps are rounded to whole weeks

points_weight: public(HashMap[address, HashMap[uint256, Point]])  # gauge_addr -> time -> Point
changes_weight: HashMap[address, HashMap[uint256, uint256]]  # gauge_addr -> time -> slope
time_weight: public(HashMap[address, uint256])  # gauge_addr -> last scheduled time (next week)

points_sum: public(HashMap[int128, HashMap[uint256, Point]])  # type_id -> time -> Point
changes_sum: HashMap[int128, HashMap[uint256, uint256]]  # type_id -> time -> slope
time_sum: public(uint256[1000000000])  # type_id -> last scheduled time (next week)

points_total: public(HashMap[uint256, uint256])  # time -> total weight
time_total: public(uint256)  # last scheduled time

points_type_weight: public(HashMap[int128, HashMap[uint256, uint256]])  # type_id -> time -> type weight
time_type_weight: public(uint256[1000000000])  # type_id -> last scheduled time (next week)


@external
def __init__(_token: address, _voting_escrow: address):
    """
    @notice Contract constructor
    @param _token `ERC20CRV` contract address
    @param _voting_escrow `VotingEscrow` contract address
    """
    assert _token != ZERO_ADDRESS
    assert _voting_escrow != ZERO_ADDRESS

    self.admin = msg.sender
    self.token = _token
    self.voting_escrow = _voting_escrow
    self.time_total = block.timestamp / WEEK * WEEK


@external
def commit_transfer_ownership(addr: address):
    """
    @notice Transfer ownership of GaugeController to `addr`
    @param addr Address to have ownership transferred to
    """
    assert msg.sender == self.admin  # dev: admin only
    self.future_admin = addr
    log CommitOwnership(addr)


@external
def apply_transfer_ownership():
    """
    @notice Apply pending ownership transfer
    """
    assert msg.sender == self.admin  # dev: admin only
    _admin: address = self.future_admin
    assert _admin != ZERO_ADDRESS  # dev: admin not set
    self.admin = _admin
    log ApplyOwnership(_admin)


@external
@view
def gauge_types(_addr: address) -> int128:
    """
    @notice Get gauge type for address
    @param _addr Gauge address
    @return Gauge type id
    """
    gauge_type: int128 = self.gauge_types_[_addr]
    assert gauge_type != 0

    return gauge_type - 1


@internal
def _get_type_weight(gauge_type: int128) -> uint256:
    """
    @notice Fill historic type weights week-over-week for missed checkins
            and return the type weight for the future week
    @param gauge_type Gauge type id
    @return Type weight
    """
    t: uint256 = self.time_type_weight[gauge_type]
    if t > 0:
        w: uint256 = self.points_type_weight[gauge_type][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            self.points_type_weight[gauge_type][t] = w
            if t > block.timestamp:
                self.time_type_weight[gauge_type] = t
        return w
    else:
        return 0


@internal
def _get_sum(gauge_type: int128) -> uint256:
    """
    @notice Fill sum of gauge weights for the same type week-over-week for
            missed checkins and return the sum for the future week
    @param gauge_type Gauge type id
    @return Sum of weights
    """
    t: uint256 = self.time_sum[gauge_type]
    if t > 0:
        pt: Point = self.points_sum[gauge_type][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            d_bias: uint256 = pt.slope * WEEK
            if pt.bias > d_bias:
                pt.bias -= d_bias
                d_slope: uint256 = self.changes_sum[gauge_type][t]
                pt.slope -= d_slope
            else:
                pt.bias = 0
                pt.slope = 0
            self.points_sum[gauge_type][t] = pt
            if t > block.timestamp:
                self.time_sum[gauge_type] = t
        return pt.bias
    else:
        return 0


@internal
def _get_total() -> uint256:
    """
    @notice Fill historic total weights week-over-week for missed checkins
            and return the total for the future week
    @return Total weight
    """
    t: uint256 = self.time_total
    _n_gauge_types: int128 = self.n_gauge_types
    if t > block.timestamp:
        # If we have already checkpointed - still need to change the value
        t -= WEEK
    pt: uint256 = self.points_total[t]

    for gauge_type in range(100):
        if gauge_type == _n_gauge_types:
            break
        self._get_sum(gauge_type)
        self._get_type_weight(gauge_type)

    for i in range(500):
        if t > block.timestamp:
            break
        t += WEEK
        pt = 0
        # Scales as n_types * n_unchecked_weeks (hopefully 1 at most)
        for gauge_type in range(100):
            if gauge_type == _n_gauge_types:
                break
            type_sum: uint256 = self.points_sum[gauge_type][t].bias
            type_weight: uint256 = self.points_type_weight[gauge_type][t]
            pt += type_sum * type_weight
        self.points_total[t] = pt

        if t > block.timestamp:
            self.time_total = t
    return pt


@internal
def _get_weight(gauge_addr: address) -> uint256:
    """
    @notice Fill historic gauge weights week-over-week for missed checkins
            and return the total for the future week
    @param gauge_addr Address of the gauge
    @return Gauge weight
    """
    t: uint256 = self.time_weight[gauge_addr]
    if t > 0:
        pt: Point = self.points_weight[gauge_addr][t]
        for i in range(500):
            if t > block.timestamp:
                break
            t += WEEK
            d_bias: uint256 = pt.slope * WEEK
            if pt.bias > d_bias:
                pt.bias -= d_bias
                d_slope: uint256 = self.changes_weight[gauge_addr][t]
                pt.slope -= d_slope
            else:
                pt.bias = 0
                pt.slope = 0
            self.points_weight[gauge_addr][t] = pt
            if t > block.timestamp:
                self.time_weight[gauge_addr] = t
        return pt.bias
    else:
        return 0


@external
def add_gauge(addr: address, gauge_type: int128, weight: uint256 = 0):
    """
    @notice Add gauge `addr` of type `gauge_type` with weight `weight`
    @param addr Gauge address
    @param gauge_type Gauge type
    @param weight Gauge weight
    """
    assert msg.sender == self.admin
    assert (gauge_type >= 0) and (gauge_type < self.n_gauge_types)
    assert self.gauge_types_[addr] == 0  # dev: cannot add the same gauge twice

    n: int128 = self.n_gauges
    self.n_gauges = n + 1
    self.gauges[n] = addr

    self.gauge_types_[addr] = gauge_type + 1
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    if weight > 0:
        _type_weight: uint256 = self._get_type_weight(gauge_type)
        _old_sum: uint256 = self._get_sum(gauge_type)
        _old_total: uint256 = self._get_total()

        self.points_sum[gauge_type][next_time].bias = weight + _old_sum
        self.time_sum[gauge_type] = next_time
        self.points_total[next_time] = _old_total + _type_weight * weight
        self.time_total = next_time

        self.points_weight[addr][next_time].bias = weight

    if self.time_sum[gauge_type] == 0:
        self.time_sum[gauge_type] = next_time
    self.time_weight[addr] = next_time

    log NewGauge(addr, gauge_type, weight)


@external
def checkpoint():
    """
    @notice Checkpoint to fill data common for all gauges
    """
    self._get_total()


@external
def checkpoint_gauge(addr: address):
    """
    @notice Checkpoint to fill data for both a specific gauge and common for all gauges
    @param addr Gauge address
    """
    self._get_weight(addr)
    self._get_total()


@internal
@view
def _gauge_relative_weight(addr: address, time: uint256) -> uint256:
    """
    @notice Get Gauge relative weight (not more than 1.0) normalized to 1e18
            (e.g. 1.0 == 1e18). Inflation which will be received by it is
            inflation_rate * relative_weight / 1e18
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    t: uint256 = time / WEEK * WEEK
    _total_weight: uint256 = self.points_total[t]

    if _total_weight > 0:
        gauge_type: int128 = self.gauge_types_[addr] - 1
        _type_weight: uint256 = self.points_type_weight[gauge_type][t]
        _gauge_weight: uint256 = self.points_weight[addr][t].bias
        return MULTIPLIER * _type_weight * _gauge_weight / _total_weight

    else:
        return 0


@external
@view
def gauge_relative_weight(addr: address, time: uint256 = block.timestamp) -> uint256:
    """
    @notice Get Gauge relative weight (not more than 1.0) normalized to 1e18
            (e.g. 1.0 == 1e18). Inflation which will be received by it is
            inflation_rate * relative_weight / 1e18
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    return self._gauge_relative_weight(addr, time)


@external
def gauge_relative_weight_write(addr: address, time: uint256 = block.timestamp) -> uint256:
    """
    @notice Get gauge weight normalized to 1e18 and also fill all the unfilled
            values for type and gauge records
    @dev Any address can call, however nothing is recorded if the values are filled already
    @param addr Gauge address
    @param time Relative weight at the specified timestamp in the past or present
    @return Value of relative weight normalized to 1e18
    """
    self._get_weight(addr)
    self._get_total()  # Also calculates get_sum
    return self._gauge_relative_weight(addr, time)




@internal
def _change_type_weight(type_id: int128, weight: uint256):
    """
    @notice Change type weight
    @param type_id Type id
    @param weight New type weight
    """
    old_weight: uint256 = self._get_type_weight(type_id)
    old_sum: uint256 = self._get_sum(type_id)
    _total_weight: uint256 = self._get_total()
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    _total_weight = _total_weight + old_sum * weight - old_sum * old_weight
    self.points_total[next_time] = _total_weight
    self.points_type_weight[type_id][next_time] = weight
    self.time_total = next_time
    self.time_type_weight[type_id] = next_time

    log NewTypeWeight(type_id, next_time, weight, _total_weight)


@external
def add_type(_name: String[64], weight: uint256 = 0):
    """
    @notice Add gauge type with name `_name` and weight `weight`
    @param _name Name of gauge type
    @param weight Weight of gauge type
    """
    assert msg.sender == self.admin
    type_id: int128 = self.n_gauge_types
    self.gauge_type_names[type_id] = _name
    self.n_gauge_types = type_id + 1
    if weight != 0:
        self._change_type_weight(type_id, weight)
        log AddType(_name, type_id)


@external
def change_type_weight(type_id: int128, weight: uint256):
    """
    @notice Change gauge type `type_id` weight to `weight`
    @param type_id Gauge type id
    @param weight New Gauge weight
    """
    assert msg.sender == self.admin
    self._change_type_weight(type_id, weight)


@internal
def _change_gauge_weight(addr: address, weight: uint256):
    # Change gauge weight
    # Only needed when testing in reality
    gauge_type: int128 = self.gauge_types_[addr] - 1
    old_gauge_weight: uint256 = self._get_weight(addr)
    type_weight: uint256 = self._get_type_weight(gauge_type)
    old_sum: uint256 = self._get_sum(gauge_type)
    _total_weight: uint256 = self._get_total()
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK

    self.points_weight[addr][next_time].bias = weight
    self.time_weight[addr] = next_time

    new_sum: uint256 = old_sum + weight - old_gauge_weight
    self.points_sum[gauge_type][next_time].bias = new_sum
    self.time_sum[gauge_type] = next_time

    _total_weight = _total_weight + new_sum * type_weight - old_sum * type_weight
    self.points_total[next_time] = _total_weight
    self.time_total = next_time

    log NewGaugeWeight(addr, block.timestamp, weight, _total_weight)


@external
def change_gauge_weight(addr: address, weight: uint256):
    """
    @notice Change weight of gauge `addr` to `weight`
    @param addr `GaugeController` contract address
    @param weight New Gauge weight
    """
    assert msg.sender == self.admin
    self._change_gauge_weight(addr, weight)


@external
def vote_for_gauge_weights(_gauge_addr: address, _user_weight: uint256):
    """
    @notice Allocate voting power for changing pool weights
    @param _gauge_addr Gauge which `msg.sender` votes for
    @param _user_weight Weight for a gauge in bps (units of 0.01%). Minimal is 0.01%. Ignored if 0
    """
    escrow: address = self.voting_escrow
    slope: uint256 = convert(VotingEscrow(escrow).get_last_user_slope(msg.sender), uint256)
    lock_end: uint256 = VotingEscrow(escrow).locked__end(msg.sender)
    _n_gauges: int128 = self.n_gauges
    next_time: uint256 = (block.timestamp + WEEK) / WEEK * WEEK
    assert lock_end > next_time, "Your token lock expires too soon"
    assert (_user_weight >= 0) and (_user_weight <= 10000), "You used all your voting power"
    assert block.timestamp >= self.last_user_vote[msg.sender][_gauge_addr] + WEIGHT_VOTE_DELAY, "Cannot vote so often"

    gauge_type: int128 = self.gauge_types_[_gauge_addr] - 1
    assert gauge_type >= 0, "Gauge not added"
    # Prepare slopes and biases in memory
    old_slope: VotedSlope = self.vote_user_slopes[msg.sender][_gauge_addr]
    old_dt: uint256 = 0
    if old_slope.end > next_time:
        old_dt = old_slope.end - next_time
    old_bias: uint256 = old_slope.slope * old_dt
    new_slope: VotedSlope = VotedSlope({
        slope: slope * _user_weight / 10000,
        end: lock_end,
        power: _user_weight
    })
    new_dt: uint256 = lock_end - next_time  # dev: raises when expired
    new_bias: uint256 = new_slope.slope * new_dt

    # Check and update powers (weights) used
    power_used: uint256 = self.vote_user_power[msg.sender]
    power_used = power_used + new_slope.power - old_slope.power
    self.vote_user_power[msg.sender] = power_used
    assert (power_used >= 0) and (power_used <= 10000), 'Used too much power'

    ## Remove old and schedule new slope changes
    # Remove slope changes for old slopes
    # Schedule recording of initial slope for next_time
    old_weight_bias: uint256 = self._get_weight(_gauge_addr)
    old_weight_slope: uint256 = self.points_weight[_gauge_addr][next_time].slope
    old_sum_bias: uint256 = self._get_sum(gauge_type)
    old_sum_slope: uint256 = self.points_sum[gauge_type][next_time].slope

    self.points_weight[_gauge_addr][next_time].bias = max(old_weight_bias + new_bias, old_bias) - old_bias
    self.points_sum[gauge_type][next_time].bias = max(old_sum_bias + new_bias, old_bias) - old_bias
    if old_slope.end > next_time:
        self.points_weight[_gauge_addr][next_time].slope = max(old_weight_slope + new_slope.slope, old_slope.slope) - old_slope.slope
        self.points_sum[gauge_type][next_time].slope = max(old_sum_slope + new_slope.slope, old_slope.slope) - old_slope.slope
    else:
        self.points_weight[_gauge_addr][next_time].slope += new_slope.slope
        self.points_sum[gauge_type][next_time].slope += new_slope.slope
    if old_slope.end > block.timestamp:
        # Cancel old slope changes if they still didn't happen
        self.changes_weight[_gauge_addr][old_slope.end] -= old_slope.slope
        self.changes_sum[gauge_type][old_slope.end] -= old_slope.slope
    # Add slope changes for new slopes
    self.changes_weight[_gauge_addr][new_slope.end] += new_slope.slope
    self.changes_sum[gauge_type][new_slope.end] += new_slope.slope

    self._get_total()

    self.vote_user_slopes[msg.sender][_gauge_addr] = new_slope

    # Record last action time
    self.last_user_vote[msg.sender][_gauge_addr] = block.timestamp

    log VoteForGauge(block.timestamp, msg.sender, _gauge_addr, _user_weight)


@external
@view
def get_gauge_weight(addr: address) -> uint256:
    """
    @notice Get current gauge weight
    @param addr Gauge address
    @return Gauge weight
    """
    return self.points_weight[addr][self.time_weight[addr]].bias


@external
@view
def get_type_weight(type_id: int128) -> uint256:
    """
    @notice Get current type weight
    @param type_id Type id
    @return Type weight
    """
    return self.points_type_weight[type_id][self.time_type_weight[type_id]]


@external
@view
def get_total_weight() -> uint256:
    """
    @notice Get current total (type-weighted) weight
    @return Total weight
    """
    return self.points_total[self.time_total]


@external
@view
def get_weights_sum_per_type(type_id: int128) -> uint256:
    """
    @notice Get sum of gauge weights per type
    @param type_id Type id
    @return Sum of gauge weights
    """
    return self.points_sum[type_id][self.time_sum[type_id]].bias

Read Contract

admin 0xf851a440 → address
future_admin 0x17f7182a → address
gauge_relative_weight 0x6207d866 → uint256
gauge_relative_weight 0xd3078c94 → uint256
gauge_type_names 0xd958a8fc → string
gauge_types 0x3f9095b7 → int128
gauges 0xb0539187 → address
get_gauge_weight 0x4e791a3a → uint256
get_total_weight 0x6977ff92 → uint256
get_type_weight 0x72fdccfa → uint256
get_weights_sum_per_type 0x6f214a6a → uint256
last_user_vote 0x7e418fa0 → uint256
n_gauge_types 0x9fba03a1 → int128
n_gauges 0xe93841d0 → int128
points_sum 0xa9b48c01 → uint256, uint256
points_total 0x1142916b → uint256
points_type_weight 0xafd2bb49 → uint256
points_weight 0xedba5273 → uint256, uint256
time_sum 0x5a549158 → uint256
time_total 0x513872bd → uint256
time_type_weight 0x51ce6b59 → uint256
time_weight 0xa4d7a250 → uint256
token 0xfc0c546a → address
vote_user_power 0x411e74b5 → uint256
vote_user_slopes 0x0f467f98 → uint256, uint256, uint256
voting_escrow 0xdfe05031 → address

Write Contract 13 functions

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

add_gauge 0x3a04f900
address addr
int128 gauge_type
add_gauge 0x18dfe921
address addr
int128 gauge_type
uint256 weight
add_type 0x26e56d5e
string _name
add_type 0x92d0d232
string _name
uint256 weight
apply_transfer_ownership 0x6a1c05ae
No parameters
change_gauge_weight 0xd4d2646e
address addr
uint256 weight
change_type_weight 0xdb1ca260
int128 type_id
uint256 weight
checkpoint 0xc2c4c5c1
No parameters
checkpoint_gauge 0x615e5237
address addr
commit_transfer_ownership 0x6b441a40
address addr
gauge_relative_weight_write 0x95cfcec3
address addr
returns: uint256
gauge_relative_weight_write 0x6472eee1
address addr
uint256 time
returns: uint256
vote_for_gauge_weights 0xd7136328
address _gauge_addr
uint256 _user_weight

Recent Transactions

This address has 1 on-chain transactions, but only 1.7% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →