ETH Price: $3,094.92 (+4.52%)
Gas: 3 Gwei

Transaction Decoder

Block:
11658016 at Jan-15-2021 06:23:15 AM +UTC
Transaction Fee:
0.13609986 ETH $421.22
Gas Used:
2,093,844 Gas / 65 Gwei

Emitted Events:

21 GFarmToken.RoleGranted( role=0000000000000000000000000000000000000000000000000000000000000000, account=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f, sender=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f )
22 GFarmToken.Transfer( from=0x0000000000000000000000000000000000000000, to=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f, value=10000000000000000 )
23 GFarmToken.RoleGranted( role=9F2DF0FED2C77648DE5860A4CC508CD0818C85B8B8A1AB4CEEEF8D981C8956A6, account=0x1E887E71...12B45d81B, sender=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f )
24 GFarmToken.RoleGranted( role=3C11D16CBAFFD01DF69CE1C404F6340EE057498F5F00246190EA54220576A848, account=0x1E887E71...12B45d81B, sender=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f )
25 GFarmToken.RoleGranted( role=9F2DF0FED2C77648DE5860A4CC508CD0818C85B8B8A1AB4CEEEF8D981C8956A6, account=0x6E626A14...703197847, sender=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f )
26 GFarmToken.RoleGranted( role=3C11D16CBAFFD01DF69CE1C404F6340EE057498F5F00246190EA54220576A848, account=0x6E626A14...703197847, sender=[Sender] 0xc66fbe50dd33c9aadd65707f7088d597c86fe00f )

Account State Difference:

  Address   Before After State Difference Code
0x831091dA...A867f1e1B
0 Eth
Nonce: 0
0 Eth
Nonce: 1
From: 0 To: 310539375786163748529786339320131226899580179621119595335185533645444593070622787478928927223620382446206057752433984578908602661558491933650252105514744058316344899765294725095888143677117214370209403748512392041787224157795231514286332929746371105330125620748752517218863361882285251684003278919027675886980110972711439547492115495647428724707182331722168150980472038037295402646222789495365394947061331652841802943129167906731685118959974266989728611201389620474600984696399372678126034136164649398857274165861286240410730194921048860870017935755018417305467401313499869074509569619728934563635328935484532093823479094872941328174933962080466495205025562417258718428293708301778001955545159765874800306703773068462545262632432448363844624425151597261034918182697757835400351378359550283332639991275072796754815870349210448790434139973261391338612564239885273462811544084289453477265688618686413414338553503512842340766469398862898376653862679619012947712511646841941443802842388609622417037184430719824437786687664077865090082060262539078586002465778309348785038092935848290475058485958626095261330434948798555082301418426805624706426550028651749976265562113901361615567866731745546120445643460503285783164020953086453993237638479081492900325340448461955534192034578358674146343248739910883902246204298809039632600050588503746229835373233799113534846833988823970651218232427600269846205159722364062548786912534935201182126369564737591866969817549002015630099138652286049814085042006744445277537829832821074185627873049047153263339857362645493255840431293860672764152115802951648581687361530020054179509136061925850638705205943888393864932028486322521157335779558639541201980037400014141276002005385015230874480417142036016316050349917194328798176102389108036767722649106159631063291848185059409509039192364864389761462116070993395562735195921272727917144727323851251615516442724038538593430384959865862037774163033087149065015401334357130106113666150360435702057422604782181476491070043667464329195946210920884891274691592213851920256194678457970483017895141376481042663243872244313539981839675887261371672064697296197739622032994752903034744857322333549441043998196775306277745079982071229817531665931398649613362742781815127163540063419693225171478221096480937252258921677793599249289495635214374231389269694129968559178439603620418237636317472932854403328948438698406528784375265397418891251606864935733372041889064107297929770575674311927374724104390160972436272381318184040969004628244160398340842833050294586284290590643510278263190214407393691379075850042732979534200117928353013071042545558808171915920357451647308365864167723394098977963624865624276348146503606599402668606500309124747147705862477629100963522398249002554741068982549429446151955155595165981406209010993987148143656997428940154123786421124333850185026008319290568574115741276865890601026128907989624228166858899187283780540148448155956363450538753321320656792332523119795663918674245492749399605597484620693766856870420037530341584946628011517574489496314685555521951330168186280305750935919909053933134859797462167927325334448652778029651641690888859891725850233766417632010003305655864349332558807634839285952037274391665261577027156128279843659481944003334508349563443236385822936021993503475348919108111953497395993074375853487083443041887836847142768548802876801115602382164742996006913989103473407556012498837487511296503880745971735925854305154902016088947970712852462619489026329414908540407717179988806716120342513336518613593037370462848449792022250731521025125570003546832900734172114381994692439678775659035196159972965286435052561595250865832921659893706280889997509563197000068302917733994841592216963331471348474476488756615201454434162159052463294071343920889567012380485046944895877383064608815614229520495746233571550097684891963664572000776569429073107041206394918699916355997166087933726452630884888864442251047161578376772259016770293291527453968372448878863698447404954254699729534671231017088140885625522368516451605725154857097323455864191200615408615648407804622238238272905128709138581760717444846426741111702437185322488768911128436925963351947372572004172652975616829795944569551561212368783152144836001235323995709772318130894231081957953737468029326398153137852121911867191333525835485488374192923958125016027200042919852709935131941044525325346136152824580977098537769751809097532212590055467811605437882379044126110683128589776767568330808340365089879272391793836986988148178902509170130123524746262396057007796848577208682103007509131304973603646734325123875176412139580256487911916434933847224260525601807061611880945582371437498800168579285531788473435574589123563530527877288502574877391297660580670859378467855432376512287504371405439056980434206473052196314274421212850604100517843581188859315422992493860958114895773329057987347981163429472026919755010189548618948342464978250120624258489424383588907546127622016399003432306963288298914966020508755155215517328058399328607058037287147865391923059430178883067581588859883182291104448459909607951209718282954139088886125958994175345624750089220278093219174593602572774871956542333007774949713409202509398995216887312663713573639362173899402123992490868995343662865762987200782175614678416479921264325878145066210710769803114039397475438180047590696278305731178713126354025149457898134299050467125653926007968968669871427436910015257650449412192399702669543714949078419653159030936922599137029205414759677194492430907210915587860882793238183626499454734077070261353551854375579116270082974838738844510288892120356892916836833508951132327319295248708041537001563008698789089920620660624916882755064383111363995150655488836333369688333526502744592596782675079235193457745950222776054393074167900143987960692822920783888553653803728488031255192905988444245343914507362197338061082093405916655404572215281107226910430581136811095540733665819933043948602908141620111433169595741444303843016413930213122102402243971296184452455943558788776988239102187561637921360082022001794851875754075553388762790767555950661264779042990623777069336888548221075373523865773201876533870515041506629429639445208975050476683329279162221513022188649436204659277646126524400620789730222540068561430613733975136645031966087177682876938358697113974453150097699512348810287830976157135357123922280276699584713056813920777684942764154970659874273486839651774503177240050941717939049839943447651730525982022423575060828429084083915998652832937602878752664203732264290304921450796080356569878140223681269600022607761652597900342299424431890273951268069438314015181982361595712983463615188207504345530512472449458723646418603379999726643665342163616240574843558837563570857167771850250893115843894071840689258602625843847571111068313792976892497962349581397931438792118078299647547509787567470454541788960877856965206504573552533973089706114706382760820697401200198079311328107045168672852680814667371419125865920113582055535682458244655004772023044027936552711978003358738852670339902499350454591082623215718884221940621465425431397596227121622701824391719228125982438630250435259514736754206884091299567702575109982343168068784454454302213367912990234834430370066176133719777120948317493342978413035627096244568619221452099084826732452632931217198983661280465660041141558280817343027643385159149171055949353468099952043857086500324120915491586043962161318741567149490148299491865708199451712206771225680674412011114447002764118437082516437070385518849538666879038813397807268762242445195004579114317224645767378031412181153235780774694133779674046990219285704358396815849545892856771794187138766558389222381417745006753785544659129865786687608830503928971169925749241091115142378256147782591266816587196035943976271982324531513929373614955408557443382904280947393861405976365875901887826039199913146136770151685260193570702519912769757351950090608140145651143864049934517636066327237267215654498271772665534194713963140122171312140724078708307770226321040355143749524119421746873355700767083385895529654634369392424160785255127220736910479996474089607032116034323103261906523469966102696621586068546402082609083926164110772006603733819910883958549573651654973995761079314086222131717947503417223988098254645978098825232740991854969312680620367695229169340863161855372466324286429138428569047771416026946436873685401376469936081698909611343265691929712107514386746005491103620942490003168372952452031823099605692914723820513287514063355684660675106328420933411053423832292303294927672081131908580132593989300891551824466014258391755028219381344124541505542310755279350917495221495468223454610983707762420137874254293420299342832219164651416849134294527598421632891350917749984100296811144877305832303287328164769749603622358786791096507575715235275541721146060363108174226333550033261501092676345157563344746158171847872821825519628999238398848087885666368355321075068450424883722743681289336796067404231538960680207441318534552450759265362032258899840415152194648288874240955346464669693801338300569710188562333522970982110757477515765489937874986878162190795806659548031625890527839114978789314387082025017600507194967437278823152481573722489682740210840295753537032242073146865107848808243423234668510070406825601505602613079795541843740687705459563072051328228366630918732810054133776847902482599134929313071940818758033284100114003223447017473072322417684632757473020328086293977928974815165753898199294426820894720623924585141288487450160676582395802291560194903652622788086007429842351827301850501386615505374890208021834352481132358557554873667679542186905124650950838379734933319317698396043595872799277328230323187449141655749665565119772032839978917986984121008441981295677555750365397001047972829289257812661711427502106563182328068391072527437602017993292279231899684025202346648666804688504615826591509611936888940817841669976684188012041219606062295537584023305601519944910034636074813668165485008554098847245647257144601252442018123971959118292346252360582437397587104495259442125165149921948328191689580409111092872338978793821728242044835681630576284990855401343338247913943734427207294764073466506552881781465544337121760571050443219678796641643729713378671647635900078604545375718308894809301664295242478152833582746837873445769179624556419240534574835315479831318459998382054099233228077540016611792960343679637558872614435484198686858736250973452514428015988302190279813092623335984453433273652035930689818771684382000973751647090283486439886570038254632132084144918319680090531556558503334355843592521052205452039316786098384586647442396240497396396178339448625685731805574162296145881280345991481966174084133292193102293005535225837069494839402680723230812426214059685703307037779757687909005450659683587950726905560886832943305510801550704117984652168319165649512377428304303211692240150399669652842698689832088622310373939960796891855449411761233580582207472348340791619964461293567397844853847648911215505860077924672300695933957802037848009322887006561861937710907270229717586366157733216074203030026769059997334112584171807559683977426562848214582783587193875762212259138646471705951304021608882846113926577044908687906043968187388078902811343893761336582916758570718839423530613378160285880240231354099858747923615045554091532851858729800254662342306569748129673594756339772329219227247285560608528537260513981719275887633380605604300079179079867988772406286008665741613839306892655372415635736190934732308597386214258727759060071062054844454404218341872581286556551048740761099026052237840755683432388183532700071027838007223614132157099059466201414990311121139485245949030968519642699785220745788331512978166931092458461604990449746270699467075819157987734348197453342567993517921521885736293092282770806470687135777150987657112718526893220913111113737771202265670995874794396589592015060845566913484397697507592637214032310661899917759037854325558383084362820082635906327878705135402612211763217329724017999737321725323922816208646329029734141614080348111001650619057110599264877200409879220830262019014708068621479956649710920684468097378436133683997309238845782330430018033483163425715361917044776394479390398990453217917936283568647669227338338554478402353114577611045775031253569253521779718315385718815901009022125236842401546244768123645540671953456059250622598805430893031177446860522874803862888837716661861293901275942195547528207069823710467749531112758954955459235603964464369269135320124585024812391036308421075827913949290867267219969960431750287352558615613698837654687003906130985693150601115428465405946927300500953942188846032661772530559468733884237941645458302196839852280394604055923437807614533357936700580184984001533209385003920014473178126000352172085441334805704133558376198422308297192967150776569330427993744933257474292620771590147054864727278888273748089691508790749190004781660583501948962486342201179623534274297050989772981186222520951333438817122950420760348615274272501006543035464710387275005911682581847156370558101569323009974650427049699124787557518891109867901504783522153219275929850066929176789343768070682593674887581064542169360071092834420620758860707218163518601207883674852546027906968245244794920558448515501922927140001761177595614865989313423357065206230228731422955493032510741656688828511387077535061369504650513946093415462352033257315166427224435390017664929914711806764106648817829840611056864185733060320914985104422406519678910095679408717373720830102129070439462897299054698666689940778074487377069315116902128342712402507884914352057207875130747875647776862846947561847514414988190085086249429589623476481848969895188119692794471007481907031423696038602068835991899130959146944123829081657100063583616995411400680654133307188686949212927820184484967636907724643979363822393499165942048737469089967282781701273376843557850353727868246661775388496346252199026763037874864205025304465550822760623973334401398799492244831153759061546894629989541137607619889448449640819394804475550068691851094208895001533101441545264845511035102422686724404849204145478186673775927184105946594244990166753875244030428097032906433474438657583807559590986953374393970624022138754428079584817451721756674462031351215709326637974003693116620194021173748309976144849072632124980364976464510855017475946810575509336645852032197839181087304869979447551034669612209811020113215721426806039541403920841917705201079981146514308330821478842761100948854569595355868559374324871639429658211081744639125500564017118853499665832114884013209262812512016495411890418087203601302796734446126441287620415307546318752061314003407510981315737545115534449484256282934713227007111642145386272389068959194418958397030900906722202819227892330272697136496070866506616665421454730110799752203021746700092856762286487538684739258362116673553796629193842369987061823704639704350023068215307396604345358271069886201443965801379338818928949840474708874872046886983744607057048884703104848901252517241325022402280904221453221082142335387779729197627058655728457648081266964626456199077480990097841416939639450382700191932047701291944487294625382354916930191655885873472261168637234231490649002820496882198759850271311103927321158414355284164743623756490701627420756031470193995392693773937622792650035809203762825368428718429122110706608401804740092052373338064353097256092366427929036728985877695095285129515573888135981541304567583164425388305315608389770202260772305120189929937202106328033563240273191647902638729506113088123250359312148604465317688655759330450474911628982202554623423984134332014581918027569787719474003219808773766905801895159979706533021689967461036069363153036777914294858414557982005130933772696240497969572877437919617264157544031383625196987306819997204502528108074712799573459979779568236025686647944162558161206653581658565643072061761106882273047637885900658714515343812601546208762185284050758343867504045871461985623378234232343088795131577436959326072215355843091911273996220893529923672059115319715758456476364858893340566825348789584857330824536616696703554344480812567299278653261237876373119576693150356188553880738914730002049425849671625711355274601480891558641877432961982510455892421748399269596357352312002544756828135615741356439718061952424119511092524617750533712845790910369718776984753375755976848393173615387469565653075953362551337416879808824176875069467664167858456734504964895651525424271337953603030135931867456484744271430279519549988426099568486667031944792081777310699468453921193241600475474871551227931120794255790836125345680245601130104072644788109022179829910780624119174404888792364124277053459817595228052222692733942735221218322770758024803779366499185853963050907286230400899555451383656197879126739928718837542729169223173109873049822512407396979211436526872056302565349288435861050003323867959134274655032935467982341391392840050306350758259220787320670433946071702040924362875252943026261133103599895719159206620686870622226708323491254687644511112706155750708853842133076627381834659355379820946197743937048966454473847034133527813388846583531821429726387075657557429237786436027648208653255833420900807884860564087656450637336954174652711429564175684305771437881247814381584244818748698653507722255081186976607494184401298436831505662870789381797579933836856633891578570455086685139340173452086078959232212217513458780516118369192390714165616105155732790053828980164284430720519618074670301014274329844491666420617036593509743402811160212102857157253385244451818180261581550338642976493888219850557676321768511082386287040627643331869306408276370242731606763665422574294618259614911373551710405038828678117436949988193868953543346493964567053579657214464040954039196050634894131956739361287732743556664429287314108738551995992525846830292442245620717631987850598054413643944608465771309827152715175096123377320322203699
3,801.636883034087296263 Eth3,801.772982894087296263 Eth0.13609986
0xC66FbE50...7C86fE00F
(Gains Farm: Deployer 1)
20.513850048065862997 Eth
Nonce: 5
20.377750188065862997 Eth
Nonce: 6
0.13609986

Execution Trace

GFarmToken.60806040( )
// File: node_modules\@openzeppelin\contracts\GSN\Context.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// File: node_modules\@openzeppelin\contracts\token\ERC20\IERC20.sol

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

// File: node_modules\@openzeppelin\contracts\math\SafeMath.sol

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot 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-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

// File: node_modules\@openzeppelin\contracts\utils\Address.sol

pragma solidity ^0.7.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// File: node_modules\@openzeppelin\contracts\token\ERC20\ERC20.sol

pragma solidity ^0.7.0;





/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

// File: @openzeppelin\contracts\token\ERC20\ERC20Capped.sol

pragma solidity ^0.7.0;


/**
 * @dev Extension of {ERC20} that adds a cap to the supply of tokens.
 */
abstract contract ERC20Capped is ERC20 {
    using SafeMath for uint256;

    uint256 private _cap;

    /**
     * @dev Sets the value of the `cap`. This value is immutable, it can only be
     * set once during construction.
     */
    constructor (uint256 cap_) {
        require(cap_ > 0, "ERC20Capped: cap is 0");
        _cap = cap_;
    }

    /**
     * @dev Returns the cap on the token's total supply.
     */
    function cap() public view returns (uint256) {
        return _cap;
    }

    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - minted tokens must not cause the total supply to go over the cap.
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        if (from == address(0)) { // When minting tokens
            require(totalSupply().add(amount) <= _cap, "ERC20Capped: cap exceeded");
        }
    }
}

// File: node_modules\@openzeppelin\contracts\utils\EnumerableSet.sol

pragma solidity ^0.7.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
 * (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(value)));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint256(_at(set._inner, index)));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

// File: @openzeppelin\contracts\access\AccessControlTimeLock.sol

pragma solidity ^0.7.0;




/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlTimeLock is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    // BEGIN TIMELOCK FEATURE

    struct GrantRequest {
        bytes32[] roles;
        uint initiated;
    }
    mapping(address => GrantRequest) grantRequests;
    uint constant public MIN_GRANT_REQUEST_DELAY = 10000; // 1.5 day

    /**
     * @dev Emitted when admin initiates a grant request.
     *
     * `account` is the account to whom we want to grant the role `role`
     *  and `initiated` is the block number the request was made
     */
    event GrantRequestInitiated(bytes32[] indexed roles, address indexed account, uint indexed initiated);

    /**
     * @dev Emitted when admin initiates a grant request.
     *
     * `account` is the account for which to cancel the request
     *  and `canceled` is the block number the request was canceled
     */
    event GrantRequestCanceled(address indexed account, uint indexed canceled);

    // END TIMELOCK FEATURE

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    // BEGIN TIMELOCK FEATURE

    /**
     * @dev Returns true if a grant request was initiated for this account.
     *
     */
    function grantRequestInitiated(address account) public view returns(bool){
        GrantRequest memory r = grantRequests[account];
        return r.roles.length > 0 && r.initiated > 0;
    }

    /**
     * @dev Initiates a request to grant `role` to `account` at current block number.
     *
     * Requirements:
     *
     * - the caller must have the DEFAULT_ADMIN_ROLE
     * - there must be no request already initiated with this role and account.
     *
     */
    function initiateGrantRequest(bytes32[] memory roles, address account) external {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to prepare granting a role.");
        require(!grantRequestInitiated(account), "Grant request already initiated for this account.");
        grantRequests[account] = GrantRequest(roles, block.number);

        emit GrantRequestInitiated(roles, account, block.number);
    }

    /**
     * @dev Cancels a request to grant `role` to `account` 
     *
     * Requirements:
     *
     * - the caller must have the DEFAULT_ADMIN_ROLE
     * - there must already be a request initiated with this role and account.
     *
     */
    function cancelGrantRequest(address account) external {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to prepare granting a role.");
        require(grantRequestInitiated(account), "Grant request already initiated for this role and account.");
        delete grantRequests[account];

        emit GrantRequestCanceled(account, block.number);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have the DEFAULT_ADMIN_ROLE
     * - the request has to be initiated at least MIN_GRANT_REQUEST_DELAY blocks before.
     *
     */
    function grantRole(address account) public virtual {
        require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "AccessControl: sender must be an admin to grant");
        require(grantRequestInitiated(account), "You must first initiate a grant request for this role and account.");
        
        GrantRequest memory r = grantRequests[account];
        require(block.number >= r.initiated + MIN_GRANT_REQUEST_DELAY, "You must wait for the minimum delay after initiating a request.");

        for(uint i = 0; i < r.roles.length; i++){
            _grantRole(r.roles[i], account);
        }

        delete grantRequests[account];
    }

    // END TIMELOCK FEATURE

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// File: contracts\GFarmToken.sol

pragma solidity 0.7.5;



contract GFarmToken is ERC20Capped, AccessControlTimeLock {

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

    constructor(address _GOV, address _farm, address _trading)
    ERC20Capped(100000*10**18)
    ERC20("Gains V2", "GFARM2"){
        _setupRole(DEFAULT_ADMIN_ROLE, _GOV);
        _mint(_GOV, 1e16); // Create pair on Uniswap with 0.01 gfarm
        
        _setupRole(MINTER_ROLE, _farm);
        _setupRole(BURNER_ROLE, _farm);

        _setupRole(MINTER_ROLE, _trading);
        _setupRole(BURNER_ROLE, _trading);
    }

    // 1. Mint GFARM tokens (GFarm & GFarmTrading contracts)
    function mint(address to, uint amount) external {
        require(hasRole(MINTER_ROLE, msg.sender), "Caller is not a minter");
        _mint(to, amount);
    }

    // 2. Burn GFARM tokens (GFarm & GFarmTrading contracts)
    function burn(address from, uint amount) external {
        require(hasRole(BURNER_ROLE, msg.sender), "Caller is not a burner");
        _burn(from, amount);
    }
}