[{"data":1,"prerenderedAt":372},["ShallowReactive",2],{"docs:en:\u002Fdocs\u002Fduel\u002Fcontracts\u002Foverview":3},{"id":4,"title":5,"body":6,"cover":363,"description":364,"extension":365,"meta":366,"navigation":367,"path":368,"seo":369,"stem":370,"__hash__":371},"docs\u002Fdocs\u002Fduel\u002Fcontracts\u002Foverview.md","Contracts",{"type":7,"value":8,"toc":353},"minimark",[9,13,17,110,115,134,138,141,144,196,200,203,277,280,284,330,334],[10,11,5],"h1",{"id":12},"contracts",[14,15,16],"p",{},"Duel is six contracts, five of them deployed on Robinhood Chain and one never deployed, built on the chain's Uniswap V4 deployment. Solidity 0.8.26, Foundry,\nOpenZeppelin, v4-core. The duels live on the chain: the app reads it, through the site's server or directly, and their\nhistory from an indexer of the chain's events.",[18,19,20,33],"table",{},[21,22,23],"thead",{},[24,25,26,30],"tr",{},[27,28,29],"th",{},"Contract",[27,31,32],{},"Role",[34,35,36,52,62,72,90,100],"tbody",{},[24,37,38,45],{},[39,40,41],"td",{},[42,43,44],"code",{},"DuelFactory",[39,46,47,48,51],{},"Launches a duel in one transaction: two tokens, three pools, locked positions, the creator's launch buys. Owns the bounded configuration of future duels; a launch commits to the configuration its launcher read (",[42,49,50],{},"configHash",") and reverts if another applied meanwhile.",[24,53,54,59],{},[39,55,56],{},[42,57,58],{},"DuelHook",[39,60,61],{},"The Uniswap V4 hook shared by every duel's three pools: fees, the anti-snipe tax, the switch burn, the realignment, the split's average, rounds and buybacks, and every duel's pot, creator fees and protocol fees.",[24,63,64,69],{},[39,65,66],{},[42,67,68],{},"DuelToken",[39,70,71],{},"The plain ERC-20 of every side: one billion units, burnable, no owner, with permits (EIP-2612).",[24,73,74,79],{},[39,75,76],{},[42,77,78],{},"DuelRouter",[39,80,81,82,85,86,89],{},"The exact-input router the app trades through, a sale's permit included; it alone sells a side in several passes when its ETH pool cannot take the sale at once (",[42,83,84],{},"SALE_PASSES","), and what that pool cannot buy back even then through the other side (",[42,87,88],{},"sell","). Any V4 router works as well, in one swap.",[24,91,92,97],{},[39,93,94],{},[42,95,96],{},"DuelLens",[39,98,99],{},"Read-only views that gather a duel's state for the app.",[24,101,102,107],{},[39,103,104],{},[42,105,106],{},"DuelSimulator",[39,108,109],{},"Never deployed. The app puts its code on your own address for one read-only call (a state override), so that a trade runs as you would send it and answers what you would get and where the split would land once the pools realigned.",[111,112,114],"h2",{"id":113},"version","Version",[14,116,117,118,121,122,125,126,129,130,133],{},"This launchpad is Duel V1, code name Petunia. Each of its contracts says so (",[42,119,120],{},"VERSION()"," and ",[42,123,124],{},"CODENAME()"," on the\nfactory, the hook, the router and the lens), and each token it launches keeps it for good (",[42,127,128],{},"LAUNCHPAD_VERSION()"," and\n",[42,131,132],{},"LAUNCHPAD_CODENAME()","): a duel's About section shows it, as its tokens say it. A later launchpad, deployed separately, would\nbe V2, with a code name of its own, and its tokens would say so.",[111,135,137],{"id":136},"addresses","Addresses",[139,140],"contract-addresses",{},[14,142,143],{},"Duel relies on these Robinhood Chain contracts:",[18,145,146,154],{},[21,147,148],{},[24,149,150,152],{},[27,151],{},[27,153],{},[34,155,156,166,176,186],{},[24,157,158,161],{},[39,159,160],{},"Uniswap V4 PoolManager",[39,162,163],{},[42,164,165],{},"0x8366a39CC670B4001A1121B8F6A443A643e40951",[24,167,168,171],{},[39,169,170],{},"Universal Router (mainnet)",[39,172,173],{},[42,174,175],{},"0x204FAca1764B154221e35c0d20aBb3c525710498",[24,177,178,181],{},[39,179,180],{},"V4 Quoter",[39,182,183],{},[42,184,185],{},"0x8Dc178eFB8111BB0973Dd9d722ebeFF267c98F94",[24,187,188,191],{},[39,189,190],{},"Permit2",[39,192,193],{},[42,194,195],{},"0x000000000022D473030F116dDEE9F6B43aC78BA3",[111,197,199],{"id":198},"the-hook","The hook",[14,201,202],{},"A V4 hook's address carries the list of callbacks it implements. Duel's hook uses:",[18,204,205,215],{},[21,206,207],{},[24,208,209,212],{},[27,210,211],{},"Callback",[27,213,214],{},"What it does",[34,216,217,227,237,247,257,267],{},[24,218,219,224],{},[39,220,221],{},[42,222,223],{},"beforeInitialize",[39,225,226],{},"Only the factory may open a pool on the hook, and only a duel's registered pools.",[24,228,229,234],{},[39,230,231],{},[42,232,233],{},"beforeAddLiquidity",[39,235,236],{},"Only the factory may add liquidity, at launch.",[24,238,239,244],{},[39,240,241],{},[42,242,243],{},"beforeRemoveLiquidity",[39,245,246],{},"Always reverts: liquidity is locked forever.",[24,248,249,254],{},[39,250,251],{},[42,252,253],{},"beforeDonate",[39,255,256],{},"Always reverts.",[24,258,259,264],{},[39,260,261],{},[42,262,263],{},"beforeSwap",[39,265,266],{},"Settles a finished round, updates the averages, takes fees and taxes.",[24,268,269,274],{},[39,270,271],{},[42,272,273],{},"afterSwap",[39,275,276],{},"Takes the fees due on the amount the swap did not specify, checks that a swap charged before it filled completely, then realigns the three pools.",[14,278,279],{},"Fees are taken with the hook's return deltas, so they apply whoever routes the swap.",[111,281,283],{"id":282},"who-can-do-what","Who can do what",[18,285,286,296],{},[21,287,288],{},[24,289,290,293],{},[27,291,292],{},"Actor",[27,294,295],{},"Can",[34,297,298,306,314,322],{},[24,299,300,303],{},[39,301,302],{},"Anyone",[39,304,305],{},"Launch, trade, settle finished rounds, trigger creator or treasury claims, apply proposed terms once their 48 hours have passed",[24,307,308,311],{},[39,309,310],{},"A duel’s creator",[39,312,313],{},"Receive that duel’s creator fees; hand the role, with its fees, to an address that accepts it",[24,315,316,319],{},[39,317,318],{},"Factory owner",[39,320,321],{},"Pause new launches; change bounded terms for future duels or the protocol treasury after 48 hours. The current treasury receives accumulated protocol fees at claim time. Lower the protocol's share of every duel's swap fee at once, or raise it back, never above its terms.",[24,323,324,327],{},[39,325,326],{},"Nobody",[39,328,329],{},"Withdraw liquidity, mint tokens, move a pot, change the fee a live duel’s traders pay or its creator’s share, raise the protocol’s share above a duel’s terms, take a duel’s creator role, upgrade contracts",[111,331,333],{"id":332},"more","More",[335,336,337,346],"ul",{},[338,339,340,345],"li",{},[341,342,344],"a",{"href":343},"\u002Fdocs\u002Fduel\u002Fcontracts\u002Fsecurity","Security",": what protects the funds, and how it was checked.",[338,347,348,352],{},[341,349,351],{"href":350},"\u002Fdocs\u002Fduel\u002Fcontracts\u002Fintegrate","Build on Duel",": reading duels and trading from your own code.",{"title":354,"searchDepth":355,"depth":356,"links":357},"",2,3,[358,359,360,361,362],{"id":113,"depth":355,"text":114},{"id":136,"depth":355,"text":137},{"id":198,"depth":355,"text":199},{"id":282,"depth":355,"text":283},{"id":332,"depth":355,"text":333},null,"Duel’s contracts on Robinhood Chain: factory, Uniswap V4 hook, token, router and lens, their addresses, the hook’s callbacks, and who can do what.","md",{},true,"\u002Fdocs\u002Fduel\u002Fcontracts\u002Foverview",{"title":5,"description":364},"docs\u002Fduel\u002Fcontracts\u002Foverview","anPQEQvAAeMi32zA7tEeJuv5ay0R_qbGwpgnOZvtoV4",1791231651148]