ETH Price: $3,806.67 (-2.30%)
Gas: 10 Gwei

Transaction Decoder

Block:
9530309 at Feb-22-2020 02:08:42 AM +UTC
Transaction Fee:
0.0028250712 ETH $10.75
Gas Used:
2,354,226 Gas / 1.2 Gwei

Emitted Events:

110 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94( 0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94, 0x000000000000000000000000ea41fd17121aac5c79717c8528ce66a8e143e0c8 )
111 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada4( 0x1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada4, 0x000000000000000000000000eb465949f684645c4b03b270e9ff7cb5194dea8e )
112 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94( 0xce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed94, 0x000000000000000000000000eb465949f684645c4b03b270e9ff7cb5194dea8e )
113 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 )
114 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x0000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef )
115 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x000000000000000000000000ec67005c4e498ec7f55e092bd1d35cbc47c91892 )
116 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x0000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2 )
117 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x00000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359 )
118 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599 )
119 0x37f2cab8d23910824c01c2bb820b8b2007a49901.0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e( 0x7c823d8b1bff477ca803a3ca99dc2f593f14a16d03929955df3add807624cf1e, 0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 )
120 0xea41fd17121aac5c79717c8528ce66a8e143e0c8.0x270abff66cb02e1d952a78cf8c38badf1698a0aa50b472249163cb5ee9a4f382( 0x270abff66cb02e1d952a78cf8c38badf1698a0aa50b472249163cb5ee9a4f382, 0x000000000000000000000000eb465949f684645c4b03b270e9ff7cb5194dea8e, 0x00000000000000000000000037f2cab8d23910824c01c2bb820b8b2007a49901, 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 0000000000000000000000000000000000000000000000000000000000000060, 0000000000000000000000000000000000000000000000000000000000000007, 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 0000000000000000000000000d8775f648430679a709e98d2b0cb6250d2887ef, 000000000000000000000000ec67005c4e498ec7f55e092bd1d35cbc47c91892, 0000000000000000000000009f8f72aa9304c8b593d555f12ef6589cc3a579a2, 00000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359, 0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599, 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 )
121 Engine.AmguPaid( amount=2217540 )

Account State Difference:

  Address   Before After State Difference Code
0x01Bde0b0...ddb057EFB
0x37F2cAb8...007a49901
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 2377799728378227749670927840436106232141863957642633455595431051175569646280004694303875318072911597524045850774297348765871686369284368007267231248457738220400878328612201170936403621790119408296313702285067330100703474402712096189891643749871501385747400416171067778307144322493027314167564736161703435570529094670914253030474064798697755820488159867592863684218813096466257345333277069892637590462720098385915493114061672258058072355876098284205849899863111676215732411140424924882626897290127958275404022498072257798285828395993748940008729028246659423539907401538366217860138888274195623115160654144101188503618276433595405479690921507076304074324321297507324571519015266698632851764746796862114265047510693469679289015225277835922932380352367187014810585389574943311763309003440250278005704036086975018158969909643495247915410242372383624123145928877298926408928331761769253663626436842604128180474405044424058415787322427707211805909190742647902668554627389049871852024531786312830112683660481868780983695313674788815658097563090893644432638757822480243106217942210276394169018935158874721205654056003825480045059856511291730639332438389581470253543808115147828420690168699761787243744174716886054638755631291836105056515612574851320622459760190623329855543700103751921852877826713965418187716284032288755291933433551917592670191685811391642004707092361009697399958162756793581957124966827439779543317254447167162820620733032154804068208542732453217793471820909611561024060935402538286543177027099275028727207781712432937952686205457835450593890624617779395116610373860432857715188764300931232705035785844864117282508357329279524764529101332027630684087776426198756090758689285371792235548673143305797233471199238425467478941427359975536770719660762752397560855607191806028158733383167759325277220617616334447009823914043265865916542730469105500579195731564362665856552221438781686689205361178209568491076527426219358858411911572486362809132434306080815756272778640637664901716057838931251099044490869366819507243421101521799491627932332160669113133150895024719474687662364117449556775516682094210761830325926904283515887479134811227051890571307012074239932086719103263096019607560594677921509267551107776664618330770106878935857092685707765772866263774230194645883569009714123829188515446981181173803521850706060742133946744569411300403727670974494165225585922718986790599557534711691993260909654711277438354627693182189859412280799869363439283235756600811660262191323123110838191904210958738123384847568661063235891757039994633791718033237725350283175903340878110423768655838241400095954747442987604007978267058806839373420418299920028547936994248887272526674627035293750037561478090359801703697044805970206659630675741588003937155231041011276144918106215757678731742538720971132242924353863681362805973192471860379949655011885115095673055615287870855948068617501345577775133226738898199516832334397486769978853403256776326222800161153977638126349323084226208955828442635246588627696097223218521843254298803955506658841092323270215274841870722292179915341900064452805631574102297604448515037586836506159133181722338422855598498557985213619752860110570496162926478851643894416631304138310398448766806127257915741042803648967301517104388855312780355374884664644159183314437578155048364386851773836259313790225617229235000875138852685739497720586385157366849189402535546719198608100768174397148659919515666847755361761665391224682770652935952882005476551032672250482486354948468931922085038756913384172907513867340215677320324854188788673586943526958612553499822579687029612774315776489818699088749194849440495774498395515199743233347777771710549517696623779714101938961165007056633643485248483014651482565249551950163858573658094652996292644007618593570053779311780373723430287724767544740603562245338911397044092853137231666526163691638539216409946123021914275606612315917923835264188025935179727449817247831276815366672582650232380561933109303791664322983249798446807440243433583747359409669240508236215099191272984040291116602831281406777234748042890369631278784270427363896841245308152508584796157019095029306269599754467779528102479131581441915410710305773280055934114995185278192218759723003414669117408256411689431472569148770823615739658142323852771534117178124029436947827338260690528496846920725543295760751320628557953927048631718059646834714325288473390843688635796012214262916313778440594737407892532002166049094236884114605465650142244057856130070297087495613072650276587659413488801962828182770258053489369585082385380699616755399473858834358813416188970560392361763802478889160942731578151823040124586659278908457957906621536200765271770529488142476296019994089267866781615092439915441950176041508507959195747866662209145259038608694595914420833865012412641137030107387681389444806649703476895108271507418301014723725027844504468593591311260194065643156585622227776707573966107318465463717905098176946017079522493832097695587901318672718006589562227696544080311043896314323131286497323864807654892787982731377091576591844901327563839735774452213986686070686953050597976475144818982181493119650664724335828372115652851115826610304959889375264005145573857289121773734264476617590616220158639584123503593592597821644549113700224251959318182008991325311044958451555099750525196793248471363311929503041664571919370693356364069385164785575090503825289727030244172725750137877575803376276826358612244197861221301024005017514653302471561054236719981266999167067010652582027839357483303068223809987794461611153103600743860518538699939636795417508745777890105219711881517701513700435355286231182041504662409939743194241439233991181249606951979866135656438014566360739803844673422714465056789693165414231341538890987410537816903351991850844128382215189529322703703399449945016445794018196198939458956031647032893185945169584056797916381573678043237010772455806216967476874106565099705527500198886612904949227759173976912186645014212388044991968212590576357177669931840615172135439551296251000501480521127666116193521681034151248437516366759950287467041160480533038493993886144728374219733640570369328282009451386420462020514387201106401378194816355384527147863242379920820463594989301103904900355709062081045816634723355763004391943312538797962796086636276329286906768240425771622154671707574058938350869015252139307407993925025503251772528323241569773091055107006805503170761447439239938019154466066873888367612699131753411612029315861639488235186580038890672968396513924935780089149562515220708762143706362902138211976304213609758491212853025743587063813280227912000187700626151809198431612435904818118219622399568585190959593616218361830205992634663019053874387149805980468243138619161961499560368634293727610423734064303873957175153466994989790378499581280728277596293888398048580807780741126736364411042559817020782544857977624049693376556994844062927575045099788901398184660743463680366864373403015861243428110575568149145113935400987453809050412312477324036969373666111200548857435004524352210199517618504641612144802054236252568568252114784943848356801649572193071024448404807725257913030066503565434487983148560054976906591250441019717750146240238460903801513663144311461038158396143921151770443356730777968076391913893487282574730400439951797309621099064390405371952073722375246681713668818003479752696940260384712215384816797383373867645408377712404457896151415335202644770820315101050280898230436299897311864737989327542086746293623621392911437732967462961815870623922878743111844194586424739892391209495001973137252880974848931688963360961504931521752640552619384868047426047898565124304415631004603589731505894514583899235470205604195602655389291060105379394636555629871808177916853579796843327969121065098262210467918918908180197421184954158256295246732674901958284411787592808690749101010631244101281735750004083025441093574236403068261608959478682143445756063227375388339687453862757612739747288165299829798766002022041258075644448211609491373288332783470895154883255914283690341502662099756451207272650726614589573167280085081485485457932802993551704206401063936060454594483371498815068756373826168236188186346259402530505259588731403949810370913759069048149317781380198307445016553848667582955394252198026787937965928300730599473184100325876373271416022508709298406297653867514163686659858628891985216700989579986784886975399543410277742512901806338265322467684348765115363852398702816606663229750051044138167167972089177411447080416060598701074981126192028982376643516095508535417921903764172289176493969197941201871612167569022724566968675205521293858251617873364755617708639924824043120190460654573082058797372535121826866630098923344130266901882393994938927635524103360752670199156568210684482092975296281936945545625477164890324739243075834386214196217130885041046529219894172448030653630853675948129769621046760644526598566182446093000901205958705625047386849892469117575927930995242403910967309775844462377668751729836990622257678476205391277404256354307230321153456606435786049830185090132938014793885795088282620476503620744183417139955318541103025071336840528756334584527178601341858886835593615467317430403468267805543788797471041462872567220873682555096073210398697304323710056120629364190324686421587216586136576712542713269127057932806121315966811007835951870757947848655197004320778320580802246637737534405196304359726281220443629616523412014905761520921120445997130016963796868028025213492253553774948088322580645119424786846238869969343254199493560414739234068123769967244954730050581614218220749864462941789761713738456808319208393341526785778952047774765784836934784120666585164068192585806177146247893845446679611637325492560372836618532398169198601348142942208736464316056935969601562260828550795704339198179236811928228903117408187030824731902034278428676748105465502641184231739801325764328290377340616093200903923070080598015891153631230655778198150739280664619446077158396763521939783589529169482378255734487643207429086102213474703448105095317087969612717841526025982876045501550933135232883401931237511312440563562705850810174527956885804689373387859373972826031504252797106268782216815295874660220749805385732370627054072593441568134379726474232037788332117553757193211298433739260458372310698085011847149589255084336494611285804278147112633348263131974463313972004574273063495897363074611203462503456706139492936244808698057676518367878952974863428677420681223232398745636968944449416719996508919355123461178559065131222932009534120258571036298931233153132210452170293374783946364510997059315486365210877155318064743418704479297688243706596990917833834783914287862190361651022845946039013250198700416480825953078440689206295618998410815250415410966152410136407544206474973156029808653637391169240251064083046267414687725366099740722295369753781469987581814872136387281364764072837026854140144708987394755588203324026756329581510236222644238044779971545906376926983841458906472688776891013513939606462442345711563066438874072522580570709213835856397111317810543165546290388594101507018008779218084730500301867882793800294305060926646156475915889029153949128318089759555119670055022358285303224352217676719584113669838389569890834838533332800052484601926203845582320285210212966460581802130435391001498958817120195451056907590072387250755573449597916720720057951116854083527437538575604088566216260970511050804672326874607501911139768361437257701501943028481894228677351549635741904705730253174116063418875741570486398357060165567519196476312556909236871550798582371836722418306963870976020914590924114300604962638722627880097253747242927834608452963502781627606837816311601516286171203376046562327316917217735494907150958657326379826364131547518965130623461763556433839253378640072558160299732627635180119528066066377039809393400307053992686561605390570538823299415178553398595264333013350275888786103049533226301152017990180495858347015734693023389168011940186592371704889151419551163452191338944579050157594290283716195396598674541030001636675872672018535687881948849807646050390241399193385547495524641545935019871730639805006106009975637671437325410655430705611267238865167115615329270880424426914995544500842524016875254586000527342912679526842996048941696394877078089417992901718615061265200434209567244638934350417063170561307106904062275163661891114004666092727823323817510556572076297474009146831989244646901450960750783806386271610017206372520252865803391459069363601622356401836569587009328312800412862552160420698850194689526915568895095384901098858823252536742741032057779542351565929409769395451505388088023664887101090328377532815386003103933868872425441599220859371077557275050159557997634072193468288074954413899501331237077899455414559045148571755649181900664896596494785555725022421910471782536112296953277310023366569687432114755028616910201688064831235075312534122935350447529317133466229345739356718141998462697077754222551262430026977791894757435626173190417996880191958541479326589755713560431895192916268227220876950414800436650526026074994007996890792083739451032597312981567703444291791979176985286669581286711462411357803995202796816701680240609207596018725615427045161364997202075638086796766855552897710643341577794347623405527042943115165673020652440634919575780477972408265786322959124473631505431150478800211689701246198705554766949161988575776371646222342733752096836750336514958287507543111064224171043271118462440311545578049893348327110142890310988485998929983483509273143127161485091427488338008870130566717959835343041597526939929984512123805208756120233449417085061447636666688603172755366239227300174483498098178458204982595881017856368615261525269108915862460270621230166408627993914115916120197294934127310507653569263890606771534067371883908423163485609427002353741814446155326769268995154740076524475816969938304141107992010328386514508917159273023813511245576899818228192837500855425436933572395269245090964058334202837952783172095231845610153770442075263005659477053027473704053443954535142120214714654874341292690247703033617068609253072505904521613882938130553938607799367546738026789836038933754259785384325309311841804780760080967120033908989617278934489993066247994040965391455715711632005198209191295368780945875717646264305644477131748900991000196298249496649876154006622425305638055749702872496930529475327813510187875042584410817392732670701295540982017858611127293485700376345940037101532640370394752147089115506308755933347829512140126199133343143547095295085279673408154101379359992085381830158828872503768875967356146741722666234447630753390846439094192552623348964926378217480549588008762753152841341843732187596147324725985562438640281789365527808329877013424791467715468500624066624853858529614036855445524563656165534107741596825938891651494564336686736176143859535703919499191476789295236264064409866117085137200632164305784209310398344277479594809674016745335082840638932077377787331551113385252897325629573339705954168526748431999521433292773784651069349065819102434408183258265287286119919883910551565248500040350244312105598950216914051523693068186449804651357828721382794340387800084830421094415578182132769140989072693976406481580433018220485540747427929923254203811178568577849058061151200205486906387773023639832982500893931568312996990986121424533585486957150035423142873731262575577835228520215904352529160342332947436352573765962158021228887347116376056138294714396117549000478946103250202672120958138254446707596049086795253794124355153736136655449098390279103926957583029333719431439076070738556051364052163933009717413004532036116700855372309748731934946293088069862815406675962814430223441338911732796640032240718185083058002203189017652072024823992647597816614161618970563774946527577399840426905658546783327604193674934241490816619366037820205464497892628183879307042310355794416936014146851803659529879134039811490176352991905359139632539874876393264842763209282780932411336561434908680683633637270852720927645750027280424066603901180594550748023679625807390577277879927697865767682077867025339666872576754851374702440954833758809746403821950751082403757463680558085919161114712484256953031699150786247689064735161473893417330264749232051340467644449988163594391148921231539473010304060648498071364322964667141023071265314772226119759669781206902090559106185167147186320347255386589547453487640682836757677442507122972889059374926279386966686054539965852341912478627073133026648155222343888380606771571002201236580048079470847020316240933773291188093078733830010426495374986255719450053707683360019046264120936996861512704718132019300647193861507031846794503117683094998870349306736709513054763945009025502103101826342883440465124958312270458076094865409473300983169150227248239246990026820536491710313085246608241479603304749886679298459323787098689339763847530270168035433442321189563120502281300214060741582348914493183389941787371024436290385954371743606693178542179182089740999678257111520752241891906601101079212760711308824238237878846919537251896126511577026913502023438869553349053586057922198167796934675245294053504401332548850910669314912316741966089920404597377988392796742514948138136882893096517595565711121747300842360527542944915439790892774000670678134410701707217380102714244509426288009790649605222727702251520165699836135081915879751664920375712309731112355452733126783851984618139865274252509069079463888128141207813384973721536497750852659874724640911925553833386996987902364528950075271845301738294736897256186987947257944487603861301422717204154767349494430485766007657863684260118265239232669941107524689345001376487623930909583279061412788162933880577149024239039605057195616979001709798102990202660599283335329820809133324721261508199974702068516912079172939467163848382861263451071760683616988003050711993183912014143213334130069954600466591922264033066633425066645820264176103923920825219151054933088421293080886629418960992325185476303540286618868479506502903115875597563220682731392941924336397475013119129732062897449766602695333494485616425493117094294026155664295030251237115416958902592265186641682454162140107524132694400533499609182644339065420617716116073044405736712416602113062218038029282444101370344348129559803058111339435130177522674100308143257476127838547336600640411260005441781404589908465233199146591385118746030849580112959015295660466401879726356371822764312180803631432924265628877567885886398648829917106378628080025327800191771774973674637789613305963677048870425349616358903254702003090075149295305634586288945620834296407269914519812268091172653037425611485715610892783321947562173544217257012576234301570610809324584403140770926726730738876901639119309832211633437867531175038272675131163455912288395049001238193109713055537006797173369210752715751677398708897513939687185283625257239767911809025538053266936071260129897108531446359590025986240221248295395619049895537203176482893406425826113636256383388631101774103294138852307530822389020561574087929888175548892780487796262564747254689923683865022474635670968776615161420102235693503593602084809390853522789653327019008743381360948457717509122963740108321263591476737219141833291795781161914535996160062991770958849749804362339996526916222877128519361901972593555366083536680497414304979572658994028188184591566128700941395818667548335214392377336162961286799523229208113292341168068666303316009
0x7CaEc966...4472352f5 0.775604563335820947 Eth0.797616094662805361 Eth0.022011531326984414
0xeA41FD17...8e143e0c8
(Ethermine)
1,034.770002219966134736 Eth1,034.772827291166134736 Eth0.0028250712
0xEF4b55e0...ec600c273
0.795537698 Eth
Nonce: 1
0.770701095473015586 Eth
Nonce: 2
0.024836602526984414

Execution Trace

ETH 0.025729589904153386 0x01bde0b02740d6311e4a87ca112deeeddb057efb.CALL( )
  • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
  • 0xea41fd17121aac5c79717c8528ce66a8e143e0c8.f04929e5( )
    • 0x37f2cab8d23910824c01c2bb820b8b2007a49901.60806040( )
    • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
    • Engine.CALL( )
    • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
    • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
    • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
    • 0x05a985173c1d0ed9f401f34dcbec226dde61fd93.7e3bfc2f( )
      • 0x1bfd21f7db126a5966d2c09492676807a68859ba.1f8d99a9( )
      • 0x1bfd21f7db126a5966d2c09492676807a68859ba.1f8d99a9( )
      • WETH9.CALL( )
      • Melon.CALL( )
      • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
      • ETH 0.022011531326984414 Engine.CALL( )
        • 0x1bfd21f7db126a5966d2c09492676807a68859ba.9b8ce78f( )
        • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
        • 0x1bfd21f7db126a5966d2c09492676807a68859ba.CALL( )
        • 0x05a985173c1d0ed9f401f34dcbec226dde61fd93.41976e09( )
          • 0x1bfd21f7db126a5966d2c09492676807a68859ba.1f8d99a9( )
          • 0x1bfd21f7db126a5966d2c09492676807a68859ba.1f8d99a9( )
          • WETH9.CALL( )
          • ETH 0.003718058577168972 0xef4b55e0dee0d3fbae4cd3830bfe4eaec600c273.CALL( )
            File 1 of 3: Engine
            pragma solidity ^0.4.25;
            
            /**
             * @title SafeMath
             * @dev Math operations with safety checks that revert on error
             */
            library SafeMath {
            
              /**
              * @dev Multiplies two numbers, reverts on overflow.
              */
              function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
                // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                // benefit is lost if 'b' is also tested.
                // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
                if (_a == 0) {
                  return 0;
                }
            
                uint256 c = _a * _b;
                require(c / _a == _b);
            
                return c;
              }
            
              /**
              * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
              */
              function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
                require(_b > 0); // Solidity only automatically asserts when dividing by 0
                uint256 c = _a / _b;
                // assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
            
                return c;
              }
            
              /**
              * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
              */
              function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
                require(_b <= _a);
                uint256 c = _a - _b;
            
                return c;
              }
            
              /**
              * @dev Adds two numbers, reverts on overflow.
              */
              function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
                uint256 c = _a + _b;
                require(c >= _a);
            
                return c;
              }
            
              /**
              * @dev Divides two numbers and returns the remainder (unsigned integer modulo),
              * reverts when dividing by zero.
              */
              function mod(uint256 a, uint256 b) internal pure returns (uint256) {
                require(b != 0);
                return a % b;
              }
            }
            
            contract DSMath {
                function add(uint x, uint y) internal pure returns (uint z) {
                    require((z = x + y) >= x, "ds-math-add-overflow");
                }
                function sub(uint x, uint y) internal pure returns (uint z) {
                    require((z = x - y) <= x, "ds-math-sub-underflow");
                }
                function mul(uint x, uint y) internal pure returns (uint z) {
                    require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
                }
            
                function min(uint x, uint y) internal pure returns (uint z) {
                    return x <= y ? x : y;
                }
                function max(uint x, uint y) internal pure returns (uint z) {
                    return x >= y ? x : y;
                }
                function imin(int x, int y) internal pure returns (int z) {
                    return x <= y ? x : y;
                }
                function imax(int x, int y) internal pure returns (int z) {
                    return x >= y ? x : y;
                }
            
                uint constant WAD = 10 ** 18;
                uint constant RAY = 10 ** 27;
            
                function wmul(uint x, uint y) internal pure returns (uint z) {
                    z = add(mul(x, y), WAD / 2) / WAD;
                }
                function rmul(uint x, uint y) internal pure returns (uint z) {
                    z = add(mul(x, y), RAY / 2) / RAY;
                }
                function wdiv(uint x, uint y) internal pure returns (uint z) {
                    z = add(mul(x, WAD), y / 2) / y;
                }
                function rdiv(uint x, uint y) internal pure returns (uint z) {
                    z = add(mul(x, RAY), y / 2) / y;
                }
            
                // This famous algorithm is called "exponentiation by squaring"
                // and calculates x^n with x as fixed-point and n as regular unsigned.
                //
                // It's O(log n), instead of O(n) for naive repeated multiplication.
                //
                // These facts are why it works:
                //
                //  If n is even, then x^n = (x^2)^(n/2).
                //  If n is odd,  then x^n = x * x^(n-1),
                //   and applying the equation for even x gives
                //    x^n = x * (x^2)^((n-1) / 2).
                //
                //  Also, EVM division is flooring and
                //    floor[(n-1) / 2] = floor[n / 2].
                //
                function rpow(uint x, uint n) internal pure returns (uint z) {
                    z = n % 2 != 0 ? x : RAY;
            
                    for (n /= 2; n != 0; n /= 2) {
                        x = rmul(x, x);
            
                        if (n % 2 != 0) {
                            z = rmul(z, x);
                        }
                    }
                }
            }
            
            /**
             * @title ERC20 interface
             * @dev see https://github.com/ethereum/EIPs/issues/20
             * Altered from https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a466e76d26c394b1faa6e2797aefe34668566392/contracts/token/ERC20/ERC20.sol
             */
            interface ERC20 {
              function totalSupply() public view returns (uint256);
            
              function balanceOf(address _who) public view returns (uint256);
            
              function allowance(address _owner, address _spender)
                public view returns (uint256);
            
              function transfer(address _to, uint256 _value) public returns (bool);
            
              function approve(address _spender, uint256 _value) public returns (bool);
            
              function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
            
              event Transfer(
                address indexed from,
                address indexed to,
                uint256 value
              );
            
              event Approval(
                address indexed owner,
                address indexed spender,
                uint256 value
              );
            }
            
            /// @dev Just adds extra functions that we use elsewhere
            contract ERC20WithFields is ERC20 {
                string public symbol;
                string public name;
                uint8 public decimals;
            }
            
            
            /**
             * @title Standard ERC20 token
             *
             * @dev Implementation of the basic standard token.
             * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
             * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
             * Rearranged from https://github.com/OpenZeppelin/openzeppelin-solidity/blob/a466e76d26c394b1faa6e2797aefe34668566392/contracts/token/ERC20/StandardToken.sol
             */
            contract StandardToken is ERC20 {
                using SafeMath for uint256;
            
                mapping (address => uint256) balances;
            
                mapping (address => mapping (address => uint256)) allowed;
            
                uint256 totalSupply_;
            
                /**
                 * @dev Total number of tokens in existence
                 */
                function totalSupply() public view returns (uint256) {
                    return totalSupply_;
                }
            
                /**
                 * @dev Gets the balance of the specified address.
                 * @param _owner The address to query the the balance of.
                 * @return An uint256 representing the amount owned by the passed address.
                 */
                function balanceOf(address _owner) public view returns (uint256) {
                    return balances[_owner];
                }
            
                /**
                 * @dev Function to check the amount of tokens that an owner allowed to a spender.
                 * @param _owner address The address which owns the funds.
                 * @param _spender address The address which will spend the funds.
                 * @return A uint256 specifying the amount of tokens still available for the spender.
                 */
                function allowance(
                    address _owner,
                    address _spender
                )
                    public
                    view
                    returns (uint256)
                {
                    return allowed[_owner][_spender];
                }
            
                /**
                * @dev Transfer token for a specified address
                * @param _to The address to transfer to.
                * @param _value The amount to be transferred.
                */
                function transfer(address _to, uint256 _value) public returns (bool) {
                    require(_value <= balances[msg.sender]);
                    require(_to != address(0));
            
                    balances[msg.sender] = balances[msg.sender].sub(_value);
                    balances[_to] = balances[_to].add(_value);
                    emit Transfer(msg.sender, _to, _value);
                    return true;
                }
            
                /**
                * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
                * Beware that changing an allowance with this method brings the risk that someone may use both the old
                * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
                * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
                * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                * @param _spender The address which will spend the funds.
                    * @param _value The amount of tokens to be spent.
                    */
                function approve(address _spender, uint256 _value) public returns (bool) {
                    allowed[msg.sender][_spender] = _value;
                    emit Approval(msg.sender, _spender, _value);
                    return true;
                }
            
                /**
                * @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
                */
                function transferFrom(
                    address _from,
                    address _to,
                    uint256 _value
                )
                    public
                    returns (bool)
                {
                    require(_value <= balances[_from]);
                    require(_value <= allowed[_from][msg.sender]);
                    require(_to != address(0));
            
                    balances[_from] = balances[_from].sub(_value);
                    balances[_to] = balances[_to].add(_value);
                    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
                    emit Approval(_from, msg.sender, allowed[_from][msg.sender]);
                    emit Transfer(_from, _to, _value);
                    return true;
                }
            
                /**
                * @dev Increase the amount of tokens that an owner allowed to a spender.
                * approve should be called when allowed[_spender] == 0. To increment
                * allowed value is better to use this function to avoid 2 calls (and wait until
                * the first transaction is mined)
                * From MonolithDAO Token.sol
                * @param _spender The address which will spend the funds.
                * @param _addedValue The amount of tokens to increase the allowance by.
                */
                function increaseApproval(
                    address _spender,
                    uint256 _addedValue
                )
                    public
                    returns (bool)
                {
                    allowed[msg.sender][_spender] = (allowed[msg.sender][_spender].add(_addedValue));
                    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
                    return true;
                }
            
                /**
                 * @dev Decrease the amount of tokens that an owner allowed to a spender.
                 * approve should be called when allowed[_spender] == 0. To decrement
                 * allowed value is better to use this function to avoid 2 calls (and wait until
                 * the first transaction is mined)
                 * From MonolithDAO Token.sol
                 * @param _spender The address which will spend the funds.
                 * @param _subtractedValue The amount of tokens to decrease the allowance by.
                 */
                function decreaseApproval(
                    address _spender,
                    uint256 _subtractedValue
                )
                    public
                    returns (bool)
                {
                    uint256 oldValue = allowed[msg.sender][_spender];
                    if (_subtractedValue >= oldValue) {
                        allowed[msg.sender][_spender] = 0;
                    } else {
                        allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
                    }
                    emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
                    return true;
                }
            
                /**
                * @dev Internal function that mints an amount of the token and assigns it to
                * an account. This encapsulates the modification of balances such that the
                * proper events are emitted.
                * @param _account The account that will receive the created tokens.
                * @param _amount The amount that will be created.
                 */
                function _mint(address _account, uint256 _amount) internal {
                    require(_account != 0);
                    totalSupply_ = totalSupply_.add(_amount);
                    balances[_account] = balances[_account].add(_amount);
                    emit Transfer(address(0), _account, _amount);
                }
            
                /**
                 * @dev Internal function that burns an amount of the token of a given
                 * account.
                 * @param _account The account whose tokens will be burnt.
                 * @param _amount The amount that will be burnt.
                 */
                function _burn(address _account, uint256 _amount) internal {
                    require(_account != 0);
                    require(_amount <= balances[_account]);
            
                    totalSupply_ = totalSupply_.sub(_amount);
                    balances[_account] = balances[_account].sub(_amount);
                    emit Transfer(_account, address(0), _amount);
                }
            
                /**
                 * @dev Internal function that burns an amount of the token of a given
                 * account, deducting from the sender's allowance for said account. Uses the
                 * internal _burn function.
                 * @param _account The account whose tokens will be burnt.
                 * @param _amount The amount that will be burnt.
                 */
                function _burnFrom(address _account, uint256 _amount) internal {
                    require(_amount <= allowed[_account][msg.sender]);
                    allowed[_account][msg.sender] = allowed[_account][msg.sender].sub(_amount);
                    emit Approval(_account, msg.sender, allowed[_account][msg.sender]);
                    _burn(_account, _amount);
                }
            }
            
            
            contract PreminedToken is StandardToken {
                string public symbol;
                string public  name;
                uint8 public decimals;
            
                constructor(string _symbol, uint8 _decimals, string _name) public {
                    symbol = _symbol;
                    decimals = _decimals;
                    name = _name;
                    totalSupply_ = 1000000 * 10**uint(decimals);
                    balances[msg.sender] = totalSupply_;
                    emit Transfer(address(0), msg.sender, totalSupply_);
                }
            }
            
            
            /// @dev Just a wrapper for premined tokens which can actually be burnt
            contract BurnableToken is PreminedToken {
                constructor(string _symbol, uint8 _decimals, string _name)
                    public
                    PreminedToken(_symbol, _decimals, _name)
                {}
            
                function burn(uint _amount) public {
                    _burn(msg.sender, _amount);
                }
                
                function burnFrom(address from, uint256 value) public {
                    _burnFrom(from, value);
                }
            }
            
            
            /// @notice Must return a value for an asset
            interface PriceSourceInterface {
                event PriceUpdate(address[] token, uint[] price);
            
                function getQuoteAsset() external view returns (address);
                function getLastUpdate() external view returns (uint);
            
                /// @notice Returns false if asset not applicable, or price not recent
                function hasValidPrice(address) public view returns (bool);
                function hasValidPrices(address[]) public view returns (bool);
            
                /// @notice Return the last known price, and when it was issued
                function getPrice(address _asset) public view returns (uint price, uint timestamp);
                function getPrices(address[] _assets) public view returns (uint[] prices, uint[] timestamps);
            
                /// @notice Get price info, and revert if not valid
                function getPriceInfo(address _asset) view returns (uint price, uint decimals);
                function getInvertedPriceInfo(address ofAsset) view returns (uint price, uint decimals);
            
                function getReferencePriceInfo(address _base, address _quote) public view returns (uint referencePrice, uint decimal);
                function getOrderPriceInfo(address sellAsset, address buyAsset, uint sellQuantity, uint buyQuantity) public view returns (uint orderPrice);
                function existsPriceOnAssetPair(address sellAsset, address buyAsset) public view returns (bool isExistent);
                function convertQuantity(
                    uint fromAssetQuantity,
                    address fromAsset,
                    address toAsset
                ) public view returns (uint);
            }
            
            
            contract DSAuthority {
                function canCall(
                    address src, address dst, bytes4 sig
                ) public view returns (bool);
            }
            
            contract DSAuthEvents {
                event LogSetAuthority (address indexed authority);
                event LogSetOwner     (address indexed owner);
            }
            
            contract DSAuth is DSAuthEvents {
                DSAuthority  public  authority;
                address      public  owner;
            
                constructor() public {
                    owner = msg.sender;
                    emit LogSetOwner(msg.sender);
                }
            
                function setOwner(address owner_)
                    public
                    auth
                {
                    owner = owner_;
                    emit LogSetOwner(owner);
                }
            
                function setAuthority(DSAuthority authority_)
                    public
                    auth
                {
                    authority = authority_;
                    emit LogSetAuthority(address(authority));
                }
            
                modifier auth {
                    require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized");
                    _;
                }
            
                function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
                    if (src == address(this)) {
                        return true;
                    } else if (src == owner) {
                        return true;
                    } else if (authority == DSAuthority(0)) {
                        return false;
                    } else {
                        return authority.canCall(src, address(this), sig);
                    }
                }
            }
            
            contract DSGuardEvents {
                event LogPermit(
                    bytes32 indexed src,
                    bytes32 indexed dst,
                    bytes32 indexed sig
                );
            
                event LogForbid(
                    bytes32 indexed src,
                    bytes32 indexed dst,
                    bytes32 indexed sig
                );
            }
            
            contract DSGuard is DSAuth, DSAuthority, DSGuardEvents {
                bytes32 constant public ANY = bytes32(uint(-1));
            
                mapping (bytes32 => mapping (bytes32 => mapping (bytes32 => bool))) acl;
            
                function canCall(
                    address src_, address dst_, bytes4 sig
                ) public view returns (bool) {
                    bytes32 src = bytes32(bytes20(src_));
                    bytes32 dst = bytes32(bytes20(dst_));
            
                    return acl[src][dst][sig]
                        || acl[src][dst][ANY]
                        || acl[src][ANY][sig]
                        || acl[src][ANY][ANY]
                        || acl[ANY][dst][sig]
                        || acl[ANY][dst][ANY]
                        || acl[ANY][ANY][sig]
                        || acl[ANY][ANY][ANY];
                }
            
                function permit(bytes32 src, bytes32 dst, bytes32 sig) public auth {
                    acl[src][dst][sig] = true;
                    emit LogPermit(src, dst, sig);
                }
            
                function forbid(bytes32 src, bytes32 dst, bytes32 sig) public auth {
                    acl[src][dst][sig] = false;
                    emit LogForbid(src, dst, sig);
                }
            
                function permit(address src, address dst, bytes32 sig) public {
                    permit(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);
                }
                function forbid(address src, address dst, bytes32 sig) public {
                    forbid(bytes32(bytes20(src)), bytes32(bytes20(dst)), sig);
                }
            
            }
            
            contract DSGuardFactory {
                mapping (address => bool)  public  isGuard;
            
                function newGuard() public returns (DSGuard guard) {
                    guard = new DSGuard();
                    guard.setOwner(msg.sender);
                    isGuard[address(guard)] = true;
                }
            }
            
            /// @notice Has one Hub
            contract Spoke is DSAuth {
                Hub public hub;
                Hub.Routes public routes;
                bool public initialized;
            
                modifier onlyInitialized() {
                    require(initialized, "Component not yet initialized");
                    _;
                }
            
                modifier notShutDown() {
                    require(!hub.isShutDown(), "Hub is shut down");
                    _;
                }
            
                constructor(address _hub) {
                    hub = Hub(_hub);
                    setAuthority(hub);
                    setOwner(hub); // temporary, to allow initialization
                }
            
                function initialize(address[12] _spokes) external auth {
                    require(msg.sender == address(hub));
                    require(!initialized, "Already initialized");
                    routes = Hub.Routes(
                        _spokes[0],
                        _spokes[1],
                        _spokes[2],
                        _spokes[3],
                        _spokes[4],
                        _spokes[5],
                        _spokes[6],
                        _spokes[7],
                        _spokes[8],
                        _spokes[9],
                        _spokes[10],
                        _spokes[11]
                    );
                    initialized = true;
                    setOwner(address(0));
                }
            
                function engine() public view returns (address) { return routes.engine; }
                function mlnToken() public view returns (address) { return routes.mlnToken; }
                function priceSource() public view returns (address) { return routes.priceSource; }
                function version() public view returns (address) { return routes.version; }
                function registry() public view returns (address) { return routes.registry; }
            }
            
            
            /// @notice Router for communication between components
            /// @notice Has one or more Spokes
            contract Hub is DSGuard {
            
                event FundShutDown();
            
                struct Routes {
                    address accounting;
                    address feeManager;
                    address participation;
                    address policyManager;
                    address shares;
                    address trading;
                    address vault;
                    address priceSource;
                    address registry;
                    address version;
                    address engine;
                    address mlnToken;
                }
            
                Routes public routes;
                address public manager;
                address public creator;
                string public name;
                bool public isShutDown;
                bool public spokesSet;
                bool public routingSet;
                bool public permissionsSet;
                uint public creationTime;
                mapping (address => bool) public isSpoke;
            
                constructor(address _manager, string _name) {
                    creator = msg.sender;
                    manager = _manager;
                    name = _name;
                    creationTime = block.timestamp;
                }
            
                modifier onlyCreator() {
                    require(msg.sender == creator, "Only creator can do this");
                    _;
                }
            
                function shutDownFund() external {
                    require(msg.sender == routes.version);
                    isShutDown = true;
                    emit FundShutDown();
                }
            
                function setSpokes(address[12] _spokes) external onlyCreator {
                    require(!spokesSet, "Spokes already set");
                    for (uint i = 0; i < _spokes.length; i++) {
                        isSpoke[_spokes[i]] = true;
                    }
                    routes.accounting = _spokes[0];
                    routes.feeManager = _spokes[1];
                    routes.participation = _spokes[2];
                    routes.policyManager = _spokes[3];
                    routes.shares = _spokes[4];
                    routes.trading = _spokes[5];
                    routes.vault = _spokes[6];
                    routes.priceSource = _spokes[7];
                    routes.registry = _spokes[8];
                    routes.version = _spokes[9];
                    routes.engine = _spokes[10];
                    routes.mlnToken = _spokes[11];
                    spokesSet = true;
                }
            
                function setRouting() external onlyCreator {
                    require(spokesSet, "Spokes must be set");
                    require(!routingSet, "Routing already set");
                    address[12] memory spokes = [
                        routes.accounting, routes.feeManager, routes.participation,
                        routes.policyManager, routes.shares, routes.trading,
                        routes.vault, routes.priceSource, routes.registry,
                        routes.version, routes.engine, routes.mlnToken
                    ];
                    Spoke(routes.accounting).initialize(spokes);
                    Spoke(routes.feeManager).initialize(spokes);
                    Spoke(routes.participation).initialize(spokes);
                    Spoke(routes.policyManager).initialize(spokes);
                    Spoke(routes.shares).initialize(spokes);
                    Spoke(routes.trading).initialize(spokes);
                    Spoke(routes.vault).initialize(spokes);
                    routingSet = true;
                }
            
                function setPermissions() external onlyCreator {
                    require(spokesSet, "Spokes must be set");
                    require(routingSet, "Routing must be set");
                    require(!permissionsSet, "Permissioning already set");
                    permit(routes.participation, routes.vault, bytes4(keccak256('withdraw(address,uint256)')));
                    permit(routes.trading, routes.vault, bytes4(keccak256('withdraw(address,uint256)')));
                    permit(routes.participation, routes.shares, bytes4(keccak256('createFor(address,uint256)')));
                    permit(routes.participation, routes.shares, bytes4(keccak256('destroyFor(address,uint256)')));
                    permit(routes.feeManager, routes.shares, bytes4(keccak256('createFor(address,uint256)')));
                    permit(routes.participation, routes.accounting, bytes4(keccak256('addAssetToOwnedAssets(address)')));
                    permit(routes.trading, routes.accounting, bytes4(keccak256('addAssetToOwnedAssets(address)')));
                    permit(routes.trading, routes.accounting, bytes4(keccak256('removeFromOwnedAssets(address)')));
                    permit(routes.accounting, routes.feeManager, bytes4(keccak256('rewardAllFees()')));
                    permit(manager, routes.policyManager, bytes4(keccak256('register(bytes4,address)')));
                    permit(manager, routes.policyManager, bytes4(keccak256('batchRegister(bytes4[],address[])')));
                    permit(manager, routes.participation, bytes4(keccak256('enableInvestment(address[])')));
                    permit(manager, routes.participation, bytes4(keccak256('disableInvestment(address[])')));
                    permissionsSet = true;
                }
            
                function vault() external view returns (address) { return routes.vault; }
                function accounting() external view returns (address) { return routes.accounting; }
                function priceSource() external view returns (address) { return routes.priceSource; }
                function participation() external view returns (address) { return routes.participation; }
                function trading() external view returns (address) { return routes.trading; }
                function shares() external view returns (address) { return routes.shares; }
                function registry() external view returns (address) { return routes.registry; }
                function policyManager() external view returns (address) { return routes.policyManager; }
            }
            
            
            
            
            contract Registry is DSAuth {
            
                // EVENTS
                event AssetUpsert (
                    address indexed asset,
                    string name,
                    string symbol,
                    uint decimals,
                    string url,
                    uint reserveMin,
                    uint[] standards,
                    bytes4[] sigs
                );
            
                event ExchangeAdapterUpsert (
                    address indexed exchange,
                    address indexed adapter,
                    bool takesCustody,
                    bytes4[] sigs
                );
            
                event AssetRemoval (address indexed asset);
                event EfxWrapperRegistryChange(address indexed registry);
                event EngineChange(address indexed engine);
                event ExchangeAdapterRemoval (address indexed exchange);
                event IncentiveChange(uint incentiveAmount);
                event MGMChange(address indexed MGM);
                event MlnTokenChange(address indexed mlnToken);
                event NativeAssetChange(address indexed nativeAsset);
                event PriceSourceChange(address indexed priceSource);
                event VersionRegistration(address indexed version);
            
                // TYPES
                struct Asset {
                    bool exists;
                    string name;
                    string symbol;
                    uint decimals;
                    string url;
                    uint reserveMin;
                    uint[] standards;
                    bytes4[] sigs;
                }
            
                struct Exchange {
                    bool exists;
                    address exchangeAddress;
                    bool takesCustody;
                    bytes4[] sigs;
                }
            
                struct Version {
                    bool exists;
                    bytes32 name;
                }
            
                // CONSTANTS
                uint public constant MAX_REGISTERED_ENTITIES = 20;
                uint public constant MAX_FUND_NAME_BYTES = 66;
            
                // FIELDS
                mapping (address => Asset) public assetInformation;
                address[] public registeredAssets;
            
                // Mapping from adapter address to exchange Information (Adapters are unique)
                mapping (address => Exchange) public exchangeInformation;
                address[] public registeredExchangeAdapters;
            
                mapping (address => Version) public versionInformation;
                address[] public registeredVersions;
            
                mapping (address => bool) public isFeeRegistered;
            
                mapping (address => address) public fundsToVersions;
                mapping (bytes32 => bool) public versionNameExists;
                mapping (bytes32 => address) public fundNameHashToOwner;
            
            
                uint public incentive = 10 finney;
                address public priceSource;
                address public mlnToken;
                address public nativeAsset;
                address public engine;
                address public ethfinexWrapperRegistry;
                address public MGM;
            
                modifier onlyVersion() {
                    require(
                        versionInformation[msg.sender].exists,
                        "Only a Version can do this"
                    );
                    _;
                }
            
                // METHODS
            
                constructor(address _postDeployOwner) {
                    setOwner(_postDeployOwner);
                }
            
                // PUBLIC METHODS
            
                /// @notice Whether _name has only valid characters
                function isValidFundName(string _name) public view returns (bool) {
                    bytes memory b = bytes(_name);
                    if (b.length > MAX_FUND_NAME_BYTES) return false;
                    for (uint i; i < b.length; i++){
                        bytes1 char = b[i];
                        if(
                            !(char >= 0x30 && char <= 0x39) && // 9-0
                            !(char >= 0x41 && char <= 0x5A) && // A-Z
                            !(char >= 0x61 && char <= 0x7A) && // a-z
                            !(char == 0x20 || char == 0x2D) && // space, dash
                            !(char == 0x2E || char == 0x5F) && // period, underscore
                            !(char == 0x2A) // *
                        ) {
                            return false;
                        }
                    }
                    return true;
                }
            
                /// @notice Whether _user can use _name for their fund
                function canUseFundName(address _user, string _name) public view returns (bool) {
                    bytes32 nameHash = keccak256(_name);
                    return (
                        isValidFundName(_name) &&
                        (
                            fundNameHashToOwner[nameHash] == address(0) ||
                            fundNameHashToOwner[nameHash] == _user
                        )
                    );
                }
            
                function reserveFundName(address _owner, string _name)
                    external
                    onlyVersion
                {
                    require(canUseFundName(_owner, _name), "Fund name cannot be used");
                    fundNameHashToOwner[keccak256(_name)] = _owner;
                }
            
                function registerFund(address _fund, address _owner, string _name)
                    external
                    onlyVersion
                {
                    require(canUseFundName(_owner, _name), "Fund name cannot be used");
                    fundsToVersions[_fund] = msg.sender;
                }
            
                /// @notice Registers an Asset information entry
                /// @dev Pre: Only registrar owner should be able to register
                /// @dev Post: Address _asset is registered
                /// @param _asset Address of asset to be registered
                /// @param _name Human-readable name of the Asset
                /// @param _symbol Human-readable symbol of the Asset
                /// @param _url Url for extended information of the asset
                /// @param _standards Integers of EIP standards this asset adheres to
                /// @param _sigs Function signatures for whitelisted asset functions
                function registerAsset(
                    address _asset,
                    string _name,
                    string _symbol,
                    string _url,
                    uint _reserveMin,
                    uint[] _standards,
                    bytes4[] _sigs
                ) external auth {
                    require(registeredAssets.length < MAX_REGISTERED_ENTITIES);
                    require(!assetInformation[_asset].exists);
                    assetInformation[_asset].exists = true;
                    registeredAssets.push(_asset);
                    updateAsset(
                        _asset,
                        _name,
                        _symbol,
                        _url,
                        _reserveMin,
                        _standards,
                        _sigs
                    );
                }
            
                /// @notice Register an exchange information entry (A mapping from exchange adapter -> Exchange information)
                /// @dev Adapters are unique so are used as the mapping key. There may be different adapters for same exchange (0x / Ethfinex)
                /// @dev Pre: Only registrar owner should be able to register
                /// @dev Post: Address _exchange is registered
                /// @param _exchange Address of the exchange for the adapter
                /// @param _adapter Address of exchange adapter
                /// @param _takesCustody Whether this exchange takes custody of tokens before trading
                /// @param _sigs Function signatures for whitelisted exchange functions
                function registerExchangeAdapter(
                    address _exchange,
                    address _adapter,
                    bool _takesCustody,
                    bytes4[] _sigs
                ) external auth {
                    require(!exchangeInformation[_adapter].exists, "Adapter already exists");
                    exchangeInformation[_adapter].exists = true;
                    require(registeredExchangeAdapters.length < MAX_REGISTERED_ENTITIES, "Exchange limit reached");
                    registeredExchangeAdapters.push(_adapter);
                    updateExchangeAdapter(
                        _exchange,
                        _adapter,
                        _takesCustody,
                        _sigs
                    );
                }
            
                /// @notice Versions cannot be removed from registry
                /// @param _version Address of the version contract
                /// @param _name Name of the version
                function registerVersion(
                    address _version,
                    bytes32 _name
                ) external auth {
                    require(!versionInformation[_version].exists, "Version already exists");
                    require(!versionNameExists[_name], "Version name already exists");
                    versionInformation[_version].exists = true;
                    versionNameExists[_name] = true;
                    versionInformation[_version].name = _name;
                    registeredVersions.push(_version);
                    emit VersionRegistration(_version);
                }
            
                function setIncentive(uint _weiAmount) external auth {
                    incentive = _weiAmount;
                    emit IncentiveChange(_weiAmount);
                }
            
                function setPriceSource(address _priceSource) external auth {
                    priceSource = _priceSource;
                    emit PriceSourceChange(_priceSource);
                }
            
                function setMlnToken(address _mlnToken) external auth {
                    mlnToken = _mlnToken;
                    emit MlnTokenChange(_mlnToken);
                }
            
                function setNativeAsset(address _nativeAsset) external auth {
                    nativeAsset = _nativeAsset;
                    emit NativeAssetChange(_nativeAsset);
                }
            
                function setEngine(address _engine) external auth {
                    engine = _engine;
                    emit EngineChange(_engine);
                }
            
                function setMGM(address _MGM) external auth {
                    MGM = _MGM;
                    emit MGMChange(_MGM);
                }
            
                function setEthfinexWrapperRegistry(address _registry) external auth {
                    ethfinexWrapperRegistry = _registry;
                    emit EfxWrapperRegistryChange(_registry);
                }
            
                /// @notice Updates description information of a registered Asset
                /// @dev Pre: Owner can change an existing entry
                /// @dev Post: Changed Name, Symbol, URL and/or IPFSHash
                /// @param _asset Address of the asset to be updated
                /// @param _name Human-readable name of the Asset
                /// @param _symbol Human-readable symbol of the Asset
                /// @param _url Url for extended information of the asset
                function updateAsset(
                    address _asset,
                    string _name,
                    string _symbol,
                    string _url,
                    uint _reserveMin,
                    uint[] _standards,
                    bytes4[] _sigs
                ) public auth {
                    require(assetInformation[_asset].exists);
                    Asset asset = assetInformation[_asset];
                    asset.name = _name;
                    asset.symbol = _symbol;
                    asset.decimals = ERC20WithFields(_asset).decimals();
                    asset.url = _url;
                    asset.reserveMin = _reserveMin;
                    asset.standards = _standards;
                    asset.sigs = _sigs;
                    emit AssetUpsert(
                        _asset,
                        _name,
                        _symbol,
                        asset.decimals,
                        _url,
                        _reserveMin,
                        _standards,
                        _sigs
                    );
                }
            
                function updateExchangeAdapter(
                    address _exchange,
                    address _adapter,
                    bool _takesCustody,
                    bytes4[] _sigs
                ) public auth {
                    require(exchangeInformation[_adapter].exists, "Exchange with adapter doesn't exist");
                    Exchange exchange = exchangeInformation[_adapter];
                    exchange.exchangeAddress = _exchange;
                    exchange.takesCustody = _takesCustody;
                    exchange.sigs = _sigs;
                    emit ExchangeAdapterUpsert(
                        _exchange,
                        _adapter,
                        _takesCustody,
                        _sigs
                    );
                }
            
                /// @notice Deletes an existing entry
                /// @dev Owner can delete an existing entry
                /// @param _asset address for which specific information is requested
                function removeAsset(
                    address _asset,
                    uint _assetIndex
                ) external auth {
                    require(assetInformation[_asset].exists);
                    require(registeredAssets[_assetIndex] == _asset);
                    delete assetInformation[_asset];
                    delete registeredAssets[_assetIndex];
                    for (uint i = _assetIndex; i < registeredAssets.length-1; i++) {
                        registeredAssets[i] = registeredAssets[i+1];
                    }
                    registeredAssets.length--;
                    emit AssetRemoval(_asset);
                }
            
                /// @notice Deletes an existing entry
                /// @dev Owner can delete an existing entry
                /// @param _adapter address of the adapter of the exchange that is to be removed
                /// @param _adapterIndex index of the exchange in array
                function removeExchangeAdapter(
                    address _adapter,
                    uint _adapterIndex
                ) external auth {
                    require(exchangeInformation[_adapter].exists, "Exchange with adapter doesn't exist");
                    require(registeredExchangeAdapters[_adapterIndex] == _adapter, "Incorrect adapter index");
                    delete exchangeInformation[_adapter];
                    delete registeredExchangeAdapters[_adapterIndex];
                    for (uint i = _adapterIndex; i < registeredExchangeAdapters.length-1; i++) {
                        registeredExchangeAdapters[i] = registeredExchangeAdapters[i+1];
                    }
                    registeredExchangeAdapters.length--;
                    emit ExchangeAdapterRemoval(_adapter);
                }
            
                function registerFees(address[] _fees) external auth {
                    for (uint i; i < _fees.length; i++) {
                        isFeeRegistered[_fees[i]] = true;
                    }
                }
            
                function deregisterFees(address[] _fees) external auth {
                    for (uint i; i < _fees.length; i++) {
                        delete isFeeRegistered[_fees[i]];
                    }
                }
            
                // PUBLIC VIEW METHODS
            
                // get asset specific information
                function getName(address _asset) external view returns (string) {
                    return assetInformation[_asset].name;
                }
                function getSymbol(address _asset) external view returns (string) {
                    return assetInformation[_asset].symbol;
                }
                function getDecimals(address _asset) external view returns (uint) {
                    return assetInformation[_asset].decimals;
                }
                function getReserveMin(address _asset) external view returns (uint) {
                    return assetInformation[_asset].reserveMin;
                }
                function assetIsRegistered(address _asset) external view returns (bool) {
                    return assetInformation[_asset].exists;
                }
                function getRegisteredAssets() external view returns (address[]) {
                    return registeredAssets;
                }
                function assetMethodIsAllowed(address _asset, bytes4 _sig)
                    external
                    view
                    returns (bool)
                {
                    bytes4[] memory signatures = assetInformation[_asset].sigs;
                    for (uint i = 0; i < signatures.length; i++) {
                        if (signatures[i] == _sig) {
                            return true;
                        }
                    }
                    return false;
                }
            
                // get exchange-specific information
                function exchangeAdapterIsRegistered(address _adapter) external view returns (bool) {
                    return exchangeInformation[_adapter].exists;
                }
                function getRegisteredExchangeAdapters() external view returns (address[]) {
                    return registeredExchangeAdapters;
                }
                function getExchangeInformation(address _adapter)
                    public
                    view
                    returns (address, bool)
                {
                    Exchange exchange = exchangeInformation[_adapter];
                    return (
                        exchange.exchangeAddress,
                        exchange.takesCustody
                    );
                }
                function exchangeForAdapter(address _adapter) external view returns (address) {
                    Exchange exchange = exchangeInformation[_adapter];
                    return exchange.exchangeAddress;
                }
                function getAdapterFunctionSignatures(address _adapter)
                    public
                    view
                    returns (bytes4[])
                {
                    return exchangeInformation[_adapter].sigs;
                }
                function adapterMethodIsAllowed(
                    address _adapter, bytes4 _sig
                )
                    external
                    view
                    returns (bool)
                {
                    bytes4[] memory signatures = exchangeInformation[_adapter].sigs;
                    for (uint i = 0; i < signatures.length; i++) {
                        if (signatures[i] == _sig) {
                            return true;
                        }
                    }
                    return false;
                }
            
                // get version and fund information
                function getRegisteredVersions() external view returns (address[]) {
                    return registeredVersions;
                }
            
                function isFund(address _who) external view returns (bool) {
                    if (fundsToVersions[_who] != address(0)) {
                        return true; // directly from a hub
                    } else {
                        address hub = Hub(Spoke(_who).hub());
                        require(
                            Hub(hub).isSpoke(_who),
                            "Call from either a spoke or hub"
                        );
                        return fundsToVersions[hub] != address(0);
                    }
                }
            
                function isFundFactory(address _who) external view returns (bool) {
                    return versionInformation[_who].exists;
                }
            }
            
            
            /// @notice Liquidity contract and token sink
            contract Engine is DSMath {
            
                event RegistryChange(address registry);
                event SetAmguPrice(uint amguPrice);
                event AmguPaid(uint amount);
                event Thaw(uint amount);
                event Burn(uint amount);
            
                uint public constant MLN_DECIMALS = 18;
            
                Registry public registry;
                uint public amguPrice;
                uint public frozenEther;
                uint public liquidEther;
                uint public lastThaw;
                uint public thawingDelay;
                uint public totalEtherConsumed;
                uint public totalAmguConsumed;
                uint public totalMlnBurned;
            
                constructor(uint _delay, address _registry) {
                    lastThaw = block.timestamp;
                    thawingDelay = _delay;
                    _setRegistry(_registry);
                }
            
                modifier onlyMGM() {
                    require(
                        msg.sender == registry.MGM(),
                        "Only MGM can call this"
                    );
                    _;
                }
            
                /// @dev Registry owner is MTC
                modifier onlyMTC() {
                    require(
                        msg.sender == registry.owner(),
                        "Only MTC can call this"
                    );
                    _;
                }
            
                function _setRegistry(address _registry) internal {
                    registry = Registry(_registry);
                    emit RegistryChange(registry);
                }
            
                /// @dev only callable by MTC
                function setRegistry(address _registry)
                    external
                    onlyMTC
                {
                    _setRegistry(_registry);
                }
            
                /// @dev set price of AMGU in MLN (base units)
                /// @dev only callable by MGM
                function setAmguPrice(uint _price)
                    external
                    onlyMGM
                {
                    amguPrice = _price;
                    emit SetAmguPrice(_price);
                }
            
                function getAmguPrice() public view returns (uint) { return amguPrice; }
            
                function premiumPercent() public view returns (uint) {
                    if (liquidEther < 1 ether) {
                        return 0;
                    } else if (liquidEther >= 1 ether && liquidEther < 5 ether) {
                        return 5;
                    } else if (liquidEther >= 5 ether && liquidEther < 10 ether) {
                        return 10;
                    } else if (liquidEther >= 10 ether) {
                        return 15;
                    }
                }
            
                function payAmguInEther() external payable {
                    require(
                        registry.isFundFactory(msg.sender) ||
                        registry.isFund(msg.sender),
                        "Sender must be a fund or the factory"
                    );
                    uint mlnPerAmgu = getAmguPrice();
                    uint ethPerMln;
                    (ethPerMln,) = priceSource().getPrice(address(mlnToken()));
                    uint amguConsumed;
                    if (mlnPerAmgu > 0 && ethPerMln > 0) {
                        amguConsumed = (mul(msg.value, 10 ** uint(MLN_DECIMALS))) / (mul(ethPerMln, mlnPerAmgu));
                    } else {
                        amguConsumed = 0;
                    }
                    totalEtherConsumed = add(totalEtherConsumed, msg.value);
                    totalAmguConsumed = add(totalAmguConsumed, amguConsumed);
                    frozenEther = add(frozenEther, msg.value);
                    emit AmguPaid(amguConsumed);
                }
            
                /// @notice Move frozen ether to liquid pool after delay
                /// @dev Delay only restarts when this function is called
                function thaw() external {
                    require(
                        block.timestamp >= add(lastThaw, thawingDelay),
                        "Thawing delay has not passed"
                    );
                    require(frozenEther > 0, "No frozen ether to thaw");
                    lastThaw = block.timestamp;
                    liquidEther = add(liquidEther, frozenEther);
                    emit Thaw(frozenEther);
                    frozenEther = 0;
                }
            
                /// @return ETH per MLN including premium
                function enginePrice() public view returns (uint) {
                    uint ethPerMln;
                    (ethPerMln, ) = priceSource().getPrice(address(mlnToken()));
                    uint premium = (mul(ethPerMln, premiumPercent()) / 100);
                    return add(ethPerMln, premium);
                }
            
                function ethPayoutForMlnAmount(uint mlnAmount) public view returns (uint) {
                    return mul(mlnAmount, enginePrice()) / 10 ** uint(MLN_DECIMALS);
                }
            
                /// @notice MLN must be approved first
                function sellAndBurnMln(uint mlnAmount) external {
                    require(registry.isFund(msg.sender), "Only funds can use the engine");
                    require(
                        mlnToken().transferFrom(msg.sender, address(this), mlnAmount),
                        "MLN transferFrom failed"
                    );
                    uint ethToSend = ethPayoutForMlnAmount(mlnAmount);
                    require(ethToSend > 0, "No ether to pay out");
                    require(liquidEther >= ethToSend, "Not enough liquid ether to send");
                    liquidEther = sub(liquidEther, ethToSend);
                    totalMlnBurned = add(totalMlnBurned, mlnAmount);
                    msg.sender.transfer(ethToSend);
                    mlnToken().burn(mlnAmount);
                    emit Burn(mlnAmount);
                }
            
                /// @dev Get MLN from the registry
                function mlnToken()
                    public
                    view
                    returns (BurnableToken)
                {
                    return BurnableToken(registry.mlnToken());
                }
            
                /// @dev Get PriceSource from the registry
                function priceSource()
                    public
                    view
                    returns (PriceSourceInterface)
                {
                    return PriceSourceInterface(registry.priceSource());
                }
            }

            File 2 of 3: WETH9
            // Copyright (C) 2015, 2016, 2017 Dapphub
            
            // This program is free software: you can redistribute it and/or modify
            // it under the terms of the GNU General Public License as published by
            // the Free Software Foundation, either version 3 of the License, or
            // (at your option) any later version.
            
            // This program is distributed in the hope that it will be useful,
            // but WITHOUT ANY WARRANTY; without even the implied warranty of
            // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
            // GNU General Public License for more details.
            
            // You should have received a copy of the GNU General Public License
            // along with this program.  If not, see <http://www.gnu.org/licenses/>.
            
            pragma solidity ^0.4.18;
            
            contract WETH9 {
                string public name     = "Wrapped Ether";
                string public symbol   = "WETH";
                uint8  public decimals = 18;
            
                event  Approval(address indexed src, address indexed guy, uint wad);
                event  Transfer(address indexed src, address indexed dst, uint wad);
                event  Deposit(address indexed dst, uint wad);
                event  Withdrawal(address indexed src, uint wad);
            
                mapping (address => uint)                       public  balanceOf;
                mapping (address => mapping (address => uint))  public  allowance;
            
                function() public payable {
                    deposit();
                }
                function deposit() public payable {
                    balanceOf[msg.sender] += msg.value;
                    Deposit(msg.sender, msg.value);
                }
                function withdraw(uint wad) public {
                    require(balanceOf[msg.sender] >= wad);
                    balanceOf[msg.sender] -= wad;
                    msg.sender.transfer(wad);
                    Withdrawal(msg.sender, wad);
                }
            
                function totalSupply() public view returns (uint) {
                    return this.balance;
                }
            
                function approve(address guy, uint wad) public returns (bool) {
                    allowance[msg.sender][guy] = wad;
                    Approval(msg.sender, guy, wad);
                    return true;
                }
            
                function transfer(address dst, uint wad) public returns (bool) {
                    return transferFrom(msg.sender, dst, wad);
                }
            
                function transferFrom(address src, address dst, uint wad)
                    public
                    returns (bool)
                {
                    require(balanceOf[src] >= wad);
            
                    if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
                        require(allowance[src][msg.sender] >= wad);
                        allowance[src][msg.sender] -= wad;
                    }
            
                    balanceOf[src] -= wad;
                    balanceOf[dst] += wad;
            
                    Transfer(src, dst, wad);
            
                    return true;
                }
            }
            
            
            /*
                                GNU GENERAL PUBLIC LICENSE
                                   Version 3, 29 June 2007
            
             Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
             Everyone is permitted to copy and distribute verbatim copies
             of this license document, but changing it is not allowed.
            
                                        Preamble
            
              The GNU General Public License is a free, copyleft license for
            software and other kinds of works.
            
              The licenses for most software and other practical works are designed
            to take away your freedom to share and change the works.  By contrast,
            the GNU General Public License is intended to guarantee your freedom to
            share and change all versions of a program--to make sure it remains free
            software for all its users.  We, the Free Software Foundation, use the
            GNU General Public License for most of our software; it applies also to
            any other work released this way by its authors.  You can apply it to
            your programs, too.
            
              When we speak of free software, we are referring to freedom, not
            price.  Our General Public Licenses are designed to make sure that you
            have the freedom to distribute copies of free software (and charge for
            them if you wish), that you receive source code or can get it if you
            want it, that you can change the software or use pieces of it in new
            free programs, and that you know you can do these things.
            
              To protect your rights, we need to prevent others from denying you
            these rights or asking you to surrender the rights.  Therefore, you have
            certain responsibilities if you distribute copies of the software, or if
            you modify it: responsibilities to respect the freedom of others.
            
              For example, if you distribute copies of such a program, whether
            gratis or for a fee, you must pass on to the recipients the same
            freedoms that you received.  You must make sure that they, too, receive
            or can get the source code.  And you must show them these terms so they
            know their rights.
            
              Developers that use the GNU GPL protect your rights with two steps:
            (1) assert copyright on the software, and (2) offer you this License
            giving you legal permission to copy, distribute and/or modify it.
            
              For the developers' and authors' protection, the GPL clearly explains
            that there is no warranty for this free software.  For both users' and
            authors' sake, the GPL requires that modified versions be marked as
            changed, so that their problems will not be attributed erroneously to
            authors of previous versions.
            
              Some devices are designed to deny users access to install or run
            modified versions of the software inside them, although the manufacturer
            can do so.  This is fundamentally incompatible with the aim of
            protecting users' freedom to change the software.  The systematic
            pattern of such abuse occurs in the area of products for individuals to
            use, which is precisely where it is most unacceptable.  Therefore, we
            have designed this version of the GPL to prohibit the practice for those
            products.  If such problems arise substantially in other domains, we
            stand ready to extend this provision to those domains in future versions
            of the GPL, as needed to protect the freedom of users.
            
              Finally, every program is threatened constantly by software patents.
            States should not allow patents to restrict development and use of
            software on general-purpose computers, but in those that do, we wish to
            avoid the special danger that patents applied to a free program could
            make it effectively proprietary.  To prevent this, the GPL assures that
            patents cannot be used to render the program non-free.
            
              The precise terms and conditions for copying, distribution and
            modification follow.
            
                                   TERMS AND CONDITIONS
            
              0. Definitions.
            
              "This License" refers to version 3 of the GNU General Public License.
            
              "Copyright" also means copyright-like laws that apply to other kinds of
            works, such as semiconductor masks.
            
              "The Program" refers to any copyrightable work licensed under this
            License.  Each licensee is addressed as "you".  "Licensees" and
            "recipients" may be individuals or organizations.
            
              To "modify" a work means to copy from or adapt all or part of the work
            in a fashion requiring copyright permission, other than the making of an
            exact copy.  The resulting work is called a "modified version" of the
            earlier work or a work "based on" the earlier work.
            
              A "covered work" means either the unmodified Program or a work based
            on the Program.
            
              To "propagate" a work means to do anything with it that, without
            permission, would make you directly or secondarily liable for
            infringement under applicable copyright law, except executing it on a
            computer or modifying a private copy.  Propagation includes copying,
            distribution (with or without modification), making available to the
            public, and in some countries other activities as well.
            
              To "convey" a work means any kind of propagation that enables other
            parties to make or receive copies.  Mere interaction with a user through
            a computer network, with no transfer of a copy, is not conveying.
            
              An interactive user interface displays "Appropriate Legal Notices"
            to the extent that it includes a convenient and prominently visible
            feature that (1) displays an appropriate copyright notice, and (2)
            tells the user that there is no warranty for the work (except to the
            extent that warranties are provided), that licensees may convey the
            work under this License, and how to view a copy of this License.  If
            the interface presents a list of user commands or options, such as a
            menu, a prominent item in the list meets this criterion.
            
              1. Source Code.
            
              The "source code" for a work means the preferred form of the work
            for making modifications to it.  "Object code" means any non-source
            form of a work.
            
              A "Standard Interface" means an interface that either is an official
            standard defined by a recognized standards body, or, in the case of
            interfaces specified for a particular programming language, one that
            is widely used among developers working in that language.
            
              The "System Libraries" of an executable work include anything, other
            than the work as a whole, that (a) is included in the normal form of
            packaging a Major Component, but which is not part of that Major
            Component, and (b) serves only to enable use of the work with that
            Major Component, or to implement a Standard Interface for which an
            implementation is available to the public in source code form.  A
            "Major Component", in this context, means a major essential component
            (kernel, window system, and so on) of the specific operating system
            (if any) on which the executable work runs, or a compiler used to
            produce the work, or an object code interpreter used to run it.
            
              The "Corresponding Source" for a work in object code form means all
            the source code needed to generate, install, and (for an executable
            work) run the object code and to modify the work, including scripts to
            control those activities.  However, it does not include the work's
            System Libraries, or general-purpose tools or generally available free
            programs which are used unmodified in performing those activities but
            which are not part of the work.  For example, Corresponding Source
            includes interface definition files associated with source files for
            the work, and the source code for shared libraries and dynamically
            linked subprograms that the work is specifically designed to require,
            such as by intimate data communication or control flow between those
            subprograms and other parts of the work.
            
              The Corresponding Source need not include anything that users
            can regenerate automatically from other parts of the Corresponding
            Source.
            
              The Corresponding Source for a work in source code form is that
            same work.
            
              2. Basic Permissions.
            
              All rights granted under this License are granted for the term of
            copyright on the Program, and are irrevocable provided the stated
            conditions are met.  This License explicitly affirms your unlimited
            permission to run the unmodified Program.  The output from running a
            covered work is covered by this License only if the output, given its
            content, constitutes a covered work.  This License acknowledges your
            rights of fair use or other equivalent, as provided by copyright law.
            
              You may make, run and propagate covered works that you do not
            convey, without conditions so long as your license otherwise remains
            in force.  You may convey covered works to others for the sole purpose
            of having them make modifications exclusively for you, or provide you
            with facilities for running those works, provided that you comply with
            the terms of this License in conveying all material for which you do
            not control copyright.  Those thus making or running the covered works
            for you must do so exclusively on your behalf, under your direction
            and control, on terms that prohibit them from making any copies of
            your copyrighted material outside their relationship with you.
            
              Conveying under any other circumstances is permitted solely under
            the conditions stated below.  Sublicensing is not allowed; section 10
            makes it unnecessary.
            
              3. Protecting Users' Legal Rights From Anti-Circumvention Law.
            
              No covered work shall be deemed part of an effective technological
            measure under any applicable law fulfilling obligations under article
            11 of the WIPO copyright treaty adopted on 20 December 1996, or
            similar laws prohibiting or restricting circumvention of such
            measures.
            
              When you convey a covered work, you waive any legal power to forbid
            circumvention of technological measures to the extent such circumvention
            is effected by exercising rights under this License with respect to
            the covered work, and you disclaim any intention to limit operation or
            modification of the work as a means of enforcing, against the work's
            users, your or third parties' legal rights to forbid circumvention of
            technological measures.
            
              4. Conveying Verbatim Copies.
            
              You may convey verbatim copies of the Program's source code as you
            receive it, in any medium, provided that you conspicuously and
            appropriately publish on each copy an appropriate copyright notice;
            keep intact all notices stating that this License and any
            non-permissive terms added in accord with section 7 apply to the code;
            keep intact all notices of the absence of any warranty; and give all
            recipients a copy of this License along with the Program.
            
              You may charge any price or no price for each copy that you convey,
            and you may offer support or warranty protection for a fee.
            
              5. Conveying Modified Source Versions.
            
              You may convey a work based on the Program, or the modifications to
            produce it from the Program, in the form of source code under the
            terms of section 4, provided that you also meet all of these conditions:
            
                a) The work must carry prominent notices stating that you modified
                it, and giving a relevant date.
            
                b) The work must carry prominent notices stating that it is
                released under this License and any conditions added under section
                7.  This requirement modifies the requirement in section 4 to
                "keep intact all notices".
            
                c) You must license the entire work, as a whole, under this
                License to anyone who comes into possession of a copy.  This
                License will therefore apply, along with any applicable section 7
                additional terms, to the whole of the work, and all its parts,
                regardless of how they are packaged.  This License gives no
                permission to license the work in any other way, but it does not
                invalidate such permission if you have separately received it.
            
                d) If the work has interactive user interfaces, each must display
                Appropriate Legal Notices; however, if the Program has interactive
                interfaces that do not display Appropriate Legal Notices, your
                work need not make them do so.
            
              A compilation of a covered work with other separate and independent
            works, which are not by their nature extensions of the covered work,
            and which are not combined with it such as to form a larger program,
            in or on a volume of a storage or distribution medium, is called an
            "aggregate" if the compilation and its resulting copyright are not
            used to limit the access or legal rights of the compilation's users
            beyond what the individual works permit.  Inclusion of a covered work
            in an aggregate does not cause this License to apply to the other
            parts of the aggregate.
            
              6. Conveying Non-Source Forms.
            
              You may convey a covered work in object code form under the terms
            of sections 4 and 5, provided that you also convey the
            machine-readable Corresponding Source under the terms of this License,
            in one of these ways:
            
                a) Convey the object code in, or embodied in, a physical product
                (including a physical distribution medium), accompanied by the
                Corresponding Source fixed on a durable physical medium
                customarily used for software interchange.
            
                b) Convey the object code in, or embodied in, a physical product
                (including a physical distribution medium), accompanied by a
                written offer, valid for at least three years and valid for as
                long as you offer spare parts or customer support for that product
                model, to give anyone who possesses the object code either (1) a
                copy of the Corresponding Source for all the software in the
                product that is covered by this License, on a durable physical
                medium customarily used for software interchange, for a price no
                more than your reasonable cost of physically performing this
                conveying of source, or (2) access to copy the
                Corresponding Source from a network server at no charge.
            
                c) Convey individual copies of the object code with a copy of the
                written offer to provide the Corresponding Source.  This
                alternative is allowed only occasionally and noncommercially, and
                only if you received the object code with such an offer, in accord
                with subsection 6b.
            
                d) Convey the object code by offering access from a designated
                place (gratis or for a charge), and offer equivalent access to the
                Corresponding Source in the same way through the same place at no
                further charge.  You need not require recipients to copy the
                Corresponding Source along with the object code.  If the place to
                copy the object code is a network server, the Corresponding Source
                may be on a different server (operated by you or a third party)
                that supports equivalent copying facilities, provided you maintain
                clear directions next to the object code saying where to find the
                Corresponding Source.  Regardless of what server hosts the
                Corresponding Source, you remain obligated to ensure that it is
                available for as long as needed to satisfy these requirements.
            
                e) Convey the object code using peer-to-peer transmission, provided
                you inform other peers where the object code and Corresponding
                Source of the work are being offered to the general public at no
                charge under subsection 6d.
            
              A separable portion of the object code, whose source code is excluded
            from the Corresponding Source as a System Library, need not be
            included in conveying the object code work.
            
              A "User Product" is either (1) a "consumer product", which means any
            tangible personal property which is normally used for personal, family,
            or household purposes, or (2) anything designed or sold for incorporation
            into a dwelling.  In determining whether a product is a consumer product,
            doubtful cases shall be resolved in favor of coverage.  For a particular
            product received by a particular user, "normally used" refers to a
            typical or common use of that class of product, regardless of the status
            of the particular user or of the way in which the particular user
            actually uses, or expects or is expected to use, the product.  A product
            is a consumer product regardless of whether the product has substantial
            commercial, industrial or non-consumer uses, unless such uses represent
            the only significant mode of use of the product.
            
              "Installation Information" for a User Product means any methods,
            procedures, authorization keys, or other information required to install
            and execute modified versions of a covered work in that User Product from
            a modified version of its Corresponding Source.  The information must
            suffice to ensure that the continued functioning of the modified object
            code is in no case prevented or interfered with solely because
            modification has been made.
            
              If you convey an object code work under this section in, or with, or
            specifically for use in, a User Product, and the conveying occurs as
            part of a transaction in which the right of possession and use of the
            User Product is transferred to the recipient in perpetuity or for a
            fixed term (regardless of how the transaction is characterized), the
            Corresponding Source conveyed under this section must be accompanied
            by the Installation Information.  But this requirement does not apply
            if neither you nor any third party retains the ability to install
            modified object code on the User Product (for example, the work has
            been installed in ROM).
            
              The requirement to provide Installation Information does not include a
            requirement to continue to provide support service, warranty, or updates
            for a work that has been modified or installed by the recipient, or for
            the User Product in which it has been modified or installed.  Access to a
            network may be denied when the modification itself materially and
            adversely affects the operation of the network or violates the rules and
            protocols for communication across the network.
            
              Corresponding Source conveyed, and Installation Information provided,
            in accord with this section must be in a format that is publicly
            documented (and with an implementation available to the public in
            source code form), and must require no special password or key for
            unpacking, reading or copying.
            
              7. Additional Terms.
            
              "Additional permissions" are terms that supplement the terms of this
            License by making exceptions from one or more of its conditions.
            Additional permissions that are applicable to the entire Program shall
            be treated as though they were included in this License, to the extent
            that they are valid under applicable law.  If additional permissions
            apply only to part of the Program, that part may be used separately
            under those permissions, but the entire Program remains governed by
            this License without regard to the additional permissions.
            
              When you convey a copy of a covered work, you may at your option
            remove any additional permissions from that copy, or from any part of
            it.  (Additional permissions may be written to require their own
            removal in certain cases when you modify the work.)  You may place
            additional permissions on material, added by you to a covered work,
            for which you have or can give appropriate copyright permission.
            
              Notwithstanding any other provision of this License, for material you
            add to a covered work, you may (if authorized by the copyright holders of
            that material) supplement the terms of this License with terms:
            
                a) Disclaiming warranty or limiting liability differently from the
                terms of sections 15 and 16 of this License; or
            
                b) Requiring preservation of specified reasonable legal notices or
                author attributions in that material or in the Appropriate Legal
                Notices displayed by works containing it; or
            
                c) Prohibiting misrepresentation of the origin of that material, or
                requiring that modified versions of such material be marked in
                reasonable ways as different from the original version; or
            
                d) Limiting the use for publicity purposes of names of licensors or
                authors of the material; or
            
                e) Declining to grant rights under trademark law for use of some
                trade names, trademarks, or service marks; or
            
                f) Requiring indemnification of licensors and authors of that
                material by anyone who conveys the material (or modified versions of
                it) with contractual assumptions of liability to the recipient, for
                any liability that these contractual assumptions directly impose on
                those licensors and authors.
            
              All other non-permissive additional terms are considered "further
            restrictions" within the meaning of section 10.  If the Program as you
            received it, or any part of it, contains a notice stating that it is
            governed by this License along with a term that is a further
            restriction, you may remove that term.  If a license document contains
            a further restriction but permits relicensing or conveying under this
            License, you may add to a covered work material governed by the terms
            of that license document, provided that the further restriction does
            not survive such relicensing or conveying.
            
              If you add terms to a covered work in accord with this section, you
            must place, in the relevant source files, a statement of the
            additional terms that apply to those files, or a notice indicating
            where to find the applicable terms.
            
              Additional terms, permissive or non-permissive, may be stated in the
            form of a separately written license, or stated as exceptions;
            the above requirements apply either way.
            
              8. Termination.
            
              You may not propagate or modify a covered work except as expressly
            provided under this License.  Any attempt otherwise to propagate or
            modify it is void, and will automatically terminate your rights under
            this License (including any patent licenses granted under the third
            paragraph of section 11).
            
              However, if you cease all violation of this License, then your
            license from a particular copyright holder is reinstated (a)
            provisionally, unless and until the copyright holder explicitly and
            finally terminates your license, and (b) permanently, if the copyright
            holder fails to notify you of the violation by some reasonable means
            prior to 60 days after the cessation.
            
              Moreover, your license from a particular copyright holder is
            reinstated permanently if the copyright holder notifies you of the
            violation by some reasonable means, this is the first time you have
            received notice of violation of this License (for any work) from that
            copyright holder, and you cure the violation prior to 30 days after
            your receipt of the notice.
            
              Termination of your rights under this section does not terminate the
            licenses of parties who have received copies or rights from you under
            this License.  If your rights have been terminated and not permanently
            reinstated, you do not qualify to receive new licenses for the same
            material under section 10.
            
              9. Acceptance Not Required for Having Copies.
            
              You are not required to accept this License in order to receive or
            run a copy of the Program.  Ancillary propagation of a covered work
            occurring solely as a consequence of using peer-to-peer transmission
            to receive a copy likewise does not require acceptance.  However,
            nothing other than this License grants you permission to propagate or
            modify any covered work.  These actions infringe copyright if you do
            not accept this License.  Therefore, by modifying or propagating a
            covered work, you indicate your acceptance of this License to do so.
            
              10. Automatic Licensing of Downstream Recipients.
            
              Each time you convey a covered work, the recipient automatically
            receives a license from the original licensors, to run, modify and
            propagate that work, subject to this License.  You are not responsible
            for enforcing compliance by third parties with this License.
            
              An "entity transaction" is a transaction transferring control of an
            organization, or substantially all assets of one, or subdividing an
            organization, or merging organizations.  If propagation of a covered
            work results from an entity transaction, each party to that
            transaction who receives a copy of the work also receives whatever
            licenses to the work the party's predecessor in interest had or could
            give under the previous paragraph, plus a right to possession of the
            Corresponding Source of the work from the predecessor in interest, if
            the predecessor has it or can get it with reasonable efforts.
            
              You may not impose any further restrictions on the exercise of the
            rights granted or affirmed under this License.  For example, you may
            not impose a license fee, royalty, or other charge for exercise of
            rights granted under this License, and you may not initiate litigation
            (including a cross-claim or counterclaim in a lawsuit) alleging that
            any patent claim is infringed by making, using, selling, offering for
            sale, or importing the Program or any portion of it.
            
              11. Patents.
            
              A "contributor" is a copyright holder who authorizes use under this
            License of the Program or a work on which the Program is based.  The
            work thus licensed is called the contributor's "contributor version".
            
              A contributor's "essential patent claims" are all patent claims
            owned or controlled by the contributor, whether already acquired or
            hereafter acquired, that would be infringed by some manner, permitted
            by this License, of making, using, or selling its contributor version,
            but do not include claims that would be infringed only as a
            consequence of further modification of the contributor version.  For
            purposes of this definition, "control" includes the right to grant
            patent sublicenses in a manner consistent with the requirements of
            this License.
            
              Each contributor grants you a non-exclusive, worldwide, royalty-free
            patent license under the contributor's essential patent claims, to
            make, use, sell, offer for sale, import and otherwise run, modify and
            propagate the contents of its contributor version.
            
              In the following three paragraphs, a "patent license" is any express
            agreement or commitment, however denominated, not to enforce a patent
            (such as an express permission to practice a patent or covenant not to
            sue for patent infringement).  To "grant" such a patent license to a
            party means to make such an agreement or commitment not to enforce a
            patent against the party.
            
              If you convey a covered work, knowingly relying on a patent license,
            and the Corresponding Source of the work is not available for anyone
            to copy, free of charge and under the terms of this License, through a
            publicly available network server or other readily accessible means,
            then you must either (1) cause the Corresponding Source to be so
            available, or (2) arrange to deprive yourself of the benefit of the
            patent license for this particular work, or (3) arrange, in a manner
            consistent with the requirements of this License, to extend the patent
            license to downstream recipients.  "Knowingly relying" means you have
            actual knowledge that, but for the patent license, your conveying the
            covered work in a country, or your recipient's use of the covered work
            in a country, would infringe one or more identifiable patents in that
            country that you have reason to believe are valid.
            
              If, pursuant to or in connection with a single transaction or
            arrangement, you convey, or propagate by procuring conveyance of, a
            covered work, and grant a patent license to some of the parties
            receiving the covered work authorizing them to use, propagate, modify
            or convey a specific copy of the covered work, then the patent license
            you grant is automatically extended to all recipients of the covered
            work and works based on it.
            
              A patent license is "discriminatory" if it does not include within
            the scope of its coverage, prohibits the exercise of, or is
            conditioned on the non-exercise of one or more of the rights that are
            specifically granted under this License.  You may not convey a covered
            work if you are a party to an arrangement with a third party that is
            in the business of distributing software, under which you make payment
            to the third party based on the extent of your activity of conveying
            the work, and under which the third party grants, to any of the
            parties who would receive the covered work from you, a discriminatory
            patent license (a) in connection with copies of the covered work
            conveyed by you (or copies made from those copies), or (b) primarily
            for and in connection with specific products or compilations that
            contain the covered work, unless you entered into that arrangement,
            or that patent license was granted, prior to 28 March 2007.
            
              Nothing in this License shall be construed as excluding or limiting
            any implied license or other defenses to infringement that may
            otherwise be available to you under applicable patent law.
            
              12. No Surrender of Others' Freedom.
            
              If conditions are imposed on you (whether by court order, agreement or
            otherwise) that contradict the conditions of this License, they do not
            excuse you from the conditions of this License.  If you cannot convey a
            covered work so as to satisfy simultaneously your obligations under this
            License and any other pertinent obligations, then as a consequence you may
            not convey it at all.  For example, if you agree to terms that obligate you
            to collect a royalty for further conveying from those to whom you convey
            the Program, the only way you could satisfy both those terms and this
            License would be to refrain entirely from conveying the Program.
            
              13. Use with the GNU Affero General Public License.
            
              Notwithstanding any other provision of this License, you have
            permission to link or combine any covered work with a work licensed
            under version 3 of the GNU Affero General Public License into a single
            combined work, and to convey the resulting work.  The terms of this
            License will continue to apply to the part which is the covered work,
            but the special requirements of the GNU Affero General Public License,
            section 13, concerning interaction through a network will apply to the
            combination as such.
            
              14. Revised Versions of this License.
            
              The Free Software Foundation may publish revised and/or new versions of
            the GNU General Public License from time to time.  Such new versions will
            be similar in spirit to the present version, but may differ in detail to
            address new problems or concerns.
            
              Each version is given a distinguishing version number.  If the
            Program specifies that a certain numbered version of the GNU General
            Public License "or any later version" applies to it, you have the
            option of following the terms and conditions either of that numbered
            version or of any later version published by the Free Software
            Foundation.  If the Program does not specify a version number of the
            GNU General Public License, you may choose any version ever published
            by the Free Software Foundation.
            
              If the Program specifies that a proxy can decide which future
            versions of the GNU General Public License can be used, that proxy's
            public statement of acceptance of a version permanently authorizes you
            to choose that version for the Program.
            
              Later license versions may give you additional or different
            permissions.  However, no additional obligations are imposed on any
            author or copyright holder as a result of your choosing to follow a
            later version.
            
              15. Disclaimer of Warranty.
            
              THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
            APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
            HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
            OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
            THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
            PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
            IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
            ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
            
              16. Limitation of Liability.
            
              IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
            WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
            THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
            GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
            USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
            DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
            PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
            EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
            SUCH DAMAGES.
            
              17. Interpretation of Sections 15 and 16.
            
              If the disclaimer of warranty and limitation of liability provided
            above cannot be given local legal effect according to their terms,
            reviewing courts shall apply local law that most closely approximates
            an absolute waiver of all civil liability in connection with the
            Program, unless a warranty or assumption of liability accompanies a
            copy of the Program in return for a fee.
            
                                 END OF TERMS AND CONDITIONS
            
                        How to Apply These Terms to Your New Programs
            
              If you develop a new program, and you want it to be of the greatest
            possible use to the public, the best way to achieve this is to make it
            free software which everyone can redistribute and change under these terms.
            
              To do so, attach the following notices to the program.  It is safest
            to attach them to the start of each source file to most effectively
            state the exclusion of warranty; and each file should have at least
            the "copyright" line and a pointer to where the full notice is found.
            
                <one line to give the program's name and a brief idea of what it does.>
                Copyright (C) <year>  <name of author>
            
                This program is free software: you can redistribute it and/or modify
                it under the terms of the GNU General Public License as published by
                the Free Software Foundation, either version 3 of the License, or
                (at your option) any later version.
            
                This program is distributed in the hope that it will be useful,
                but WITHOUT ANY WARRANTY; without even the implied warranty of
                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                GNU General Public License for more details.
            
                You should have received a copy of the GNU General Public License
                along with this program.  If not, see <http://www.gnu.org/licenses/>.
            
            Also add information on how to contact you by electronic and paper mail.
            
              If the program does terminal interaction, make it output a short
            notice like this when it starts in an interactive mode:
            
                <program>  Copyright (C) <year>  <name of author>
                This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
                This is free software, and you are welcome to redistribute it
                under certain conditions; type `show c' for details.
            
            The hypothetical commands `show w' and `show c' should show the appropriate
            parts of the General Public License.  Of course, your program's commands
            might be different; for a GUI interface, you would use an "about box".
            
              You should also get your employer (if you work as a programmer) or school,
            if any, to sign a "copyright disclaimer" for the program, if necessary.
            For more information on this, and how to apply and follow the GNU GPL, see
            <http://www.gnu.org/licenses/>.
            
              The GNU General Public License does not permit incorporating your program
            into proprietary programs.  If your program is a subroutine library, you
            may consider it more useful to permit linking proprietary applications with
            the library.  If this is what you want to do, use the GNU Lesser General
            Public License instead of this License.  But first, please read
            <http://www.gnu.org/philosophy/why-not-lgpl.html>.
            
            */

            File 3 of 3: Melon
            // Verified using https://dapp.tools
            // hevm: flattened sources of contracts/Melon.sol
            pragma solidity ^0.4.24;
            
            ////// contracts/openzeppelin/IERC20.sol
            /* pragma solidity ^0.4.24; */
            
            /**
             * @title ERC20 interface
             * @dev see https://github.com/ethereum/EIPs/issues/20
             */
            interface IERC20 {
                function totalSupply() external view returns (uint256);
            
                function balanceOf(address who) external view returns (uint256);
            
                function allowance(address owner, address spender) external view returns (uint256);
            
                function transfer(address to, uint256 value) external returns (bool);
            
                function approve(address spender, uint256 value) external returns (bool);
            
                function transferFrom(address from, address to, uint256 value) external returns (bool);
            
                event Transfer(address indexed from, address indexed to, uint256 value);
            
                event Approval(address indexed owner, address indexed spender, uint256 value);
            }
            
            ////// contracts/openzeppelin/SafeMath.sol
            /* pragma solidity ^0.4.24; */
            
            /**
             * @title SafeMath
             * @dev Math operations with safety checks that revert on error
             */
            library SafeMath {
                int256 constant private INT256_MIN = -2**255;
            
                /**
                * @dev Multiplies two unsigned integers, reverts on overflow.
                */
                function mul(uint256 a, uint256 b) internal pure returns (uint256) {
                    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                    // benefit is lost if 'b' is also tested.
                    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
                    if (a == 0) {
                        return 0;
                    }
            
                    uint256 c = a * b;
                    require(c / a == b);
            
                    return c;
                }
            
                /**
                * @dev Multiplies two signed integers, reverts on overflow.
                */
                function mul(int256 a, int256 b) internal pure returns (int256) {
                    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
                    // benefit is lost if 'b' is also tested.
                    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
                    if (a == 0) {
                        return 0;
                    }
            
                    require(!(a == -1 && b == INT256_MIN)); // This is the only case of overflow not detected by the check below
            
                    int256 c = a * b;
                    require(c / a == b);
            
                    return c;
                }
            
                /**
                * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
                */
                function div(uint256 a, uint256 b) internal pure returns (uint256) {
                    // Solidity only automatically asserts when dividing by 0
                    require(b > 0);
                    uint256 c = a / b;
                    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
            
                    return c;
                }
            
                /**
                * @dev Integer division of two signed integers truncating the quotient, reverts on division by zero.
                */
                function div(int256 a, int256 b) internal pure returns (int256) {
                    require(b != 0); // Solidity only automatically asserts when dividing by 0
                    require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow
            
                    int256 c = a / b;
            
                    return c;
                }
            
                /**
                * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
                */
                function sub(uint256 a, uint256 b) internal pure returns (uint256) {
                    require(b <= a);
                    uint256 c = a - b;
            
                    return c;
                }
            
                /**
                * @dev Subtracts two signed integers, reverts on overflow.
                */
                function sub(int256 a, int256 b) internal pure returns (int256) {
                    int256 c = a - b;
                    require((b >= 0 && c <= a) || (b < 0 && c > a));
            
                    return c;
                }
            
                /**
                * @dev Adds two unsigned integers, reverts on overflow.
                */
                function add(uint256 a, uint256 b) internal pure returns (uint256) {
                    uint256 c = a + b;
                    require(c >= a);
            
                    return c;
                }
            
                /**
                * @dev Adds two signed integers, reverts on overflow.
                */
                function add(int256 a, int256 b) internal pure returns (int256) {
                    int256 c = a + b;
                    require((b >= 0 && c >= a) || (b < 0 && c < a));
            
                    return c;
                }
            
                /**
                * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
                * reverts when dividing by zero.
                */
                function mod(uint256 a, uint256 b) internal pure returns (uint256) {
                    require(b != 0);
                    return a % b;
                }
            }
            
            ////// contracts/openzeppelin/ERC20.sol
            /* pragma solidity ^0.4.24; */
            
            /* import "./IERC20.sol"; */
            /* import "./SafeMath.sol"; */
            
            /**
             * @title Standard ERC20 token
             *
             * @dev Implementation of the basic standard token.
             * https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
             * Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
             *
             * This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
             * all accounts just by listening to said events. Note that this isn't required by the specification, and other
             * compliant implementations may not do it.
             */
            contract ERC20 is IERC20 {
                using SafeMath for uint256;
            
                mapping (address => uint256) private _balances;
            
                mapping (address => mapping (address => uint256)) private _allowed;
            
                uint256 private _totalSupply;
            
                /**
                * @dev Total number of tokens in existence
                */
                function totalSupply() public view returns (uint256) {
                    return _totalSupply;
                }
            
                /**
                * @dev Gets the balance of the specified address.
                * @param owner The address to query the balance of.
                * @return An uint256 representing the amount owned by the passed address.
                */
                function balanceOf(address owner) public view returns (uint256) {
                    return _balances[owner];
                }
            
                /**
                 * @dev Function to check the amount of tokens that an owner allowed to a spender.
                 * @param owner address The address which owns the funds.
                 * @param spender address The address which will spend the funds.
                 * @return A uint256 specifying the amount of tokens still available for the spender.
                 */
                function allowance(address owner, address spender) public view returns (uint256) {
                    return _allowed[owner][spender];
                }
            
                /**
                * @dev Transfer token for a specified address
                * @param to The address to transfer to.
                * @param value The amount to be transferred.
                */
                function transfer(address to, uint256 value) public returns (bool) {
                    _transfer(msg.sender, to, value);
                    return true;
                }
            
                /**
                 * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
                 * Beware that changing an allowance with this method brings the risk that someone may use both the old
                 * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
                 * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
                 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
                 * @param spender The address which will spend the funds.
                 * @param value The amount of tokens to be spent.
                 */
                function approve(address spender, uint256 value) public returns (bool) {
                    require(spender != address(0));
            
                    _allowed[msg.sender][spender] = value;
                    emit Approval(msg.sender, spender, value);
                    return true;
                }
            
                /**
                 * @dev Transfer tokens from one address to another.
                 * Note that while this function emits an Approval event, this is not required as per the specification,
                 * and other compliant implementations may not emit the event.
                 * @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
                 */
                function transferFrom(address from, address to, uint256 value) public returns (bool) {
                    _allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
                    _transfer(from, to, value);
                    emit Approval(from, msg.sender, _allowed[from][msg.sender]);
                    return true;
                }
            
                /**
                 * @dev Increase the amount of tokens that an owner allowed to a spender.
                 * approve should be called when allowed_[_spender] == 0. To increment
                 * allowed value is better to use this function to avoid 2 calls (and wait until
                 * the first transaction is mined)
                 * From MonolithDAO Token.sol
                 * Emits an Approval event.
                 * @param spender The address which will spend the funds.
                 * @param addedValue The amount of tokens to increase the allowance by.
                 */
                function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
                    require(spender != address(0));
            
                    _allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
                    emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
                    return true;
                }
            
                /**
                 * @dev Decrease the amount of tokens that an owner allowed to a spender.
                 * approve should be called when allowed_[_spender] == 0. To decrement
                 * allowed value is better to use this function to avoid 2 calls (and wait until
                 * the first transaction is mined)
                 * From MonolithDAO Token.sol
                 * Emits an Approval event.
                 * @param spender The address which will spend the funds.
                 * @param subtractedValue The amount of tokens to decrease the allowance by.
                 */
                function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
                    require(spender != address(0));
            
                    _allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
                    emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
                    return true;
                }
            
                /**
                * @dev Transfer token for a specified addresses
                * @param from The address to transfer from.
                * @param to The address to transfer to.
                * @param value The amount to be transferred.
                */
                function _transfer(address from, address to, uint256 value) internal {
                    require(to != address(0));
            
                    _balances[from] = _balances[from].sub(value);
                    _balances[to] = _balances[to].add(value);
                    emit Transfer(from, to, value);
                }
            
                /**
                 * @dev Internal function that mints an amount of the token and assigns it to
                 * an account. This encapsulates the modification of balances such that the
                 * proper events are emitted.
                 * @param account The account that will receive the created tokens.
                 * @param value The amount that will be created.
                 */
                function _mint(address account, uint256 value) internal {
                    require(account != address(0));
            
                    _totalSupply = _totalSupply.add(value);
                    _balances[account] = _balances[account].add(value);
                    emit Transfer(address(0), account, value);
                }
            
                /**
                 * @dev Internal function that burns an amount of the token of a given
                 * account.
                 * @param account The account whose tokens will be burnt.
                 * @param value The amount that will be burnt.
                 */
                function _burn(address account, uint256 value) internal {
                    require(account != address(0));
            
                    _totalSupply = _totalSupply.sub(value);
                    _balances[account] = _balances[account].sub(value);
                    emit Transfer(account, address(0), value);
                }
            
                /**
                 * @dev Internal function that burns an amount of the token of a given
                 * account, deducting from the sender's allowance for said account. Uses the
                 * internal burn function.
                 * Emits an Approval event (reflecting the reduced allowance).
                 * @param account The account whose tokens will be burnt.
                 * @param value The amount that will be burnt.
                 */
                function _burnFrom(address account, uint256 value) internal {
                    _allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
                    _burn(account, value);
                    emit Approval(account, msg.sender, _allowed[account][msg.sender]);
                }
            }
            
            ////// contracts/openzeppelin/ERC20Burnable.sol
            /* pragma solidity ^0.4.24; */
            
            /* import "./ERC20.sol"; */
            
            /**
             * @title Burnable Token
             * @dev Token that can be irreversibly burned (destroyed).
             */
            contract ERC20Burnable is ERC20 {
                /**
                 * @dev Burns a specific amount of tokens.
                 * @param value The amount of token to be burned.
                 */
                function burn(uint256 value) public {
                    _burn(msg.sender, value);
                }
            
                /**
                 * @dev Burns a specific amount of tokens from the target address and decrements allowance
                 * @param from address The address which you want to send tokens from
                 * @param value uint256 The amount of token to be burned
                 */
                function burnFrom(address from, uint256 value) public {
                    _burnFrom(from, value);
                }
            }
            
            ////// contracts/openzeppelin/ERC20Detailed.sol
            /* pragma solidity ^0.4.24; */
            
            /* import "./IERC20.sol"; */
            
            /**
             * @title ERC20Detailed token
             * @dev The decimals are only for visualization purposes.
             * All the operations are done using the smallest and indivisible token unit,
             * just as on Ethereum all the operations are done in wei.
             */
            contract ERC20Detailed is IERC20 {
                string private _name;
                string private _symbol;
                uint8 private _decimals;
            
                constructor (string name, string symbol, uint8 decimals) public {
                    _name = name;
                    _symbol = symbol;
                    _decimals = decimals;
                }
            
                /**
                 * @return the name of the token.
                 */
                function name() public view returns (string) {
                    return _name;
                }
            
                /**
                 * @return the symbol of the token.
                 */
                function symbol() public view returns (string) {
                    return _symbol;
                }
            
                /**
                 * @return the number of decimals of the token.
                 */
                function decimals() public view returns (uint8) {
                    return _decimals;
                }
            }
            
            ////// contracts/Melon.sol
            /* pragma solidity ^0.4.24; */
            
            /* import "./openzeppelin/ERC20Burnable.sol"; */
            /* import "./openzeppelin/ERC20Detailed.sol"; */
            /* import "./openzeppelin/SafeMath.sol"; */
            
            contract Melon is ERC20Burnable, ERC20Detailed {
                using SafeMath for uint;
            
                uint public constant BASE_UNITS = 10 ** 18;
                uint public constant INFLATION_ENABLE_DATE = 1551398400;
                uint public constant INITIAL_TOTAL_SUPPLY = uint(932613).mul(BASE_UNITS);
                uint public constant YEARLY_MINTABLE_AMOUNT = uint(300600).mul(BASE_UNITS);
                uint public constant MINTING_INTERVAL = 365 days;
            
                address public council;
                address public deployer;
                bool public initialSupplyMinted;
                uint public nextMinting = INFLATION_ENABLE_DATE;
            
                modifier onlyDeployer {
                    require(msg.sender == deployer, "Only deployer can call this");
                    _;
                }
            
                modifier onlyCouncil {
                    require(msg.sender == council, "Only council can call this");
                    _;
                }
            
                modifier anIntervalHasPassed {
                    require(
                        block.timestamp >= uint(nextMinting),
                        "Please wait until an interval has passed"
                    );
                    _;
                }
            
                modifier inflationEnabled {
                    require(
                        block.timestamp >= INFLATION_ENABLE_DATE,
                        "Inflation is not enabled yet"
                    );
                    _;
                }
            
                constructor(
                    string _name,
                    string _symbol,
                    uint8 _decimals,
                    address _council
                ) public ERC20Detailed(_name, _symbol, _decimals) {
                    deployer = msg.sender;
                    council = _council;
                }
            
                function changeCouncil(address _newCouncil) public onlyCouncil {
                    council = _newCouncil;
                }
            
                function mintInitialSupply(address _initialReceiver) public onlyDeployer {
                    require(!initialSupplyMinted, "Initial minting already complete");
                    initialSupplyMinted = true;
                    _mint(_initialReceiver, INITIAL_TOTAL_SUPPLY);
                }
            
                function mintInflation() public anIntervalHasPassed inflationEnabled {
                    require(initialSupplyMinted, "Initial minting not complete");
                    nextMinting = uint(nextMinting).add(MINTING_INTERVAL);
                    _mint(council, YEARLY_MINTABLE_AMOUNT);
                }
            }