ETH Price: $3,781.37 (+1.08%)

Transaction Decoder

Block:
12828785 at Jul-15-2021 02:15:54 AM +UTC
Transaction Fee:
0.095212578 ETH $360.03
Gas Used:
2,322,258 Gas / 41 Gwei

Emitted Events:

125 UniswapV2Factory.PairCreated( token0=WETH9, token1=SmoothLovePotion, pair=UniswapV2Pair, 1539 )
126 SmoothLovePotion.Transfer( _from=[Receiver] Proxy, _to=UniswapV2Pair, _value=5000 )
127 WETH9.Deposit( dst=UniswapV2Router02, wad=918800000000000000 )
128 WETH9.Transfer( src=UniswapV2Router02, dst=UniswapV2Pair, wad=918800000000000000 )
129 UniswapV2Pair.Transfer( from=0x0000000000000000000000000000000000000000, to=0x0000000000000000000000000000000000000000, value=1000 )
130 UniswapV2Pair.Transfer( from=0x0000000000000000000000000000000000000000, to=[Receiver] Proxy, value=67779051811 )
131 UniswapV2Pair.Sync( reserve0=918800000000000000, reserve1=5000 )
132 UniswapV2Pair.Mint( sender=UniswapV2Router02, amount0=918800000000000000, amount1=5000 )
133 Proxy.0x442e715f626346e8c54381002da614f62bee8d27386535b2521ec8540898556e( 0x442e715f626346e8c54381002da614f62bee8d27386535b2521ec8540898556e, 9385f38dad6fbc7cd00fcb25ddb6cc642c5c4b1d8c396256480c20d2845d1a94, 0000000000000000000000000000000000000000000000000000000000000000 )

Account State Difference:

  Address   Before After State Difference Code
0x4724C4d4...a0ae6749F 16.282026574802511538 Eth15.363226574802511538 Eth0.9188
(Spark Pool)
43.580284836352717057 Eth43.675497414352717057 Eth0.095212578
0x8597fa07...bAFeAb328
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 970373714831926824185720946407840263919885073365469911651691774426946431665543512266471865775868962627047669120248256871330625770147892446909619397165810409821289694709588701323306867677257649208384978349326387418445535411191118173905878669248600552166591791127934899764776865837522151370137666890102937838273775714968403856071175813256007843767997955403679486028211556891105243817726967350283407681114102132506579105125304277564748167815342846397024705072290664688887558303342418259078870337858807302319256353732814537234856888289613708027399674335981848864884958452594500448750123709185757271799691704594825598460045237586046981286669973607497255811248054916336618770260591883114344560407110384952401173472315603951832690057890728508533745208338355059829327548814715428518717514222047513979665697375218597595236539309508342917627352671706653209120529696995353248818356303163358689521388719239190242456394183021189172097977158907875657912486338605550512879487546676611633302271475230667775383719586180157187006417919294738744302779946465631339458792305308388695808298977436244150528688722984158355049284028840226995683127551502032244556088325501540382610106837793499207544745847718703884658674971349811778799823186899170503086682057503015478989252616739182840170696904121594239897477811643131587177762472373252413961045631116709127211075498543319742453850377373997193487204507937988130627395736990058948639391539526660279803561610920474370751025762940139057313015758758177084944501064026665275431427980754256105434841498616423371358100769582975367394534305839627596757926422255187488652424989920991106699704285218110087276668191579082991838055940384641216906778353396018761511726797808610883741967942439137978054277212926284323547744109748783704275823053134686965394765704525445335194995340096279909491669098968935048953229629943910852066846595255766003226661174563949284052662117683721297660878592752685812469412066226405256310300438123619122828358311956300515948584897168820181311307515960755566624820143581320130400436732430638757868105953235466201800551590642755199648768273840591217733703620122243046325177668875516589566186636552174328659351513829282183884728262737218293545660596090969194471746871639948423418133586283866848948755311858692792320015436705816826440167723594281725277786605652770607698595900860223296437361927414376806437454204221244562486431899121071258780478379713316090152930112403133360327562653887016859083131040153889215211323340813891512208835582785595562532764709571103779102385994607473767759168295977624053955553512127361136426538721787686273453511216321239183520203588811113863626898343603784694118873851299330941956336018763877641535415884115710877740619706271918898464309749601333378501029178035189073363581003538216114898931114069302906737007051217887941611058391704483961983559785678569226084393692748550358504162988262743787900735768854607548925214343876751173683240824537308869801034098086776090912184840943364789608450108459058933828983365323127039638227524786338618000741006805641404819667044578037513628325173792992961824268689937669803599385494531623006692678868266120342454231855367906672560857809652908409078712367240635083658783854998584107465781037693112513504825080582332559347701051998974052053888576433850257906421102691284722864269704993003259908294704731616967666654167264848619972686653049260286109671848420793729709370897804926875423209863906428649310141041420009308127692597213921785490932788250583591674330356319897647747966146273898207930464771640539235830297333795401391504913652002320834613139741729368076652639464809773036076522969727659814124493464736987149809623832179451960770442040089734066312381297621879209022972801995571207352139151813089383646316351003310088139583590200672467808917264244386886686780453034140252637399180853260893922871128134433658609402748592130103963716546418725297520172944253857179183372468597190740759330590535670086374039630566975022955063170235065419296211949925273534052166004931987053298744637680011520831696542439607935300090502442438628514704477777102077986400176928856421605465129904174375972069211884462686883127713983467366860696368293716646956430672441424157258002385728282981306401694519326352934263298910982764980359652051223655655973714964833272423536068705931065645195932747891957766635776607472853023498124125964636568569512510264833392965747882773042738073847722385153647116948377688001424405819072114441606023784819011307292593178371303550296069228919741033823614181671434165165421383404767918836111241485989602761334449249466478212271691824027973863031222508351251598385598912343174008560798462069422639468405381063772605084007897065125907501478031106752086726688148537339128408569442511472471975545649657946884040962639071287276756275296263185109094564560920665709490772570679214129986144483752172595065335376963118597353944360246948948707586104853443176504880336918799957791065013022708627522814449711198702971114199024767133622346271292454993091805558177225768153096898303215097794211384523665473480643159410975016566620094591227052545319983765731532882350692747959420304224788485546890539259456085729469644680536986534637473170030708752822844772728987369817960256444094330702380885247926779415102435230803511443387105218505773040253262681523812180336520174794063087828241652218468762070586639746038321444642339626887634561153005479829608775330513173749405949716488789916381320425408414358752168817056559748812376244000590762854954314312663591755959405349006342640619098860796240062136157017719308399118564718743424013383953737720966358025713878278595430321887831137936259968296108592516513885707646624386380588008284583091803577117355591715374847170183589884461644255753143821210520303003100589083442202872479208287982760509683028047435613917926769745754618786845568335164562199183803448267307125507647424953068096864047151973851978073177428952839368627496204245025512138852305067922475400744111741971427173134495092218577816898603979675657754170230151168303366348265812641753106106772591540444252313523596780852703861172946736140246608460295875532543210426388979849381559833437039563435941549222227434569151633120212031453018819385630747722690813161762643419447206720512857089685827237039229397153740701597393287473724788562809034793328475823300677471937317677691837237894690439996426670181098526505342455729605979013749562452983747978768114552446856852023712514155703336513599427920772230682119186309321861914970213987289588275852035719372336659513573113656877618591862649326611914128580797181101364248322503230781633164186818231899634001311333258722839527336120702530738349212452416436300664085922190387117741793094198905592333357837426362099693208264568304704344967573770233806317187230870419409670937264725195884319274347207104410975884158365820401269043531976282629352504595598126046414093102768964092394311909425922966147107009361287347299428758092883122692136112630686169998346027329153711259532475731043582179362533519845870327551250060165488318315803827996089999110430800065530467920180163722884927674657200276626081910461803269368952628730875439204264162932081120527913006557957744514889818853925809011263078396276018428867706926005115509213333228605275574890553026955179599871709202395034822652888141269309109734322733264506756420204739831230530880327169751198067980692564160862893983370283465694590183203769738224718314349984179540394198676053375664759977675702219997771811838247986690461023015927827429492578944271012650006574408024585377051203614603729660654456777990209191502022990197729818969864410828865017479646361979476453851484691304981448346016038824075560134472665066664491496179478999648935490294701429779929315619388575702574357785786090451257694788109101210639982684833459404824653248740920617108408548887935240960839050302685749957466576524637031585237207339666450432711265151975751341773671998379757237804933942228055834687721941426537564376739573344032146862045259319183351508814511830286739243982365210781714974458897247497697002057154545892946110509547543471449083690747604826499673393514629399722431455689436350763458074168064888197070393968390438977228630761766093119655774395698612836974355327985124028054520638396868898892736959571058738421473425384929489113548813840860074487898330414801765855587748553806713906105440614678759954262871936381480236279852264806909516711341688548750501337587387672360221244371172177671200922024952651391556899415437579417011797401592989444457073058275514205956201848924217964835016415954656336252152856491521595231297454269241938277131439704423551330612117358046164730806832601160288390874769930872202629213600971363540576274141782381535247172155304749605615723096656469063547236276388170374855879792917902148058601928565499982491144692486083511159333922403948467825631315716451899262083934011171848498437165726363619725429738272768068275481148343272357717715150724633570307392266973671384031024725364695855198542436416424360582961266612568697466028541562876786082163927073662080043144889766409119138448855762360858613202880414776752522467635049718129289638698721065221925939135759391754085175391096464080040023095105645093813002457184029379826150339976731647337702786957691568399488647262699092137030247089786860088628392311411861836543300617935577226081902113340564338782783648633548985274420679526628794356405839072220764943487632464344256729379647295745097693846466289646792591875466815860796571268171492137772810924090844967592335574781754716685784691014495046993523459358222061397503969885568467212847294389127064062045960751855865770410518730507699373418760658333677112957244072117879293498465127102270950754390673539046312444324669390947895797211606548479473329353848576117136172619357906471019074036841450925640565889945574682536528223276622784642449667081724706674034033565494717346503769515040472385946502596541182491529408987820922111880322587337440286877512839054470637984159200451631314592617512951699433153475235051530534244418897306687989511134122202108387116023928323393685624348550174007518071030991921987960670005320336877725964006729509639764597879335793850991602353340061558978051791300636366553862753724370623567968749783743310780965036384605460691415194433689969011792973782473666950781224341315781450260035537719069704919720787263675816258532654591347236112761126400845251037826580843692724311711333112779225989883101744757245522183925999092166378829399827665359320744176108182791920430631066099517964732943588800249683483552673364253912775513166306788502375427615776030682207304558057915785891170359083003506646568939144125975464897708668342017234594621007650504231529767738963839937251500725868969894569417717880486314264631787016280709740788000085743995949795467514386081601265876195773210554156664380919010352067746586927874956968642069823898907824505385129849954983593151006664078692024277439343794964900380458144271983561819401740504889542906704033311834295862042680157208880708862945239096085854099675739746647198632047949942242766670969367007119626619843275096008868870903165501506054102277734036597006432439849426382928680483878929115980449437248303103730604604592219926788689799174953705421826252975210132506850942122495828640523632088798819600172273825009705603169474652888941308494136146681775574600873672105369458799174990461031795705196541081814131638647046005745470256316096326843752906192320328546785563701780636829801898881528702809091457681100156525220118941327671513095786900017264775058641975182773252443580703006370973152943735735742285548548294699790631541248592989241957243039395060417242697132769629526041535322521567995031721284554356733693331592393104973550169047476203721814936589454528872745901630224615442989086815050052787690939530838859133503778297474896311126790406655466517562847539984021903454365389210667011353422460804557274316638803784710865430830008710699929583983043198766622348864987925050304298262827118935540356738701427925554624732808712109260530989348886248024089487130530404851035088670778246702210209088813805811907431148698396276997459378045504728422691255167219358992301084830132326603177696930466301600864085761755561999092577471792763261997877124626854601292477204157934995386209866950649217732587631957987512932767561879105467656889358094535660718173509156619154285903745112199448970760461006993780614112378281744018991808106630713891427374272023679690978206418934655911079191164789255422133484034273841768693139752423025910110946595652958417442477329430614244980753983362977720871460234864332771053833672737385209965600946595217766006705509026335509477823549003356986161630450925451471756599928476953844115491317427518347142728294936900654063320919079169285734763420505042430799660052417974812293277574774495634371192624279092678522520750496435533666954262462791923797130294327609327848256088663585250685505553614974996756806161687704484071008834742737611940384249653338719817823413378421369601095501312144948495855539403060945885081617073278655682049319069029345671477101366796090736510647364543619064229138844873187388727093530914503627954549241832721488528113846291486541998769962403140919120192937910762917046598457816085658368084945362999807914843368403160449927534613376645197123266144917645477745760744680788271770438533853528044263031585396537896973379066873050363663459138939627619811565049002466703204632171381254017627402046149919219222020468226407743716190862780972009870633237901970906872167286590335348007321748183330880831894517946593143311518075865318361769843573639749478724865189109381609191603639419492707737523586307085883952245365881699264388059523295084962136196858877919464742499682778558150008055864043696561294304075526720560755837319200301322870360611477376950704864996348223704493049371991873583715766288717661124660410740528994164578954884549269315702207501467717456235970416775885723625865136800179170019783518699285177100551996746978063703196484468562083725332025707044434502088998828479479935003802489408559691117390918028532713442605962854364008870636177674215829292274920743064007902408674319602358727755590116931326808886237063800930049816855086360319557479555013074872388376341102936941754783044200240784242710394470642411624545509452881918665007454852507591464153777301531200239259909053527415489780939592604428584244320185608386164260830273792287943771437987254680616514172054163699428650966604299326846676724140554046037026358221667172911863956259956146392339729150490341959475539432842841141291469534887669781319320656658212488599163215819826442113023979743609333804460131078449584535247009672860018797780828507186528033076747945754492845689280056680647094379994572606617159879968580198913830564139884066633170040829394173706681535220794401477997987297977107820559276833700338101970959709324601486316626605489272080540314560766531860937959035948430083007800045007498518871400943035382833985896842761282512388069238975577827426697859409780907813757482456128103770110049604561331276909028069992448008029939400269044378012410359306419624436057392323165033306556216096491999516197862147320234261339461472875683397169521907905600043631231781545801925083891329614246023591374927606105723616711484545890671142513058556377532998707736458954171149864129939436464074335169248506525066785276675491136322415743917982962584043021663863398460998832644169959399215000217933991974541747409945961883326242580638764259996984016881380781908912159725686109466173134328173490210619158958787033625142640585491171826024862706826915229042224704272380700947928026391349311581425246007287881064209097727176917170386929944486570017097816833310615319893425627747705549542341524222988418400819813694851686348251611424033769185244888235358798548729476924616796051964418542426166888025984387570148732403732506194193958217393623861731246348752581987043707580411196754241659650238869269631716706528956281317686833691822617354461178650995225853844606121132325199558969976375822009166098747524107639013101062599029451378959339390202342582736335599652325505465353986683813946071192018081076312208629765395621209488277395784640860911514039728018066531901659516572197637400575476983162933776715620891736835679339575538095711271758873450076801737906029045336800888123127161425737942261238783698288429238591871878369623243006466420827979809623303915097870501405730419021175864637866787640746589858208013269149415851747981650993140293347620441621505600556855327715304808824122988766738348767312367920204976341982114621575157364390735118188857538091797048990788865248803972209514274999813436635362075827698706353693009242065402727925570603883194574478422993054092064842160983021821541991745086159871539488371195275996694643200450371024090799232120447690997852642261610238429040502221826879328337883986261627726469661275043050945235000486318691012267622286024896456957752092888038622148980772634110200921305608258748205519856430442107346888546461133463542594736137007567199019364607312049451945117486753334499685446808143117559430109302310294457260699168509577665465389348009093500969317952850435509882319600829023179999141813601449202487279621273466315052248272311214774245835781000744915320708917707088419286083855697539420164684989694373887539791225273805431250987945559717884299875590380599141739447481123798946068305286992390176788967266661487863056742269454724613458743877244970441960417040989608269799571037982994082675722414785707995176423374816524171512633509935054437801803310248384314285954281462633920453516986844165643310740186901428295734074251032436825760578410365476902843686484707897486327323001802570292298821730078302732901129606491355573740245413060205772816910805639747087366487474436402913952818642505822608211221231677940391464488526521617830036965405717227879288032834017163260707269715179086414548635459287296187665159532791005266513787039098259163867770236806630346145864154316664216357850431592592359357446437001032934265550512830069601314834263788955728577079168572371414522895094750990390037111638813956940038739336834117961630269344815833094571050603534124731144224664253090404674455179570848947414318901227315544465021017836111627574376422404611915266696378634541371628288275606736107092316640721239149189865613035653407405711253689628930932536948673165561694357200020411829896891576446318915146439820526504623011486554989516165667323335693414934814004410278644054000879039077833478222322272172872756103371354890899347688095119987051466357536009129562866823329151434447032893988942430150070946911349522553627858194947768274263084245629745183222615730004776379639668442725598279874930308244088933008485396959917666681610999955901665756196851949672769851203664125707554741540254559589839455890674210549613366744628250073940092320601238917734706503162753930994533684587838945685931212495222992599246372012582151929497212649486853033780275395201624953847297781180136653199208638796247411753539601271520979109694681051203539727904805097294418844970859034890974420496664672055334861261760577417100136846408252492277891862905518897820428967259414938247580001447414510879102374696398833681566184073453099383668886595163928620965172752288672765029891029325085087456675823219540845532470723299624971609531611152834905485995656999320694510613883917811326120587965945992437257752500815632041698885255900054689108235889290415209428332936722366764889127234155667730465019401160065463007229392807541321336673902417329345781330121820189416588185054182834106503659033695040889811794590145458037336891808190609892824794636329808967954256162631834596750615551750885506661417008739876427848834173792022477826960766473390684073275311664976029919411152403305472706182649305024864582120589644917212074489284683189328610953965037460607871739534360932914668243598486662868330241318289838917701751649537035731801559759342829825067798963468992656715072809773251050799601512114788075674879299224408300911146471181524820624990967218578355354523595632118493281309130872723834470866206629973887965161739406193341212336262793271639852531306838133337615718728319588810050542270596956328567969570294887381238958194557914489771335585918386940508644713954522805652967236056982078861155491811377171122930283117015403615649057864389322174134638420880929447094682133107475402227582325798127425448778476048451495428393366905468431691919308127178234473964052772617886621785434581352325198198055102133905256578806269728104359955638474987554997853220494348754346661779775947650590800195501275865742243509974608314470088293937303056528230079665296631935180049276802937989044278604178623082423213142113594479981759246054400064387201884459817337594764911691628527252625205351851767408034075053271423174343509950819755385274072523521130743043892243679459309153516863691890342691490453628793924053747111342564967146040090893591274974111127466787240729067426868324690634630052613037171225116580863468738108996853020180544491645000100174575664012894587507333228928354119713825262406933537472892720657172973712656680598385724687705359141398533994684371207343695251028367425700446320896600152962617022752618119262643853347831915167751822676880325218838130722794593790105951383826557724427909166920523335397976410875362536439098738683685984789647681920089933271389419332348794542537281522986540989318881267423868328272321517940529382711784095183479130385844905903202668137163485645250252636181922893427516074609054230102691384884727058499011448444251554567015759544508413009302584592842680906254129887071647426059491020839771430126624782157841259965956947711701654222689895616224767511443599054979604607211348567169816537828949827685467972847719691791084849022596830103592906915740960569411166874579067131092771723878155546100222088541325901052260690681040153958893918600970285548717664354906966339614995694273180466886605408349453805523472862965155943740978752213097794321902761534688209534705436678922666950115252179355448276882854139279907243975102208610580905971149150181109773352077055509317246966021606859379181045294031105163315
0x9cBEa900...19f6437de
0.132232670195926926 Eth
Nonce: 137
0.037020092195926926 Eth
Nonce: 138
0.095212578
0xC02aaA39...83C756Cc2 7,021,283.657855853489875401 Eth7,021,284.576655853489875401 Eth0.9188
0xC0AEe478...cE9e4f2Ac
(SushiSwap: SushiV2Factory)
0xCC8Fa225...5D6cAAa25

Execution Trace

Proxy.6a761202( )
  • GnosisSafe.execTransaction( to=0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F, value=918800000000000000, data=0xF305D719000000000000000000000000CC8FA225D80B9C7D42F96E9570156C65D6CAAA25000000000000000000000000000000000000000000000000000000000000138800000000000000000000000000000000000000000000000000000000000013880000000000000000000000000000000000000000000000000CC03BBB63A100000000000000000000000000004724C4D45345DCCF4D35F6433C202F3A0AE6749F0000000000000000000000000000000000000000000000000000000060EFA0B8, operation=0, safeTxGas=2556289, baseGas=0, gasPrice=0, gasToken=0x0000000000000000000000000000000000000000, refundReceiver=0x0000000000000000000000000000000000000000, signatures=0x1C00B3D7E0FA4AF717B9AF8CDDE8E79EA46418961097811AD40B404546F04AD83197319A26E5B2CC7074144F21DED55347454D0FB39288D0AA6575D02B5E6C7B1C0000000000000000000000009CBEA9002993DD3A151C54A7618CECC19F6437DE000000000000000000000000000000000000000000000000000000000000000001 ) => ( success=True )
    • Null: 0x000...001.9385f38d( )
    • ETH 0.9188 UniswapV2Router02.addLiquidityETH( token=0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25, amountTokenDesired=5000, amountTokenMin=5000, amountETHMin=918800000000000000, to=0x4724C4d45345DccF4d35F6433c202F3a0ae6749F, deadline=1626316984 ) => ( amountToken=5000, amountETH=918800000000000000, liquidity=67779051811 )
      • UniswapV2Factory.getPair( 0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 ) => ( 0x0000000000000000000000000000000000000000 )
      • UniswapV2Factory.createPair( tokenA=0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25, tokenB=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 ) => ( pair=0x8597fa0773888107E2867D36dd87Fe5bAFeAb328 )
        • UniswapV2Pair.60806040( )
        • UniswapV2Pair.initialize( _token0=0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, _token1=0xCC8Fa225D80b9c7D42F96e9570156c65D6cAAa25 )
        • UniswapV2Pair.STATICCALL( )
        • SmoothLovePotion.transferFrom( _from=0x4724C4d45345DccF4d35F6433c202F3a0ae6749F, _to=0x8597fa0773888107E2867D36dd87Fe5bAFeAb328, _value=5000 ) => ( _success=True )
        • ETH 0.9188 WETH9.CALL( )
        • WETH9.transfer( dst=0x8597fa0773888107E2867D36dd87Fe5bAFeAb328, wad=918800000000000000 ) => ( True )
        • UniswapV2Pair.mint( to=0x4724C4d45345DccF4d35F6433c202F3a0ae6749F ) => ( liquidity=67779051811 )
          • WETH9.balanceOf( 0x8597fa0773888107E2867D36dd87Fe5bAFeAb328 ) => ( 918800000000000000 )
          • SmoothLovePotion.balanceOf( 0x8597fa0773888107E2867D36dd87Fe5bAFeAb328 ) => ( 5000 )
          • UniswapV2Factory.STATICCALL( )
          • UniswapV2Factory.STATICCALL( )
            File 1 of 7: Proxy
            pragma solidity ^0.5.3;
            
            /// @title Proxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.
            /// @author Stefan George - <[email protected]>
            /// @author Richard Meissner - <[email protected]>
            contract Proxy {
            
                // masterCopy always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.
                // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`
                address internal masterCopy;
            
                /// @dev Constructor function sets address of master copy contract.
                /// @param _masterCopy Master copy address.
                constructor(address _masterCopy)
                    public
                {
                    require(_masterCopy != address(0), "Invalid master copy address provided");
                    masterCopy = _masterCopy;
                }
            
                /// @dev Fallback function forwards all transactions and returns all received return data.
                function ()
                    external
                    payable
                {
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        let masterCopy := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)
                        // 0xa619486e == keccak("masterCopy()"). The value is right padded to 32-bytes with 0s
                        if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {
                            mstore(0, masterCopy)
                            return(0, 0x20)
                        }
                        calldatacopy(0, 0, calldatasize())
                        let success := delegatecall(gas, masterCopy, 0, calldatasize(), 0, 0)
                        returndatacopy(0, 0, returndatasize())
                        if eq(success, 0) { revert(0, returndatasize()) }
                        return(0, returndatasize())
                    }
                }
            }

            File 2 of 7: UniswapV2Factory
            // File: contracts/uniswapv2/interfaces/IUniswapV2Factory.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Factory {
                event PairCreated(address indexed token0, address indexed token1, address pair, uint);
            
                function feeTo() external view returns (address);
                function feeToSetter() external view returns (address);
                function migrator() external view returns (address);
            
                function getPair(address tokenA, address tokenB) external view returns (address pair);
                function allPairs(uint) external view returns (address pair);
                function allPairsLength() external view returns (uint);
            
                function createPair(address tokenA, address tokenB) external returns (address pair);
            
                function setFeeTo(address) external;
                function setFeeToSetter(address) external;
                function setMigrator(address) external;
            }
            
            // File: contracts/uniswapv2/libraries/SafeMath.sol
            
            pragma solidity =0.6.12;
            
            // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
            
            library SafeMathUniswap {
                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');
                }
            }
            
            // File: contracts/uniswapv2/UniswapV2ERC20.sol
            
            pragma solidity =0.6.12;
            
            
            contract UniswapV2ERC20 {
                using SafeMathUniswap for uint;
            
                string public constant name = 'SushiSwap LP Token';
                string public constant symbol = 'SLP';
                uint8 public constant decimals = 18;
                uint  public totalSupply;
                mapping(address => uint) public balanceOf;
                mapping(address => mapping(address => uint)) public allowance;
            
                bytes32 public DOMAIN_SEPARATOR;
                // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
                bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
                mapping(address => uint) public nonces;
            
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                constructor() public {
                    uint chainId;
                    assembly {
                        chainId := chainid()
                    }
                    DOMAIN_SEPARATOR = keccak256(
                        abi.encode(
                            keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
                            keccak256(bytes(name)),
                            keccak256(bytes('1')),
                            chainId,
                            address(this)
                        )
                    );
                }
            
                function _mint(address to, uint value) internal {
                    totalSupply = totalSupply.add(value);
                    balanceOf[to] = balanceOf[to].add(value);
                    emit Transfer(address(0), to, value);
                }
            
                function _burn(address from, uint value) internal {
                    balanceOf[from] = balanceOf[from].sub(value);
                    totalSupply = totalSupply.sub(value);
                    emit Transfer(from, address(0), value);
                }
            
                function _approve(address owner, address spender, uint value) private {
                    allowance[owner][spender] = value;
                    emit Approval(owner, spender, value);
                }
            
                function _transfer(address from, address to, uint value) private {
                    balanceOf[from] = balanceOf[from].sub(value);
                    balanceOf[to] = balanceOf[to].add(value);
                    emit Transfer(from, to, value);
                }
            
                function approve(address spender, uint value) external returns (bool) {
                    _approve(msg.sender, spender, value);
                    return true;
                }
            
                function transfer(address to, uint value) external returns (bool) {
                    _transfer(msg.sender, to, value);
                    return true;
                }
            
                function transferFrom(address from, address to, uint value) external returns (bool) {
                    if (allowance[from][msg.sender] != uint(-1)) {
                        allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
                    }
                    _transfer(from, to, value);
                    return true;
                }
            
                function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
                    require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
                    bytes32 digest = keccak256(
                        abi.encodePacked(
                            '\x19\x01',
                            DOMAIN_SEPARATOR,
                            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
                        )
                    );
                    address recoveredAddress = ecrecover(digest, v, r, s);
                    require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
                    _approve(owner, spender, value);
                }
            }
            
            // File: contracts/uniswapv2/libraries/Math.sol
            
            pragma solidity =0.6.12;
            
            // a library for performing various math operations
            
            library Math {
                function min(uint x, uint y) internal pure returns (uint z) {
                    z = x < y ? x : y;
                }
            
                // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
                function sqrt(uint y) internal pure returns (uint z) {
                    if (y > 3) {
                        z = y;
                        uint x = y / 2 + 1;
                        while (x < z) {
                            z = x;
                            x = (y / x + x) / 2;
                        }
                    } else if (y != 0) {
                        z = 1;
                    }
                }
            }
            
            // File: contracts/uniswapv2/libraries/UQ112x112.sol
            
            pragma solidity =0.6.12;
            
            // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
            
            // range: [0, 2**112 - 1]
            // resolution: 1 / 2**112
            
            library UQ112x112 {
                uint224 constant Q112 = 2**112;
            
                // encode a uint112 as a UQ112x112
                function encode(uint112 y) internal pure returns (uint224 z) {
                    z = uint224(y) * Q112; // never overflows
                }
            
                // divide a UQ112x112 by a uint112, returning a UQ112x112
                function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
                    z = x / uint224(y);
                }
            }
            
            // File: contracts/uniswapv2/interfaces/IERC20.sol
            
            pragma solidity >=0.5.0;
            
            interface IERC20Uniswap {
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                function name() external view returns (string memory);
                function symbol() external view returns (string memory);
                function decimals() external view returns (uint8);
                function totalSupply() external view returns (uint);
                function balanceOf(address owner) external view returns (uint);
                function allowance(address owner, address spender) external view returns (uint);
            
                function approve(address spender, uint value) external returns (bool);
                function transfer(address to, uint value) external returns (bool);
                function transferFrom(address from, address to, uint value) external returns (bool);
            }
            
            // File: contracts/uniswapv2/interfaces/IUniswapV2Callee.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Callee {
                function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
            }
            
            // File: contracts/uniswapv2/UniswapV2Pair.sol
            
            pragma solidity =0.6.12;
            
            
            
            
            
            
            
            
            interface IMigrator {
                // Return the desired amount of liquidity token that the migrator wants.
                function desiredLiquidity() external view returns (uint256);
            }
            
            contract UniswapV2Pair is UniswapV2ERC20 {
                using SafeMathUniswap  for uint;
                using UQ112x112 for uint224;
            
                uint public constant MINIMUM_LIQUIDITY = 10**3;
                bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
            
                address public factory;
                address public token0;
                address public token1;
            
                uint112 private reserve0;           // uses single storage slot, accessible via getReserves
                uint112 private reserve1;           // uses single storage slot, accessible via getReserves
                uint32  private blockTimestampLast; // uses single storage slot, accessible via getReserves
            
                uint public price0CumulativeLast;
                uint public price1CumulativeLast;
                uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
            
                uint private unlocked = 1;
                modifier lock() {
                    require(unlocked == 1, 'UniswapV2: LOCKED');
                    unlocked = 0;
                    _;
                    unlocked = 1;
                }
            
                function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
                    _reserve0 = reserve0;
                    _reserve1 = reserve1;
                    _blockTimestampLast = blockTimestampLast;
                }
            
                function _safeTransfer(address token, address to, uint value) private {
                    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
                    require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
                }
            
                event Mint(address indexed sender, uint amount0, uint amount1);
                event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
                event Swap(
                    address indexed sender,
                    uint amount0In,
                    uint amount1In,
                    uint amount0Out,
                    uint amount1Out,
                    address indexed to
                );
                event Sync(uint112 reserve0, uint112 reserve1);
            
                constructor() public {
                    factory = msg.sender;
                }
            
                // called once by the factory at time of deployment
                function initialize(address _token0, address _token1) external {
                    require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
                    token0 = _token0;
                    token1 = _token1;
                }
            
                // update reserves and, on the first call per block, price accumulators
                function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
                    require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
                    uint32 blockTimestamp = uint32(block.timestamp % 2**32);
                    uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
                    if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
                        // * never overflows, and + overflow is desired
                        price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
                        price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
                    }
                    reserve0 = uint112(balance0);
                    reserve1 = uint112(balance1);
                    blockTimestampLast = blockTimestamp;
                    emit Sync(reserve0, reserve1);
                }
            
                // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
                function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
                    address feeTo = IUniswapV2Factory(factory).feeTo();
                    feeOn = feeTo != address(0);
                    uint _kLast = kLast; // gas savings
                    if (feeOn) {
                        if (_kLast != 0) {
                            uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
                            uint rootKLast = Math.sqrt(_kLast);
                            if (rootK > rootKLast) {
                                uint numerator = totalSupply.mul(rootK.sub(rootKLast));
                                uint denominator = rootK.mul(5).add(rootKLast);
                                uint liquidity = numerator / denominator;
                                if (liquidity > 0) _mint(feeTo, liquidity);
                            }
                        }
                    } else if (_kLast != 0) {
                        kLast = 0;
                    }
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function mint(address to) external lock returns (uint liquidity) {
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
                    uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
                    uint amount0 = balance0.sub(_reserve0);
                    uint amount1 = balance1.sub(_reserve1);
            
                    bool feeOn = _mintFee(_reserve0, _reserve1);
                    uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
                    if (_totalSupply == 0) {
                        address migrator = IUniswapV2Factory(factory).migrator();
                        if (msg.sender == migrator) {
                            liquidity = IMigrator(migrator).desiredLiquidity();
                            require(liquidity > 0 && liquidity != uint256(-1), "Bad desired liquidity");
                        } else {
                            require(migrator == address(0), "Must not have migrator");
                            liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
                            _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
                        }
                    } else {
                        liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
                    }
                    require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
                    _mint(to, liquidity);
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
                    emit Mint(msg.sender, amount0, amount1);
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function burn(address to) external lock returns (uint amount0, uint amount1) {
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    address _token0 = token0;                                // gas savings
                    address _token1 = token1;                                // gas savings
                    uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
                    uint liquidity = balanceOf[address(this)];
            
                    bool feeOn = _mintFee(_reserve0, _reserve1);
                    uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
                    amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
                    amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
                    require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
                    _burn(address(this), liquidity);
                    _safeTransfer(_token0, to, amount0);
                    _safeTransfer(_token1, to, amount1);
                    balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
                    emit Burn(msg.sender, amount0, amount1, to);
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
                    require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
            
                    uint balance0;
                    uint balance1;
                    { // scope for _token{0,1}, avoids stack too deep errors
                    address _token0 = token0;
                    address _token1 = token1;
                    require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
                    if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
                    if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
                    if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
                    balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
                    }
                    uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
                    uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
                    require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
                    { // scope for reserve{0,1}Adjusted, avoids stack too deep errors
                    uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
                    uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
                    require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
                    }
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
                }
            
                // force balances to match reserves
                function skim(address to) external lock {
                    address _token0 = token0; // gas savings
                    address _token1 = token1; // gas savings
                    _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));
                    _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));
                }
            
                // force reserves to match balances
                function sync() external lock {
                    _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);
                }
            }
            
            // File: contracts/uniswapv2/UniswapV2Factory.sol
            
            pragma solidity =0.6.12;
            
            
            
            contract UniswapV2Factory is IUniswapV2Factory {
                address public override feeTo;
                address public override feeToSetter;
                address public override migrator;
            
                mapping(address => mapping(address => address)) public override getPair;
                address[] public override allPairs;
            
                event PairCreated(address indexed token0, address indexed token1, address pair, uint);
            
                constructor(address _feeToSetter) public {
                    feeToSetter = _feeToSetter;
                }
            
                function allPairsLength() external override view returns (uint) {
                    return allPairs.length;
                }
            
                function pairCodeHash() external pure returns (bytes32) {
                    return keccak256(type(UniswapV2Pair).creationCode);
                }
            
                function createPair(address tokenA, address tokenB) external override returns (address pair) {
                    require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');
                    (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
                    require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');
                    require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient
                    bytes memory bytecode = type(UniswapV2Pair).creationCode;
                    bytes32 salt = keccak256(abi.encodePacked(token0, token1));
                    assembly {
                        pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
                    }
                    UniswapV2Pair(pair).initialize(token0, token1);
                    getPair[token0][token1] = pair;
                    getPair[token1][token0] = pair; // populate mapping in the reverse direction
                    allPairs.push(pair);
                    emit PairCreated(token0, token1, pair, allPairs.length);
                }
            
                function setFeeTo(address _feeTo) external override {
                    require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
                    feeTo = _feeTo;
                }
            
                function setMigrator(address _migrator) external override {
                    require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
                    migrator = _migrator;
                }
            
                function setFeeToSetter(address _feeToSetter) external override {
                    require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
                    feeToSetter = _feeToSetter;
                }
            
            }

            File 3 of 7: UniswapV2Pair
            // File: contracts/uniswapv2/interfaces/IUniswapV2Factory.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Factory {
                event PairCreated(address indexed token0, address indexed token1, address pair, uint);
            
                function feeTo() external view returns (address);
                function feeToSetter() external view returns (address);
                function migrator() external view returns (address);
            
                function getPair(address tokenA, address tokenB) external view returns (address pair);
                function allPairs(uint) external view returns (address pair);
                function allPairsLength() external view returns (uint);
            
                function createPair(address tokenA, address tokenB) external returns (address pair);
            
                function setFeeTo(address) external;
                function setFeeToSetter(address) external;
                function setMigrator(address) external;
            }
            
            // File: contracts/uniswapv2/libraries/SafeMath.sol
            
            pragma solidity =0.6.12;
            
            // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
            
            library SafeMathUniswap {
                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');
                }
            }
            
            // File: contracts/uniswapv2/UniswapV2ERC20.sol
            
            pragma solidity =0.6.12;
            
            
            contract UniswapV2ERC20 {
                using SafeMathUniswap for uint;
            
                string public constant name = 'SushiSwap LP Token';
                string public constant symbol = 'SLP';
                uint8 public constant decimals = 18;
                uint  public totalSupply;
                mapping(address => uint) public balanceOf;
                mapping(address => mapping(address => uint)) public allowance;
            
                bytes32 public DOMAIN_SEPARATOR;
                // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
                bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
                mapping(address => uint) public nonces;
            
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                constructor() public {
                    uint chainId;
                    assembly {
                        chainId := chainid()
                    }
                    DOMAIN_SEPARATOR = keccak256(
                        abi.encode(
                            keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
                            keccak256(bytes(name)),
                            keccak256(bytes('1')),
                            chainId,
                            address(this)
                        )
                    );
                }
            
                function _mint(address to, uint value) internal {
                    totalSupply = totalSupply.add(value);
                    balanceOf[to] = balanceOf[to].add(value);
                    emit Transfer(address(0), to, value);
                }
            
                function _burn(address from, uint value) internal {
                    balanceOf[from] = balanceOf[from].sub(value);
                    totalSupply = totalSupply.sub(value);
                    emit Transfer(from, address(0), value);
                }
            
                function _approve(address owner, address spender, uint value) private {
                    allowance[owner][spender] = value;
                    emit Approval(owner, spender, value);
                }
            
                function _transfer(address from, address to, uint value) private {
                    balanceOf[from] = balanceOf[from].sub(value);
                    balanceOf[to] = balanceOf[to].add(value);
                    emit Transfer(from, to, value);
                }
            
                function approve(address spender, uint value) external returns (bool) {
                    _approve(msg.sender, spender, value);
                    return true;
                }
            
                function transfer(address to, uint value) external returns (bool) {
                    _transfer(msg.sender, to, value);
                    return true;
                }
            
                function transferFrom(address from, address to, uint value) external returns (bool) {
                    if (allowance[from][msg.sender] != uint(-1)) {
                        allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
                    }
                    _transfer(from, to, value);
                    return true;
                }
            
                function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
                    require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
                    bytes32 digest = keccak256(
                        abi.encodePacked(
                            '\x19\x01',
                            DOMAIN_SEPARATOR,
                            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
                        )
                    );
                    address recoveredAddress = ecrecover(digest, v, r, s);
                    require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
                    _approve(owner, spender, value);
                }
            }
            
            // File: contracts/uniswapv2/libraries/Math.sol
            
            pragma solidity =0.6.12;
            
            // a library for performing various math operations
            
            library Math {
                function min(uint x, uint y) internal pure returns (uint z) {
                    z = x < y ? x : y;
                }
            
                // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
                function sqrt(uint y) internal pure returns (uint z) {
                    if (y > 3) {
                        z = y;
                        uint x = y / 2 + 1;
                        while (x < z) {
                            z = x;
                            x = (y / x + x) / 2;
                        }
                    } else if (y != 0) {
                        z = 1;
                    }
                }
            }
            
            // File: contracts/uniswapv2/libraries/UQ112x112.sol
            
            pragma solidity =0.6.12;
            
            // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
            
            // range: [0, 2**112 - 1]
            // resolution: 1 / 2**112
            
            library UQ112x112 {
                uint224 constant Q112 = 2**112;
            
                // encode a uint112 as a UQ112x112
                function encode(uint112 y) internal pure returns (uint224 z) {
                    z = uint224(y) * Q112; // never overflows
                }
            
                // divide a UQ112x112 by a uint112, returning a UQ112x112
                function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
                    z = x / uint224(y);
                }
            }
            
            // File: contracts/uniswapv2/interfaces/IERC20.sol
            
            pragma solidity >=0.5.0;
            
            interface IERC20Uniswap {
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                function name() external view returns (string memory);
                function symbol() external view returns (string memory);
                function decimals() external view returns (uint8);
                function totalSupply() external view returns (uint);
                function balanceOf(address owner) external view returns (uint);
                function allowance(address owner, address spender) external view returns (uint);
            
                function approve(address spender, uint value) external returns (bool);
                function transfer(address to, uint value) external returns (bool);
                function transferFrom(address from, address to, uint value) external returns (bool);
            }
            
            // File: contracts/uniswapv2/interfaces/IUniswapV2Callee.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Callee {
                function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
            }
            
            // File: contracts/uniswapv2/UniswapV2Pair.sol
            
            pragma solidity =0.6.12;
            
            
            
            
            
            
            
            
            interface IMigrator {
                // Return the desired amount of liquidity token that the migrator wants.
                function desiredLiquidity() external view returns (uint256);
            }
            
            contract UniswapV2Pair is UniswapV2ERC20 {
                using SafeMathUniswap  for uint;
                using UQ112x112 for uint224;
            
                uint public constant MINIMUM_LIQUIDITY = 10**3;
                bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
            
                address public factory;
                address public token0;
                address public token1;
            
                uint112 private reserve0;           // uses single storage slot, accessible via getReserves
                uint112 private reserve1;           // uses single storage slot, accessible via getReserves
                uint32  private blockTimestampLast; // uses single storage slot, accessible via getReserves
            
                uint public price0CumulativeLast;
                uint public price1CumulativeLast;
                uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
            
                uint private unlocked = 1;
                modifier lock() {
                    require(unlocked == 1, 'UniswapV2: LOCKED');
                    unlocked = 0;
                    _;
                    unlocked = 1;
                }
            
                function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
                    _reserve0 = reserve0;
                    _reserve1 = reserve1;
                    _blockTimestampLast = blockTimestampLast;
                }
            
                function _safeTransfer(address token, address to, uint value) private {
                    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
                    require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
                }
            
                event Mint(address indexed sender, uint amount0, uint amount1);
                event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
                event Swap(
                    address indexed sender,
                    uint amount0In,
                    uint amount1In,
                    uint amount0Out,
                    uint amount1Out,
                    address indexed to
                );
                event Sync(uint112 reserve0, uint112 reserve1);
            
                constructor() public {
                    factory = msg.sender;
                }
            
                // called once by the factory at time of deployment
                function initialize(address _token0, address _token1) external {
                    require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
                    token0 = _token0;
                    token1 = _token1;
                }
            
                // update reserves and, on the first call per block, price accumulators
                function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
                    require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
                    uint32 blockTimestamp = uint32(block.timestamp % 2**32);
                    uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
                    if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
                        // * never overflows, and + overflow is desired
                        price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
                        price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
                    }
                    reserve0 = uint112(balance0);
                    reserve1 = uint112(balance1);
                    blockTimestampLast = blockTimestamp;
                    emit Sync(reserve0, reserve1);
                }
            
                // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
                function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
                    address feeTo = IUniswapV2Factory(factory).feeTo();
                    feeOn = feeTo != address(0);
                    uint _kLast = kLast; // gas savings
                    if (feeOn) {
                        if (_kLast != 0) {
                            uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
                            uint rootKLast = Math.sqrt(_kLast);
                            if (rootK > rootKLast) {
                                uint numerator = totalSupply.mul(rootK.sub(rootKLast));
                                uint denominator = rootK.mul(5).add(rootKLast);
                                uint liquidity = numerator / denominator;
                                if (liquidity > 0) _mint(feeTo, liquidity);
                            }
                        }
                    } else if (_kLast != 0) {
                        kLast = 0;
                    }
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function mint(address to) external lock returns (uint liquidity) {
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
                    uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
                    uint amount0 = balance0.sub(_reserve0);
                    uint amount1 = balance1.sub(_reserve1);
            
                    bool feeOn = _mintFee(_reserve0, _reserve1);
                    uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
                    if (_totalSupply == 0) {
                        address migrator = IUniswapV2Factory(factory).migrator();
                        if (msg.sender == migrator) {
                            liquidity = IMigrator(migrator).desiredLiquidity();
                            require(liquidity > 0 && liquidity != uint256(-1), "Bad desired liquidity");
                        } else {
                            require(migrator == address(0), "Must not have migrator");
                            liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
                            _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
                        }
                    } else {
                        liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
                    }
                    require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
                    _mint(to, liquidity);
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
                    emit Mint(msg.sender, amount0, amount1);
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function burn(address to) external lock returns (uint amount0, uint amount1) {
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    address _token0 = token0;                                // gas savings
                    address _token1 = token1;                                // gas savings
                    uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
                    uint liquidity = balanceOf[address(this)];
            
                    bool feeOn = _mintFee(_reserve0, _reserve1);
                    uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
                    amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
                    amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
                    require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
                    _burn(address(this), liquidity);
                    _safeTransfer(_token0, to, amount0);
                    _safeTransfer(_token1, to, amount1);
                    balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
                    emit Burn(msg.sender, amount0, amount1, to);
                }
            
                // this low-level function should be called from a contract which performs important safety checks
                function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
                    require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
                    (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
                    require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');
            
                    uint balance0;
                    uint balance1;
                    { // scope for _token{0,1}, avoids stack too deep errors
                    address _token0 = token0;
                    address _token1 = token1;
                    require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
                    if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
                    if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
                    if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
                    balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
                    balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
                    }
                    uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
                    uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
                    require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
                    { // scope for reserve{0,1}Adjusted, avoids stack too deep errors
                    uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
                    uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
                    require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
                    }
            
                    _update(balance0, balance1, _reserve0, _reserve1);
                    emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
                }
            
                // force balances to match reserves
                function skim(address to) external lock {
                    address _token0 = token0; // gas savings
                    address _token1 = token1; // gas savings
                    _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));
                    _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));
                }
            
                // force reserves to match balances
                function sync() external lock {
                    _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);
                }
            }

            File 4 of 7: SmoothLovePotion
            // File: math/SafeMath.sol
            
            pragma solidity 0.5.17;
            
            
            library SafeMath {
              function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
                c = a + b;
                require(c >= a, "SafeMath: addition overflow");
              }
            
              function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
                require(b <= a, "SafeMath: subtraction overflow");
                return a - b;
              }
            
              function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
                if (a == 0) {
                  return 0;
                }
            
                c = a * b;
                require(c / a == b, "SafeMath: multiplication overflow");
              }
            
              function div(uint256 a, uint256 b) internal pure returns (uint256 c) {
                // Since Solidity automatically asserts when dividing by 0,
                // but we only need it to revert.
                require(b > 0, "SafeMath: division by zero");
                return a / b;
              }
            
              function mod(uint256 a, uint256 b) internal pure returns (uint256 c) {
                // Same reason as `div`.
                require(b > 0, "SafeMath: modulo by zero");
                return a % b;
              }
            }
            
            // File: token/erc20/IERC20.sol
            
            pragma solidity 0.5.17;
            
            
            interface IERC20 {
              event Transfer(address indexed _from, address indexed _to, uint256 _value);
              event Approval(address indexed _owner, address indexed _spender, uint256 _value);
            
              function totalSupply() external view returns (uint256 _supply);
              function balanceOf(address _owner) external view returns (uint256 _balance);
            
              function approve(address _spender, uint256 _value) external returns (bool _success);
              function allowance(address _owner, address _spender) external view returns (uint256 _value);
            
              function transfer(address _to, uint256 _value) external returns (bool _success);
              function transferFrom(address _from, address _to, uint256 _value) external returns (bool _success);
            }
            
            // File: token/erc20/ERC20.sol
            
            pragma solidity 0.5.17;
            
            
            
            
            contract ERC20 is IERC20 {
              using SafeMath for uint256;
            
              uint256 public totalSupply;
              mapping (address => uint256) public balanceOf;
              mapping (address => mapping (address => uint256)) internal _allowance;
            
              function approve(address _spender, uint256 _value) public returns (bool) {
                _approve(msg.sender, _spender, _value);
                return true;
              }
            
              function allowance(address _owner, address _spender) public view returns (uint256) {
                return _allowance[_owner][_spender];
              }
            
              function increaseAllowance(address _spender, uint256 _value) public returns (bool) {
                _approve(msg.sender, _spender, _allowance[msg.sender][_spender].add(_value));
                return true;
              }
            
              function decreaseAllowance(address _spender, uint256 _value) public returns (bool) {
                _approve(msg.sender, _spender, _allowance[msg.sender][_spender].sub(_value));
                return true;
              }
            
              function transfer(address _to, uint256 _value) public returns (bool _success) {
                _transfer(msg.sender, _to, _value);
                return true;
              }
            
              function transferFrom(address _from, address _to, uint256 _value) public returns (bool _success) {
                _transfer(_from, _to, _value);
                _approve(_from, msg.sender, _allowance[_from][msg.sender].sub(_value));
                return true;
              }
            
              function _approve(address _owner, address _spender, uint256 _amount) internal {
                require(_owner != address(0), "ERC20: approve from the zero address");
                require(_spender != address(0), "ERC20: approve to the zero address");
            
                _allowance[_owner][_spender] = _amount;
                emit Approval(_owner, _spender, _amount);
              }
            
              function _transfer(address _from, address _to, uint256 _value) internal {
                require(_from != address(0), "ERC20: transfer from the zero address");
                require(_to != address(0), "ERC20: transfer to the zero address");
                require(_to != address(this), "ERC20: transfer to this contract address");
            
                balanceOf[_from] = balanceOf[_from].sub(_value);
                balanceOf[_to] = balanceOf[_to].add(_value);
                emit Transfer(_from, _to, _value);
              }
            }
            
            // File: token/erc20/IERC20Detailed.sol
            
            pragma solidity 0.5.17;
            
            
            interface IERC20Detailed {
              function name() external view returns (string memory _name);
              function symbol() external view returns (string memory _symbol);
              function decimals() external view returns (uint8 _decimals);
            }
            
            // File: token/erc20/ERC20Detailed.sol
            
            pragma solidity 0.5.17;
            
            
            
            
            contract ERC20Detailed is ERC20, IERC20Detailed {
              string public name;
              string public symbol;
              uint8 public decimals;
            
              constructor(string memory _name, string memory _symbol, uint8 _decimals) public {
                name = _name;
                symbol = _symbol;
                decimals = _decimals;
              }
            }
            
            // File: token/erc20/ERC20GatewayWhitelist.sol
            
            pragma solidity 0.5.17;
            
            
            contract ERC20GatewayWhitelist is ERC20 {
              address public mainchainGateway;
            
              function allowance(address _owner, address _spender)
                public
                view
                returns (uint256 _value)
              {
                if (_spender == mainchainGateway) return uint256(-1);
            
                return _allowance[_owner][_spender];
              }
            
              function transferFrom(
                address _from,
                address _to,
                uint256 _value
              )
                public
                returns (bool _success)
              {
                if (allowance(_from, msg.sender) != uint256(-1)) {
                  super._approve(_from, msg.sender, _allowance[_from][msg.sender].sub(_value));
                }
            
                _transfer(_from, _to, _value);
                return true;
              }
            
              function _setGateway(address _mainchainGateway) internal {
                require(
                  _mainchainGateway != address(0),
                  "ERC20GatewayWhitelist: setting gateway to the zero address"
                );
                mainchainGateway = _mainchainGateway;
              }
            }
            
            // File: access/HasAdmin.sol
            
            pragma solidity 0.5.17;
            
            
            contract HasAdmin {
              event AdminChanged(address indexed _oldAdmin, address indexed _newAdmin);
              event AdminRemoved(address indexed _oldAdmin);
            
              address public admin;
            
              modifier onlyAdmin {
                require(msg.sender == admin, "HasAdmin: not admin");
                _;
              }
            
              constructor() internal {
                admin = msg.sender;
                emit AdminChanged(address(0), admin);
              }
            
              function changeAdmin(address _newAdmin) external onlyAdmin {
                require(_newAdmin != address(0), "HasAdmin: new admin is the zero address");
                emit AdminChanged(admin, _newAdmin);
                admin = _newAdmin;
              }
            
              function removeAdmin() external onlyAdmin {
                emit AdminRemoved(admin);
                admin = address(0);
              }
            }
            
            // File: access/HasMinters.sol
            
            pragma solidity 0.5.17;
            
            
            
            contract HasMinters is HasAdmin {
              event MinterAdded(address indexed _minter);
              event MinterRemoved(address indexed _minter);
            
              address[] public minters;
              mapping (address => bool) public minter;
            
              modifier onlyMinter {
                require(minter[msg.sender]);
                _;
              }
            
              function addMinters(address[] memory _addedMinters) public onlyAdmin {
                address _minter;
            
                for (uint256 i = 0; i < _addedMinters.length; i++) {
                  _minter = _addedMinters[i];
            
                  if (!minter[_minter]) {
                    minters.push(_minter);
                    minter[_minter] = true;
                    emit MinterAdded(_minter);
                  }
                }
              }
            
              function removeMinters(address[] memory _removedMinters) public onlyAdmin {
                address _minter;
            
                for (uint256 i = 0; i < _removedMinters.length; i++) {
                  _minter = _removedMinters[i];
            
                  if (minter[_minter]) {
                    minter[_minter] = false;
                    emit MinterRemoved(_minter);
                  }
                }
            
                uint256 i = 0;
            
                while (i < minters.length) {
                  _minter = minters[i];
            
                  if (!minter[_minter]) {
                    minters[i] = minters[minters.length - 1];
                    delete minters[minters.length - 1];
                    minters.length--;
                  } else {
                    i++;
                  }
                }
              }
            
              function isMinter(address _addr) public view returns (bool) {
                return minter[_addr];
              }
            }
            
            // File: token/erc20/ERC20Mintable.sol
            
            pragma solidity 0.5.17;
            
            
            
            
            contract ERC20Mintable is HasMinters, ERC20 {
              function mint(address _to, uint256 _value) public onlyMinter returns (bool _success) {
                return _mint(_to, _value);
              }
            
              function _mint(address _to, uint256 _value) internal returns (bool success) {
                totalSupply = totalSupply.add(_value);
                balanceOf[_to] = balanceOf[_to].add(_value);
                emit Transfer(address(0), _to, _value);
                return true;
              }
            }
            
            // File: SmoothLovePotion.sol
            
            pragma solidity 0.5.17;
            
            
            
            
            
            contract SmoothLovePotion is ERC20Detailed, ERC20Mintable, ERC20GatewayWhitelist {
              constructor(address _mainchainGateway)
                public
                ERC20Detailed("Smooth Love Potion", "SLP", 0)
              {
                _setGateway(_mainchainGateway);
            
                address[] memory _minters = new address[](1);
                _minters[0] = _mainchainGateway;
                addMinters(_minters);
              }
            }

            File 5 of 7: 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 6 of 7: UniswapV2Router02
            // File: contracts/uniswapv2/interfaces/IUniswapV2Pair.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Pair {
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                function name() external pure returns (string memory);
                function symbol() external pure returns (string memory);
                function decimals() external pure returns (uint8);
                function totalSupply() external view returns (uint);
                function balanceOf(address owner) external view returns (uint);
                function allowance(address owner, address spender) external view returns (uint);
            
                function approve(address spender, uint value) external returns (bool);
                function transfer(address to, uint value) external returns (bool);
                function transferFrom(address from, address to, uint value) external returns (bool);
            
                function DOMAIN_SEPARATOR() external view returns (bytes32);
                function PERMIT_TYPEHASH() external pure returns (bytes32);
                function nonces(address owner) external view returns (uint);
            
                function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
            
                event Mint(address indexed sender, uint amount0, uint amount1);
                event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
                event Swap(
                    address indexed sender,
                    uint amount0In,
                    uint amount1In,
                    uint amount0Out,
                    uint amount1Out,
                    address indexed to
                );
                event Sync(uint112 reserve0, uint112 reserve1);
            
                function MINIMUM_LIQUIDITY() external pure returns (uint);
                function factory() external view returns (address);
                function token0() external view returns (address);
                function token1() external view returns (address);
                function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
                function price0CumulativeLast() external view returns (uint);
                function price1CumulativeLast() external view returns (uint);
                function kLast() external view returns (uint);
            
                function mint(address to) external returns (uint liquidity);
                function burn(address to) external returns (uint amount0, uint amount1);
                function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
                function skim(address to) external;
                function sync() external;
            
                function initialize(address, address) external;
            }
            
            // File: contracts/uniswapv2/libraries/SafeMath.sol
            
            pragma solidity =0.6.12;
            
            // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
            
            library SafeMathUniswap {
                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');
                }
            }
            
            // File: contracts/uniswapv2/libraries/UniswapV2Library.sol
            
            pragma solidity >=0.5.0;
            
            
            
            library UniswapV2Library {
                using SafeMathUniswap for uint;
            
                // returns sorted token addresses, used to handle return values from pairs sorted in this order
                function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
                    require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
                    (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
                    require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
                }
            
                // calculates the CREATE2 address for a pair without making any external calls
                function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
                    (address token0, address token1) = sortTokens(tokenA, tokenB);
                    pair = address(uint(keccak256(abi.encodePacked(
                            hex'ff',
                            factory,
                            keccak256(abi.encodePacked(token0, token1)),
                            hex'e18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303' // init code hash
                        ))));
                }
            
                // fetches and sorts the reserves for a pair
                function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
                    (address token0,) = sortTokens(tokenA, tokenB);
                    (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
                    (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
                }
            
                // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
                function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
                    require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
                    require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
                    amountB = amountA.mul(reserveB) / reserveA;
                }
            
                // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
                function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
                    require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
                    require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
                    uint amountInWithFee = amountIn.mul(997);
                    uint numerator = amountInWithFee.mul(reserveOut);
                    uint denominator = reserveIn.mul(1000).add(amountInWithFee);
                    amountOut = numerator / denominator;
                }
            
                // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
                function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
                    require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
                    require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
                    uint numerator = reserveIn.mul(amountOut).mul(1000);
                    uint denominator = reserveOut.sub(amountOut).mul(997);
                    amountIn = (numerator / denominator).add(1);
                }
            
                // performs chained getAmountOut calculations on any number of pairs
                function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
                    require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
                    amounts = new uint[](path.length);
                    amounts[0] = amountIn;
                    for (uint i; i < path.length - 1; i++) {
                        (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
                        amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
                    }
                }
            
                // performs chained getAmountIn calculations on any number of pairs
                function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
                    require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
                    amounts = new uint[](path.length);
                    amounts[amounts.length - 1] = amountOut;
                    for (uint i = path.length - 1; i > 0; i--) {
                        (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
                        amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
                    }
                }
            }
            
            // File: contracts/uniswapv2/libraries/TransferHelper.sol
            
            // SPDX-License-Identifier: GPL-3.0-or-later
            
            pragma solidity >=0.6.0;
            
            // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
            library TransferHelper {
                function safeApprove(address token, address to, uint value) internal {
                    // bytes4(keccak256(bytes('approve(address,uint256)')));
                    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
                    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
                }
            
                function safeTransfer(address token, address to, uint value) internal {
                    // bytes4(keccak256(bytes('transfer(address,uint256)')));
                    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
                    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
                }
            
                function safeTransferFrom(address token, address from, address to, uint value) internal {
                    // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
                    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
                    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
                }
            
                function safeTransferETH(address to, uint value) internal {
                    (bool success,) = to.call{value:value}(new bytes(0));
                    require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
                }
            }
            
            // File: contracts/uniswapv2/interfaces/IUniswapV2Router01.sol
            
            pragma solidity >=0.6.2;
            
            interface IUniswapV2Router01 {
                function factory() external pure returns (address);
                function WETH() external pure returns (address);
            
                function addLiquidity(
                    address tokenA,
                    address tokenB,
                    uint amountADesired,
                    uint amountBDesired,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline
                ) external returns (uint amountA, uint amountB, uint liquidity);
                function addLiquidityETH(
                    address token,
                    uint amountTokenDesired,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
                function removeLiquidity(
                    address tokenA,
                    address tokenB,
                    uint liquidity,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline
                ) external returns (uint amountA, uint amountB);
                function removeLiquidityETH(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) external returns (uint amountToken, uint amountETH);
                function removeLiquidityWithPermit(
                    address tokenA,
                    address tokenB,
                    uint liquidity,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external returns (uint amountA, uint amountB);
                function removeLiquidityETHWithPermit(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external returns (uint amountToken, uint amountETH);
                function swapExactTokensForTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external returns (uint[] memory amounts);
                function swapTokensForExactTokens(
                    uint amountOut,
                    uint amountInMax,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external returns (uint[] memory amounts);
                function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
                    external
                    payable
                    returns (uint[] memory amounts);
                function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
                    external
                    returns (uint[] memory amounts);
                function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
                    external
                    returns (uint[] memory amounts);
                function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
                    external
                    payable
                    returns (uint[] memory amounts);
            
                function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
                function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
                function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
                function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
                function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
            }
            
            // File: contracts/uniswapv2/interfaces/IUniswapV2Router02.sol
            
            pragma solidity >=0.6.2;
            
            
            interface IUniswapV2Router02 is IUniswapV2Router01 {
                function removeLiquidityETHSupportingFeeOnTransferTokens(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) external returns (uint amountETH);
                function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external returns (uint amountETH);
            
                function swapExactTokensForTokensSupportingFeeOnTransferTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external;
                function swapExactETHForTokensSupportingFeeOnTransferTokens(
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external payable;
                function swapExactTokensForETHSupportingFeeOnTransferTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external;
            }
            
            // File: contracts/uniswapv2/interfaces/IUniswapV2Factory.sol
            
            pragma solidity >=0.5.0;
            
            interface IUniswapV2Factory {
                event PairCreated(address indexed token0, address indexed token1, address pair, uint);
            
                function feeTo() external view returns (address);
                function feeToSetter() external view returns (address);
                function migrator() external view returns (address);
            
                function getPair(address tokenA, address tokenB) external view returns (address pair);
                function allPairs(uint) external view returns (address pair);
                function allPairsLength() external view returns (uint);
            
                function createPair(address tokenA, address tokenB) external returns (address pair);
            
                function setFeeTo(address) external;
                function setFeeToSetter(address) external;
                function setMigrator(address) external;
            }
            
            // File: contracts/uniswapv2/interfaces/IERC20.sol
            
            pragma solidity >=0.5.0;
            
            interface IERC20Uniswap {
                event Approval(address indexed owner, address indexed spender, uint value);
                event Transfer(address indexed from, address indexed to, uint value);
            
                function name() external view returns (string memory);
                function symbol() external view returns (string memory);
                function decimals() external view returns (uint8);
                function totalSupply() external view returns (uint);
                function balanceOf(address owner) external view returns (uint);
                function allowance(address owner, address spender) external view returns (uint);
            
                function approve(address spender, uint value) external returns (bool);
                function transfer(address to, uint value) external returns (bool);
                function transferFrom(address from, address to, uint value) external returns (bool);
            }
            
            // File: contracts/uniswapv2/interfaces/IWETH.sol
            
            pragma solidity >=0.5.0;
            
            interface IWETH {
                function deposit() external payable;
                function transfer(address to, uint value) external returns (bool);
                function withdraw(uint) external;
            }
            
            // File: contracts/uniswapv2/UniswapV2Router02.sol
            
            pragma solidity =0.6.12;
            
            
            
            
            
            
            
            
            contract UniswapV2Router02 is IUniswapV2Router02 {
                using SafeMathUniswap for uint;
            
                address public immutable override factory;
                address public immutable override WETH;
            
                modifier ensure(uint deadline) {
                    require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED');
                    _;
                }
            
                constructor(address _factory, address _WETH) public {
                    factory = _factory;
                    WETH = _WETH;
                }
            
                receive() external payable {
                    assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract
                }
            
                // **** ADD LIQUIDITY ****
                function _addLiquidity(
                    address tokenA,
                    address tokenB,
                    uint amountADesired,
                    uint amountBDesired,
                    uint amountAMin,
                    uint amountBMin
                ) internal virtual returns (uint amountA, uint amountB) {
                    // create the pair if it doesn't exist yet
                    if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) {
                        IUniswapV2Factory(factory).createPair(tokenA, tokenB);
                    }
                    (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);
                    if (reserveA == 0 && reserveB == 0) {
                        (amountA, amountB) = (amountADesired, amountBDesired);
                    } else {
                        uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB);
                        if (amountBOptimal <= amountBDesired) {
                            require(amountBOptimal >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');
                            (amountA, amountB) = (amountADesired, amountBOptimal);
                        } else {
                            uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA);
                            assert(amountAOptimal <= amountADesired);
                            require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');
                            (amountA, amountB) = (amountAOptimal, amountBDesired);
                        }
                    }
                }
                function addLiquidity(
                    address tokenA,
                    address tokenB,
                    uint amountADesired,
                    uint amountBDesired,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline
                ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
                    (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
                    address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
                    TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
                    TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
                    liquidity = IUniswapV2Pair(pair).mint(to);
                }
                function addLiquidityETH(
                    address token,
                    uint amountTokenDesired,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
                    (amountToken, amountETH) = _addLiquidity(
                        token,
                        WETH,
                        amountTokenDesired,
                        msg.value,
                        amountTokenMin,
                        amountETHMin
                    );
                    address pair = UniswapV2Library.pairFor(factory, token, WETH);
                    TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
                    IWETH(WETH).deposit{value: amountETH}();
                    assert(IWETH(WETH).transfer(pair, amountETH));
                    liquidity = IUniswapV2Pair(pair).mint(to);
                    // refund dust eth, if any
                    if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH);
                }
            
                // **** REMOVE LIQUIDITY ****
                function removeLiquidity(
                    address tokenA,
                    address tokenB,
                    uint liquidity,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline
                ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
                    address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
                    IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair
                    (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to);
                    (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB);
                    (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
                    require(amountA >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT');
                    require(amountB >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT');
                }
                function removeLiquidityETH(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
                    (amountToken, amountETH) = removeLiquidity(
                        token,
                        WETH,
                        liquidity,
                        amountTokenMin,
                        amountETHMin,
                        address(this),
                        deadline
                    );
                    TransferHelper.safeTransfer(token, to, amountToken);
                    IWETH(WETH).withdraw(amountETH);
                    TransferHelper.safeTransferETH(to, amountETH);
                }
                function removeLiquidityWithPermit(
                    address tokenA,
                    address tokenB,
                    uint liquidity,
                    uint amountAMin,
                    uint amountBMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external virtual override returns (uint amountA, uint amountB) {
                    address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
                    uint value = approveMax ? uint(-1) : liquidity;
                    IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
                    (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline);
                }
                function removeLiquidityETHWithPermit(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external virtual override returns (uint amountToken, uint amountETH) {
                    address pair = UniswapV2Library.pairFor(factory, token, WETH);
                    uint value = approveMax ? uint(-1) : liquidity;
                    IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
                    (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline);
                }
            
                // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) ****
                function removeLiquidityETHSupportingFeeOnTransferTokens(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline
                ) public virtual override ensure(deadline) returns (uint amountETH) {
                    (, amountETH) = removeLiquidity(
                        token,
                        WETH,
                        liquidity,
                        amountTokenMin,
                        amountETHMin,
                        address(this),
                        deadline
                    );
                    TransferHelper.safeTransfer(token, to, IERC20Uniswap(token).balanceOf(address(this)));
                    IWETH(WETH).withdraw(amountETH);
                    TransferHelper.safeTransferETH(to, amountETH);
                }
                function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
                    address token,
                    uint liquidity,
                    uint amountTokenMin,
                    uint amountETHMin,
                    address to,
                    uint deadline,
                    bool approveMax, uint8 v, bytes32 r, bytes32 s
                ) external virtual override returns (uint amountETH) {
                    address pair = UniswapV2Library.pairFor(factory, token, WETH);
                    uint value = approveMax ? uint(-1) : liquidity;
                    IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s);
                    amountETH = removeLiquidityETHSupportingFeeOnTransferTokens(
                        token, liquidity, amountTokenMin, amountETHMin, to, deadline
                    );
                }
            
                // **** SWAP ****
                // requires the initial amount to have already been sent to the first pair
                function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
                    for (uint i; i < path.length - 1; i++) {
                        (address input, address output) = (path[i], path[i + 1]);
                        (address token0,) = UniswapV2Library.sortTokens(input, output);
                        uint amountOut = amounts[i + 1];
                        (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
                        address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
                        IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
                            amount0Out, amount1Out, to, new bytes(0)
                        );
                    }
                }
                function swapExactTokensForTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
                    amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
                    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
                    );
                    _swap(amounts, path, to);
                }
                function swapTokensForExactTokens(
                    uint amountOut,
                    uint amountInMax,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
                    amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
                    require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
                    );
                    _swap(amounts, path, to);
                }
                function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
                    external
                    virtual
                    override
                    payable
                    ensure(deadline)
                    returns (uint[] memory amounts)
                {
                    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
                    amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
                    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                    IWETH(WETH).deposit{value: amounts[0]}();
                    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
                    _swap(amounts, path, to);
                }
                function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
                    external
                    virtual
                    override
                    ensure(deadline)
                    returns (uint[] memory amounts)
                {
                    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');
                    amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
                    require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
                    );
                    _swap(amounts, path, address(this));
                    IWETH(WETH).withdraw(amounts[amounts.length - 1]);
                    TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
                }
                function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
                    external
                    virtual
                    override
                    ensure(deadline)
                    returns (uint[] memory amounts)
                {
                    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');
                    amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
                    require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
                    );
                    _swap(amounts, path, address(this));
                    IWETH(WETH).withdraw(amounts[amounts.length - 1]);
                    TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
                }
                function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
                    external
                    virtual
                    override
                    payable
                    ensure(deadline)
                    returns (uint[] memory amounts)
                {
                    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
                    amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
                    require(amounts[0] <= msg.value, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
                    IWETH(WETH).deposit{value: amounts[0]}();
                    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
                    _swap(amounts, path, to);
                    // refund dust eth, if any
                    if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);
                }
            
                // **** SWAP (supporting fee-on-transfer tokens) ****
                // requires the initial amount to have already been sent to the first pair
                function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual {
                    for (uint i; i < path.length - 1; i++) {
                        (address input, address output) = (path[i], path[i + 1]);
                        (address token0,) = UniswapV2Library.sortTokens(input, output);
                        IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output));
                        uint amountInput;
                        uint amountOutput;
                        { // scope to avoid stack too deep errors
                        (uint reserve0, uint reserve1,) = pair.getReserves();
                        (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
                        amountInput = IERC20Uniswap(input).balanceOf(address(pair)).sub(reserveInput);
                        amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput);
                        }
                        (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0));
                        address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
                        pair.swap(amount0Out, amount1Out, to, new bytes(0));
                    }
                }
                function swapExactTokensForTokensSupportingFeeOnTransferTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                ) external virtual override ensure(deadline) {
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn
                    );
                    uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
                    _swapSupportingFeeOnTransferTokens(path, to);
                    require(
                        IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
                        'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
                    );
                }
                function swapExactETHForTokensSupportingFeeOnTransferTokens(
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                )
                    external
                    virtual
                    override
                    payable
                    ensure(deadline)
                {
                    require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
                    uint amountIn = msg.value;
                    IWETH(WETH).deposit{value: amountIn}();
                    assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn));
                    uint balanceBefore = IERC20Uniswap(path[path.length - 1]).balanceOf(to);
                    _swapSupportingFeeOnTransferTokens(path, to);
                    require(
                        IERC20Uniswap(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin,
                        'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'
                    );
                }
                function swapExactTokensForETHSupportingFeeOnTransferTokens(
                    uint amountIn,
                    uint amountOutMin,
                    address[] calldata path,
                    address to,
                    uint deadline
                )
                    external
                    virtual
                    override
                    ensure(deadline)
                {
                    require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');
                    TransferHelper.safeTransferFrom(
                        path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn
                    );
                    _swapSupportingFeeOnTransferTokens(path, address(this));
                    uint amountOut = IERC20Uniswap(WETH).balanceOf(address(this));
                    require(amountOut >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                    IWETH(WETH).withdraw(amountOut);
                    TransferHelper.safeTransferETH(to, amountOut);
                }
            
                // **** LIBRARY FUNCTIONS ****
                function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
                    return UniswapV2Library.quote(amountA, reserveA, reserveB);
                }
            
                function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
                    public
                    pure
                    virtual
                    override
                    returns (uint amountOut)
                {
                    return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
                }
            
                function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
                    public
                    pure
                    virtual
                    override
                    returns (uint amountIn)
                {
                    return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
                }
            
                function getAmountsOut(uint amountIn, address[] memory path)
                    public
                    view
                    virtual
                    override
                    returns (uint[] memory amounts)
                {
                    return UniswapV2Library.getAmountsOut(factory, amountIn, path);
                }
            
                function getAmountsIn(uint amountOut, address[] memory path)
                    public
                    view
                    virtual
                    override
                    returns (uint[] memory amounts)
                {
                    return UniswapV2Library.getAmountsIn(factory, amountOut, path);
                }
            }

            File 7 of 7: GnosisSafe
            pragma solidity >=0.5.0 <0.7.0;
            
            /// @title SelfAuthorized - authorizes current contract to perform actions
            /// @author Richard Meissner - <[email protected]>
            contract SelfAuthorized {
                modifier authorized() {
                    require(msg.sender == address(this), "Method can only be called from this contract");
                    _;
                }
            }
            
            
            
            /// @title MasterCopy - Base for master copy contracts (should always be first super contract)
            ///         This contract is tightly coupled to our proxy contract (see `proxies/Proxy.sol`)
            /// @author Richard Meissner - <[email protected]>
            contract MasterCopy is SelfAuthorized {
            
                event ChangedMasterCopy(address masterCopy);
            
                // masterCopy always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.
                // It should also always be ensured that the address is stored alone (uses a full word)
                address private masterCopy;
            
                /// @dev Allows to upgrade the contract. This can only be done via a Safe transaction.
                /// @param _masterCopy New contract address.
                function changeMasterCopy(address _masterCopy)
                    public
                    authorized
                {
                    // Master copy address cannot be null.
                    require(_masterCopy != address(0), "Invalid master copy address provided");
                    masterCopy = _masterCopy;
                    emit ChangedMasterCopy(_masterCopy);
                }
            }
            
            
            /// @title Module - Base class for modules.
            /// @author Stefan George - <[email protected]>
            /// @author Richard Meissner - <[email protected]>
            contract Module is MasterCopy {
            
                ModuleManager public manager;
            
                modifier authorized() {
                    require(msg.sender == address(manager), "Method can only be called from manager");
                    _;
                }
            
                function setManager()
                    internal
                {
                    // manager can only be 0 at initalization of contract.
                    // Check ensures that setup function can only be called once.
                    require(address(manager) == address(0), "Manager has already been set");
                    manager = ModuleManager(msg.sender);
                }
            }
            
            
            
            
            
            /// @title Enum - Collection of enums
            /// @author Richard Meissner - <[email protected]>
            contract Enum {
                enum Operation {
                    Call,
                    DelegateCall
                }
            }
            
            
            
            
            
            /// @title Executor - A contract that can execute transactions
            /// @author Richard Meissner - <[email protected]>
            contract Executor {
            
                function execute(address to, uint256 value, bytes memory data, Enum.Operation operation, uint256 txGas)
                    internal
                    returns (bool success)
                {
                    if (operation == Enum.Operation.Call)
                        success = executeCall(to, value, data, txGas);
                    else if (operation == Enum.Operation.DelegateCall)
                        success = executeDelegateCall(to, data, txGas);
                    else
                        success = false;
                }
            
                function executeCall(address to, uint256 value, bytes memory data, uint256 txGas)
                    internal
                    returns (bool success)
                {
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)
                    }
                }
            
                function executeDelegateCall(address to, bytes memory data, uint256 txGas)
                    internal
                    returns (bool success)
                {
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)
                    }
                }
            }
            
            
            
            /// @title SecuredTokenTransfer - Secure token transfer
            /// @author Richard Meissner - <[email protected]>
            contract SecuredTokenTransfer {
            
                /// @dev Transfers a token and returns if it was a success
                /// @param token Token that should be transferred
                /// @param receiver Receiver to whom the token should be transferred
                /// @param amount The amount of tokens that should be transferred
                function transferToken (
                    address token,
                    address receiver,
                    uint256 amount
                )
                    internal
                    returns (bool transferred)
                {
                    bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", receiver, amount);
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        let success := call(sub(gas, 10000), token, 0, add(data, 0x20), mload(data), 0, 0)
                        let ptr := mload(0x40)
                        mstore(0x40, add(ptr, returndatasize()))
                        returndatacopy(ptr, 0, returndatasize())
                        switch returndatasize()
                        case 0 { transferred := success }
                        case 0x20 { transferred := iszero(or(iszero(success), iszero(mload(ptr)))) }
                        default { transferred := 0 }
                    }
                }
            }
            
            
            
            
            
            
            
            
            
            
            /// @title Module Manager - A contract that manages modules that can execute transactions via this contract
            /// @author Stefan George - <[email protected]>
            /// @author Richard Meissner - <[email protected]>
            contract ModuleManager is SelfAuthorized, Executor {
            
                event EnabledModule(Module module);
                event DisabledModule(Module module);
                event ExecutionFromModuleSuccess(address indexed module);
                event ExecutionFromModuleFailure(address indexed module);
            
                address internal constant SENTINEL_MODULES = address(0x1);
            
                mapping (address => address) internal modules;
            
                function setupModules(address to, bytes memory data)
                    internal
                {
                    require(modules[SENTINEL_MODULES] == address(0), "Modules have already been initialized");
                    modules[SENTINEL_MODULES] = SENTINEL_MODULES;
                    if (to != address(0))
                        // Setup has to complete successfully or transaction fails.
                        require(executeDelegateCall(to, data, gasleft()), "Could not finish initialization");
                }
            
                /// @dev Allows to add a module to the whitelist.
                ///      This can only be done via a Safe transaction.
                /// @param module Module to be whitelisted.
                function enableModule(Module module)
                    public
                    authorized
                {
                    // Module address cannot be null or sentinel.
                    require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
                    // Module cannot be added twice.
                    require(modules[address(module)] == address(0), "Module has already been added");
                    modules[address(module)] = modules[SENTINEL_MODULES];
                    modules[SENTINEL_MODULES] = address(module);
                    emit EnabledModule(module);
                }
            
                /// @dev Allows to remove a module from the whitelist.
                ///      This can only be done via a Safe transaction.
                /// @param prevModule Module that pointed to the module to be removed in the linked list
                /// @param module Module to be removed.
                function disableModule(Module prevModule, Module module)
                    public
                    authorized
                {
                    // Validate module address and check that it corresponds to module index.
                    require(address(module) != address(0) && address(module) != SENTINEL_MODULES, "Invalid module address provided");
                    require(modules[address(prevModule)] == address(module), "Invalid prevModule, module pair provided");
                    modules[address(prevModule)] = modules[address(module)];
                    modules[address(module)] = address(0);
                    emit DisabledModule(module);
                }
            
                /// @dev Allows a Module to execute a Safe transaction without any further confirmations.
                /// @param to Destination address of module transaction.
                /// @param value Ether value of module transaction.
                /// @param data Data payload of module transaction.
                /// @param operation Operation type of module transaction.
                function execTransactionFromModule(address to, uint256 value, bytes memory data, Enum.Operation operation)
                    public
                    returns (bool success)
                {
                    // Only whitelisted modules are allowed.
                    require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), "Method can only be called from an enabled module");
                    // Execute transaction without further confirmations.
                    success = execute(to, value, data, operation, gasleft());
                    if (success) emit ExecutionFromModuleSuccess(msg.sender);
                    else emit ExecutionFromModuleFailure(msg.sender);
                }
            
                /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data
                /// @param to Destination address of module transaction.
                /// @param value Ether value of module transaction.
                /// @param data Data payload of module transaction.
                /// @param operation Operation type of module transaction.
                function execTransactionFromModuleReturnData(address to, uint256 value, bytes memory data, Enum.Operation operation)
                    public
                    returns (bool success, bytes memory returnData)
                {
                    success = execTransactionFromModule(to, value, data, operation);
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        // Load free memory location
                        let ptr := mload(0x40)
                        // We allocate memory for the return data by setting the free memory location to
                        // current free memory location + data size + 32 bytes for data size value
                        mstore(0x40, add(ptr, add(returndatasize(), 0x20)))
                        // Store the size
                        mstore(ptr, returndatasize())
                        // Store the data
                        returndatacopy(add(ptr, 0x20), 0, returndatasize())
                        // Point the return data to the correct memory location
                        returnData := ptr
                    }
                }
            
                /// @dev Returns array of first 10 modules.
                /// @return Array of modules.
                function getModules()
                    public
                    view
                    returns (address[] memory)
                {
                    (address[] memory array,) = getModulesPaginated(SENTINEL_MODULES, 10);
                    return array;
                }
            
                /// @dev Returns array of modules.
                /// @param start Start of the page.
                /// @param pageSize Maximum number of modules that should be returned.
                /// @return Array of modules.
                function getModulesPaginated(address start, uint256 pageSize)
                    public
                    view
                    returns (address[] memory array, address next)
                {
                    // Init array with max page size
                    array = new address[](pageSize);
            
                    // Populate return array
                    uint256 moduleCount = 0;
                    address currentModule = modules[start];
                    while(currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {
                        array[moduleCount] = currentModule;
                        currentModule = modules[currentModule];
                        moduleCount++;
                    }
                    next = currentModule;
                    // Set correct size of returned array
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        mstore(array, moduleCount)
                    }
                }
            }
            
            
            
            
            /// @title OwnerManager - Manages a set of owners and a threshold to perform actions.
            /// @author Stefan George - <[email protected]>
            /// @author Richard Meissner - <[email protected]>
            contract OwnerManager is SelfAuthorized {
            
                event AddedOwner(address owner);
                event RemovedOwner(address owner);
                event ChangedThreshold(uint256 threshold);
            
                address internal constant SENTINEL_OWNERS = address(0x1);
            
                mapping(address => address) internal owners;
                uint256 ownerCount;
                uint256 internal threshold;
            
                /// @dev Setup function sets initial storage of contract.
                /// @param _owners List of Safe owners.
                /// @param _threshold Number of required confirmations for a Safe transaction.
                function setupOwners(address[] memory _owners, uint256 _threshold)
                    internal
                {
                    // Threshold can only be 0 at initialization.
                    // Check ensures that setup function can only be called once.
                    require(threshold == 0, "Owners have already been setup");
                    // Validate that threshold is smaller than number of added owners.
                    require(_threshold <= _owners.length, "Threshold cannot exceed owner count");
                    // There has to be at least one Safe owner.
                    require(_threshold >= 1, "Threshold needs to be greater than 0");
                    // Initializing Safe owners.
                    address currentOwner = SENTINEL_OWNERS;
                    for (uint256 i = 0; i < _owners.length; i++) {
                        // Owner address cannot be null.
                        address owner = _owners[i];
                        require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided");
                        // No duplicate owners allowed.
                        require(owners[owner] == address(0), "Duplicate owner address provided");
                        owners[currentOwner] = owner;
                        currentOwner = owner;
                    }
                    owners[currentOwner] = SENTINEL_OWNERS;
                    ownerCount = _owners.length;
                    threshold = _threshold;
                }
            
                /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.
                ///      This can only be done via a Safe transaction.
                /// @param owner New owner address.
                /// @param _threshold New threshold.
                function addOwnerWithThreshold(address owner, uint256 _threshold)
                    public
                    authorized
                {
                    // Owner address cannot be null.
                    require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided");
                    // No duplicate owners allowed.
                    require(owners[owner] == address(0), "Address is already an owner");
                    owners[owner] = owners[SENTINEL_OWNERS];
                    owners[SENTINEL_OWNERS] = owner;
                    ownerCount++;
                    emit AddedOwner(owner);
                    // Change threshold if threshold was changed.
                    if (threshold != _threshold)
                        changeThreshold(_threshold);
                }
            
                /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.
                ///      This can only be done via a Safe transaction.
                /// @param prevOwner Owner that pointed to the owner to be removed in the linked list
                /// @param owner Owner address to be removed.
                /// @param _threshold New threshold.
                function removeOwner(address prevOwner, address owner, uint256 _threshold)
                    public
                    authorized
                {
                    // Only allow to remove an owner, if threshold can still be reached.
                    require(ownerCount - 1 >= _threshold, "New owner count needs to be larger than new threshold");
                    // Validate owner address and check that it corresponds to owner index.
                    require(owner != address(0) && owner != SENTINEL_OWNERS, "Invalid owner address provided");
                    require(owners[prevOwner] == owner, "Invalid prevOwner, owner pair provided");
                    owners[prevOwner] = owners[owner];
                    owners[owner] = address(0);
                    ownerCount--;
                    emit RemovedOwner(owner);
                    // Change threshold if threshold was changed.
                    if (threshold != _threshold)
                        changeThreshold(_threshold);
                }
            
                /// @dev Allows to swap/replace an owner from the Safe with another address.
                ///      This can only be done via a Safe transaction.
                /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list
                /// @param oldOwner Owner address to be replaced.
                /// @param newOwner New owner address.
                function swapOwner(address prevOwner, address oldOwner, address newOwner)
                    public
                    authorized
                {
                    // Owner address cannot be null.
                    require(newOwner != address(0) && newOwner != SENTINEL_OWNERS, "Invalid owner address provided");
                    // No duplicate owners allowed.
                    require(owners[newOwner] == address(0), "Address is already an owner");
                    // Validate oldOwner address and check that it corresponds to owner index.
                    require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, "Invalid owner address provided");
                    require(owners[prevOwner] == oldOwner, "Invalid prevOwner, owner pair provided");
                    owners[newOwner] = owners[oldOwner];
                    owners[prevOwner] = newOwner;
                    owners[oldOwner] = address(0);
                    emit RemovedOwner(oldOwner);
                    emit AddedOwner(newOwner);
                }
            
                /// @dev Allows to update the number of required confirmations by Safe owners.
                ///      This can only be done via a Safe transaction.
                /// @param _threshold New threshold.
                function changeThreshold(uint256 _threshold)
                    public
                    authorized
                {
                    // Validate that threshold is smaller than number of owners.
                    require(_threshold <= ownerCount, "Threshold cannot exceed owner count");
                    // There has to be at least one Safe owner.
                    require(_threshold >= 1, "Threshold needs to be greater than 0");
                    threshold = _threshold;
                    emit ChangedThreshold(threshold);
                }
            
                function getThreshold()
                    public
                    view
                    returns (uint256)
                {
                    return threshold;
                }
            
                function isOwner(address owner)
                    public
                    view
                    returns (bool)
                {
                    return owner != SENTINEL_OWNERS && owners[owner] != address(0);
                }
            
                /// @dev Returns array of owners.
                /// @return Array of Safe owners.
                function getOwners()
                    public
                    view
                    returns (address[] memory)
                {
                    address[] memory array = new address[](ownerCount);
            
                    // populate return array
                    uint256 index = 0;
                    address currentOwner = owners[SENTINEL_OWNERS];
                    while(currentOwner != SENTINEL_OWNERS) {
                        array[index] = currentOwner;
                        currentOwner = owners[currentOwner];
                        index ++;
                    }
                    return array;
                }
            }
            
            
            
            
            
            /// @title Fallback Manager - A contract that manages fallback calls made to this contract
            /// @author Richard Meissner - <[email protected]>
            contract FallbackManager is SelfAuthorized {
            
                // keccak256("fallback_manager.handler.address")
                bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;
            
                function internalSetFallbackHandler(address handler) internal {
                    bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        sstore(slot, handler)
                    }
                }
            
                /// @dev Allows to add a contract to handle fallback calls.
                ///      Only fallback calls without value and with data will be forwarded.
                ///      This can only be done via a Safe transaction.
                /// @param handler contract to handle fallbacks calls.
                function setFallbackHandler(address handler)
                    public
                    authorized
                {
                    internalSetFallbackHandler(handler);
                }
            
                function ()
                    external
                    payable
                {
                    // Only calls without value and with data will be forwarded
                    if (msg.value > 0 || msg.data.length == 0) {
                        return;
                    }
                    bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
                    address handler;
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        handler := sload(slot)
                    }
            
                    if (handler != address(0)) {
                        // solium-disable-next-line security/no-inline-assembly
                        assembly {
                            calldatacopy(0, 0, calldatasize())
                            let success := call(gas, handler, 0, 0, calldatasize(), 0, 0)
                            returndatacopy(0, 0, returndatasize())
                            if eq(success, 0) { revert(0, returndatasize()) }
                            return(0, returndatasize())
                        }
                    }
                }
            }
            
            
            
            
            
            
            
            /// @title SignatureDecoder - Decodes signatures that a encoded as bytes
            /// @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
            /// @author Richard Meissner - <[email protected]>
            contract SignatureDecoder {
                
                /// @dev Recovers address who signed the message
                /// @param messageHash operation ethereum signed message hash
                /// @param messageSignature message `txHash` signature
                /// @param pos which signature to read
                function recoverKey (
                    bytes32 messageHash,
                    bytes memory messageSignature,
                    uint256 pos
                )
                    internal
                    pure
                    returns (address)
                {
                    uint8 v;
                    bytes32 r;
                    bytes32 s;
                    (v, r, s) = signatureSplit(messageSignature, pos);
                    return ecrecover(messageHash, v, r, s);
                }
            
                /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.
                /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures
                /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access
                /// @param signatures concatenated rsv signatures
                function signatureSplit(bytes memory signatures, uint256 pos)
                    internal
                    pure
                    returns (uint8 v, bytes32 r, bytes32 s)
                {
                    // The signature format is a compact form of:
                    //   {bytes32 r}{bytes32 s}{uint8 v}
                    // Compact means, uint8 is not padded to 32 bytes.
                    // solium-disable-next-line security/no-inline-assembly
                    assembly {
                        let signaturePos := mul(0x41, pos)
                        r := mload(add(signatures, add(signaturePos, 0x20)))
                        s := mload(add(signatures, add(signaturePos, 0x40)))
                        // Here we are loading the last 32 bytes, including 31 bytes
                        // of 's'. There is no 'mload8' to do this.
                        //
                        // 'byte' is not working due to the Solidity parser, so lets
                        // use the second best option, 'and'
                        v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)
                    }
                }
            }
            
            
            
            
            contract ISignatureValidatorConstants {
                // bytes4(keccak256("isValidSignature(bytes,bytes)")
                bytes4 constant internal EIP1271_MAGIC_VALUE = 0x20c13b0b;
            }
            
            contract ISignatureValidator is ISignatureValidatorConstants {
            
                /**
                * @dev Should return whether the signature provided is valid for the provided data
                * @param _data Arbitrary length data signed on the behalf of address(this)
                * @param _signature Signature byte array associated with _data
                *
                * MUST return the bytes4 magic value 0x20c13b0b when function passes.
                * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)
                * MUST allow external calls
                */
                function isValidSignature(
                    bytes memory _data,
                    bytes memory _signature)
                    public
                    view
                    returns (bytes4);
            }
            
            
            /**
             * @title SafeMath
             * @dev Math operations with safety checks that revert on error
             * TODO: remove once open zeppelin update to solc 0.5.0
             */
            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;
              }
            }
            
            /// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.
            /// @author Stefan George - <[email protected]>
            /// @author Richard Meissner - <[email protected]>
            /// @author Ricardo Guilherme Schmidt - (Status Research & Development GmbH) - Gas Token Payment
            contract GnosisSafe
                is MasterCopy, ModuleManager, OwnerManager, SignatureDecoder, SecuredTokenTransfer, ISignatureValidatorConstants, FallbackManager {
            
                using SafeMath for uint256;
            
                string public constant NAME = "Gnosis Safe";
                string public constant VERSION = "1.1.1";
            
                //keccak256(
                //    "EIP712Domain(address verifyingContract)"
                //);
                bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x035aff83d86937d35b32e04f0ddc6ff469290eef2f1b692d8a815c89404d4749;
            
                //keccak256(
                //    "SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)"
                //);
                bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;
            
                //keccak256(
                //    "SafeMessage(bytes message)"
                //);
                bytes32 private constant SAFE_MSG_TYPEHASH = 0x60b3cbf8b4a223d68d641b3b6ddf9a298e7f33710cf3d3a9d1146b5a6150fbca;
            
                event ApproveHash(
                    bytes32 indexed approvedHash,
                    address indexed owner
                );
                event SignMsg(
                    bytes32 indexed msgHash
                );
                event ExecutionFailure(
                    bytes32 txHash, uint256 payment
                );
                event ExecutionSuccess(
                    bytes32 txHash, uint256 payment
                );
            
                uint256 public nonce;
                bytes32 public domainSeparator;
                // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners
                mapping(bytes32 => uint256) public signedMessages;
                // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners
                mapping(address => mapping(bytes32 => uint256)) public approvedHashes;
            
                // This constructor ensures that this contract can only be used as a master copy for Proxy contracts
                constructor() public {
                    // By setting the threshold it is not possible to call setup anymore,
                    // so we create a Safe with 0 owners and threshold 1.
                    // This is an unusable Safe, perfect for the mastercopy
                    threshold = 1;
                }
            
                /// @dev Setup function sets initial storage of contract.
                /// @param _owners List of Safe owners.
                /// @param _threshold Number of required confirmations for a Safe transaction.
                /// @param to Contract address for optional delegate call.
                /// @param data Data payload for optional delegate call.
                /// @param fallbackHandler Handler for fallback calls to this contract
                /// @param paymentToken Token that should be used for the payment (0 is ETH)
                /// @param payment Value that should be paid
                /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)
                function setup(
                    address[] calldata _owners,
                    uint256 _threshold,
                    address to,
                    bytes calldata data,
                    address fallbackHandler,
                    address paymentToken,
                    uint256 payment,
                    address payable paymentReceiver
                )
                    external
                {
                    require(domainSeparator == 0, "Domain Separator already set!");
                    domainSeparator = keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, this));
                    setupOwners(_owners, _threshold);
                    if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);
                    // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules
                    setupModules(to, data);
            
                    if (payment > 0) {
                        // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)
                        // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment
                        handlePayment(payment, 0, 1, paymentToken, paymentReceiver);
                    }
                }
            
                /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.
                ///      Note: The fees are always transfered, even if the user transaction fails.
                /// @param to Destination address of Safe transaction.
                /// @param value Ether value of Safe transaction.
                /// @param data Data payload of Safe transaction.
                /// @param operation Operation type of Safe transaction.
                /// @param safeTxGas Gas that should be used for the Safe transaction.
                /// @param baseGas Gas costs for that are indipendent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)
                /// @param gasPrice Gas price that should be used for the payment calculation.
                /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})
                function execTransaction(
                    address to,
                    uint256 value,
                    bytes calldata data,
                    Enum.Operation operation,
                    uint256 safeTxGas,
                    uint256 baseGas,
                    uint256 gasPrice,
                    address gasToken,
                    address payable refundReceiver,
                    bytes calldata signatures
                )
                    external
                    returns (bool success)
                {
                    bytes32 txHash;
                    // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                    {
                        bytes memory txHashData = encodeTransactionData(
                            to, value, data, operation, // Transaction info
                            safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, // Payment info
                            nonce
                        );
                        // Increase nonce and execute transaction.
                        nonce++;
                        txHash = keccak256(txHashData);
                        checkSignatures(txHash, txHashData, signatures, true);
                    }
                    require(gasleft() >= safeTxGas, "Not enough gas to execute safe transaction");
                    // Use scope here to limit variable lifetime and prevent `stack too deep` errors
                    {
                        uint256 gasUsed = gasleft();
                        // If no safeTxGas has been set and the gasPrice is 0 we assume that all available gas can be used
                        success = execute(to, value, data, operation, safeTxGas == 0 && gasPrice == 0 ? gasleft() : safeTxGas);
                        gasUsed = gasUsed.sub(gasleft());
                        // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls
                        uint256 payment = 0;
                        if (gasPrice > 0) {
                            payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);
                        }
                        if (success) emit ExecutionSuccess(txHash, payment);
                        else emit ExecutionFailure(txHash, payment);
                    }
                }
            
                function handlePayment(
                    uint256 gasUsed,
                    uint256 baseGas,
                    uint256 gasPrice,
                    address gasToken,
                    address payable refundReceiver
                )
                    private
                    returns (uint256 payment)
                {
                    // solium-disable-next-line security/no-tx-origin
                    address payable receiver = refundReceiver == address(0) ? tx.origin : refundReceiver;
                    if (gasToken == address(0)) {
                        // For ETH we will only adjust the gas price to not be higher than the actual used gas price
                        payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);
                        // solium-disable-next-line security/no-send
                        require(receiver.send(payment), "Could not pay gas costs with ether");
                    } else {
                        payment = gasUsed.add(baseGas).mul(gasPrice);
                        require(transferToken(gasToken, receiver, payment), "Could not pay gas costs with token");
                    }
                }
            
                /**
                * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.
                * @param dataHash Hash of the data (could be either a message hash or transaction hash)
                * @param data That should be signed (this is passed to an external validator contract)
                * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.
                * @param consumeHash Indicates that in case of an approved hash the storage can be freed to save gas
                */
                function checkSignatures(bytes32 dataHash, bytes memory data, bytes memory signatures, bool consumeHash)
                    internal
                {
                    // Load threshold to avoid multiple storage loads
                    uint256 _threshold = threshold;
                    // Check that a threshold is set
                    require(_threshold > 0, "Threshold needs to be defined!");
                    // Check that the provided signature data is not too short
                    require(signatures.length >= _threshold.mul(65), "Signatures data too short");
                    // There cannot be an owner with address 0.
                    address lastOwner = address(0);
                    address currentOwner;
                    uint8 v;
                    bytes32 r;
                    bytes32 s;
                    uint256 i;
                    for (i = 0; i < _threshold; i++) {
                        (v, r, s) = signatureSplit(signatures, i);
                        // If v is 0 then it is a contract signature
                        if (v == 0) {
                            // When handling contract signatures the address of the contract is encoded into r
                            currentOwner = address(uint256(r));
            
                            // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes
                            // This check is not completely accurate, since it is possible that more signatures than the threshold are send.
                            // Here we only check that the pointer is not pointing inside the part that is being processed
                            require(uint256(s) >= _threshold.mul(65), "Invalid contract signature location: inside static part");
            
                            // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)
                            require(uint256(s).add(32) <= signatures.length, "Invalid contract signature location: length not present");
            
                            // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length
                            uint256 contractSignatureLen;
                            // solium-disable-next-line security/no-inline-assembly
                            assembly {
                                contractSignatureLen := mload(add(add(signatures, s), 0x20))
                            }
                            require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, "Invalid contract signature location: data not complete");
            
                            // Check signature
                            bytes memory contractSignature;
                            // solium-disable-next-line security/no-inline-assembly
                            assembly {
                                // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s
                                contractSignature := add(add(signatures, s), 0x20)
                            }
                            require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, "Invalid contract signature provided");
                        // If v is 1 then it is an approved hash
                        } else if (v == 1) {
                            // When handling approved hashes the address of the approver is encoded into r
                            currentOwner = address(uint256(r));
                            // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction
                            require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, "Hash has not been approved");
                            // Hash has been marked for consumption. If this hash was pre-approved free storage
                            if (consumeHash && msg.sender != currentOwner) {
                                approvedHashes[currentOwner][dataHash] = 0;
                            }
                        } else if (v > 30) {
                            // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover
                            currentOwner = ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", dataHash)), v - 4, r, s);
                        } else {
                            // Use ecrecover with the messageHash for EOA signatures
                            currentOwner = ecrecover(dataHash, v, r, s);
                        }
                        require (
                            currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS,
                            "Invalid owner provided"
                        );
                        lastOwner = currentOwner;
                    }
                }
            
                /// @dev Allows to estimate a Safe transaction.
                ///      This method is only meant for estimation purpose, therefore two different protection mechanism against execution in a transaction have been made:
                ///      1.) The method can only be called from the safe itself
                ///      2.) The response is returned with a revert
                ///      When estimating set `from` to the address of the safe.
                ///      Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`
                /// @param to Destination address of Safe transaction.
                /// @param value Ether value of Safe transaction.
                /// @param data Data payload of Safe transaction.
                /// @param operation Operation type of Safe transaction.
                /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).
                function requiredTxGas(address to, uint256 value, bytes calldata data, Enum.Operation operation)
                    external
                    authorized
                    returns (uint256)
                {
                    uint256 startGas = gasleft();
                    // We don't provide an error message here, as we use it to return the estimate
                    // solium-disable-next-line error-reason
                    require(execute(to, value, data, operation, gasleft()));
                    uint256 requiredGas = startGas - gasleft();
                    // Convert response to string and return via error message
                    revert(string(abi.encodePacked(requiredGas)));
                }
            
                /**
                * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.
                * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.
                */
                function approveHash(bytes32 hashToApprove)
                    external
                {
                    require(owners[msg.sender] != address(0), "Only owners can approve a hash");
                    approvedHashes[msg.sender][hashToApprove] = 1;
                    emit ApproveHash(hashToApprove, msg.sender);
                }
            
                /**
                * @dev Marks a message as signed
                * @param _data Arbitrary length data that should be marked as signed on the behalf of address(this)
                */
                function signMessage(bytes calldata _data)
                    external
                    authorized
                {
                    bytes32 msgHash = getMessageHash(_data);
                    signedMessages[msgHash] = 1;
                    emit SignMsg(msgHash);
                }
            
                /**
                * Implementation of ISignatureValidator (see `interfaces/ISignatureValidator.sol`)
                * @dev Should return whether the signature provided is valid for the provided data.
                *       The save does not implement the interface since `checkSignatures` is not a view method.
                *       The method will not perform any state changes (see parameters of `checkSignatures`)
                * @param _data Arbitrary length data signed on the behalf of address(this)
                * @param _signature Signature byte array associated with _data
                * @return a bool upon valid or invalid signature with corresponding _data
                */
                function isValidSignature(bytes calldata _data, bytes calldata _signature)
                    external
                    returns (bytes4)
                {
                    bytes32 messageHash = getMessageHash(_data);
                    if (_signature.length == 0) {
                        require(signedMessages[messageHash] != 0, "Hash not approved");
                    } else {
                        // consumeHash needs to be false, as the state should not be changed
                        checkSignatures(messageHash, _data, _signature, false);
                    }
                    return EIP1271_MAGIC_VALUE;
                }
            
                /// @dev Returns hash of a message that can be signed by owners.
                /// @param message Message that should be hashed
                /// @return Message hash.
                function getMessageHash(
                    bytes memory message
                )
                    public
                    view
                    returns (bytes32)
                {
                    bytes32 safeMessageHash = keccak256(
                        abi.encode(SAFE_MSG_TYPEHASH, keccak256(message))
                    );
                    return keccak256(
                        abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeMessageHash)
                    );
                }
            
                /// @dev Returns the bytes that are hashed to be signed by owners.
                /// @param to Destination address.
                /// @param value Ether value.
                /// @param data Data payload.
                /// @param operation Operation type.
                /// @param safeTxGas Fas that should be used for the safe transaction.
                /// @param baseGas Gas costs for data used to trigger the safe transaction.
                /// @param gasPrice Maximum gas price that should be used for this transaction.
                /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                /// @param _nonce Transaction nonce.
                /// @return Transaction hash bytes.
                function encodeTransactionData(
                    address to,
                    uint256 value,
                    bytes memory data,
                    Enum.Operation operation,
                    uint256 safeTxGas,
                    uint256 baseGas,
                    uint256 gasPrice,
                    address gasToken,
                    address refundReceiver,
                    uint256 _nonce
                )
                    public
                    view
                    returns (bytes memory)
                {
                    bytes32 safeTxHash = keccak256(
                        abi.encode(SAFE_TX_TYPEHASH, to, value, keccak256(data), operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce)
                    );
                    return abi.encodePacked(byte(0x19), byte(0x01), domainSeparator, safeTxHash);
                }
            
                /// @dev Returns hash to be signed by owners.
                /// @param to Destination address.
                /// @param value Ether value.
                /// @param data Data payload.
                /// @param operation Operation type.
                /// @param safeTxGas Fas that should be used for the safe transaction.
                /// @param baseGas Gas costs for data used to trigger the safe transaction.
                /// @param gasPrice Maximum gas price that should be used for this transaction.
                /// @param gasToken Token address (or 0 if ETH) that is used for the payment.
                /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).
                /// @param _nonce Transaction nonce.
                /// @return Transaction hash.
                function getTransactionHash(
                    address to,
                    uint256 value,
                    bytes memory data,
                    Enum.Operation operation,
                    uint256 safeTxGas,
                    uint256 baseGas,
                    uint256 gasPrice,
                    address gasToken,
                    address refundReceiver,
                    uint256 _nonce
                )
                    public
                    view
                    returns (bytes32)
                {
                    return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));
                }
            }