File size: 59,400 Bytes
f998fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  "language": "Solidity",
  "sources": {
    "src/VoltronGobblers.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/*\n                                                                                                                                                                                          \n                                                                                                                                                                                          \n                                                                                                     /=O                                                                                  \n                                                                                                   \\ =                                                                                    \n                                                                                                 O  /                                                                                     \n                                                                                                /  \\  [[/                                                                                 \n                                                                                              /  ,\\\\       [O                                                                             \n                                                                                            O   =/   /OooO   //                                                                           \n                                                                                          O       ]OoooO/  ,\\                                                                             \n                                                                                        O^     ,OoooooO   /                                                                               \n                                                                                       /  ,    =OoooooO  =                                                                                \n                                                                                     O  ,/  //   OooooO  =                                                                                \n                                                                                   \\   /^  /  ^  OooooO  =                                                                                \n                                                                                 O   / ^  O   ^  OooooO  =                                                                                \n                                                                               //  ,OO  ,=    ^  OooooO  =                                                                                \n                                                                              /  ,OOO  ,O     ^  OooooO  =                                                                                \n                                                                            O   OOOO  =O/[[[[[   OooooO  =O                                                                               \n                                                                          O   /OoO/  /\\          Oooooo        O                                                                          \n                                                                         /  =OooO^  /\\   oooooooooooooooooooo^  /                                                                         \n                                                                       /  ,O ++O   \\/  , ++++++++++++++++++++,\\  \\                                                                        \n                                                                     O   O ++,O  ,O/  ,++++++++++++++++++++++++\\  =                                                                       \n                                                                   \\   //+++,O  ,O^  ,++++++  =O++++++=O[\\^+++++\\  ,                                                                      \n                                                                 O^  =/+++.=/  =O    ++++.,   =/++++++=O  =^.++++=  ,O                                                        OO  OOO     \n                                                                /  ,O ....=/  =\\              O^......=O   =\\]]]]]/  ,O                                                       ^     =     \n                                                              /   O ...../^  /O]]]]]]]]       O^......=O               O                                                     O  O=^ =     \n     \\                            O                         \\   //......O   o        \\    =^ ,O.......=O^[\\    [/                                                              =^=^ =     \n      O    ]]]]]]]]]]]]]]]]]]]]]   O                      O   =/......,O   \\        O  =^ =  =O.......=O^...,\\]   ,\\/                                 OO                    /  O.=^ =     \n        \\   \\\\..................=^ ,                    O/  ,O ......,O  ,\\        O  =O\\    =^.......=O^.......[\\    ,O                 \\\\O            =\\                 O  =^.=^ =     \n         O^   O^.................=  =                  /  ,O .......=/  ,         \\  =/.O    O^.......=O^..........,\\\\    \\/           O    /            ,O                ^  O..=^ =     \n           /   ,O ................O  \\               \\   //........//  =         /  =/..O    O^.......=O^..............[O    ,\\       /  ,\\  =O            \\              O  = ..=^ =     \n             \\   \\\\................\\  O            O   //.........O^  /         /  =/...=^  ,O........=O^.................,\\\\    [O /   / .\\   /         ,  \\             ^ ,/...=^ =     \n              O^  ,O^..............=^  O         O^  ,O ........,O   /         /  =/....=^  =O........=O^.....................[O      //....,\\  \\        =O  ,O          O  / ...=^ =     \n                O   ,O .............=  ,        /  ,O .........,O   \\         /  =/......O  =^........=O^........OOO\\ ............\\\\]/........\\  ,/      =^=^  /           ,^....=  =     \n                  \\   \\\\.............O  =     /   //..........=O  ,O         /  //.......O  O^........=O^........OOOO[.........../OO ..........=^  \\     =^..\\  \\       /  O.....=  =     \n                   O   =^.           .\\  \\  \\   //.         ./O^  =         /  //.       =^ O         =O^        O/.           ,OO              ,O  ,/   =^  .\\  =O    O  =^     =  =     \n                     \\  =^            =^  O   ,O            // =\\  =O      /  //         =^,O         =O^                    .OO/                 \\   \\  =^    =^ ,O   ^  O      =  =     \n                      ^  =^            =    ,O             O/   ,\\  ,O    /  //           O=O         =O^                   /O/          ]         ,\\    =^      \\  \\ O  =^      =  =     \n                       ^  \\             O  //            ,O      ,O  ,   /  //            OO^         =O^                 ,OO          =OOO          \\   =^       \\  =^  /       =  =     \n                       O^  \\             O/             ,O         O  ,O^  /O            OOO^         =O^               ,OO           OO  OO          =\\ =^        ,    =        =  =     \n                        /   O                          =O           \\     /O           =OOOO          =O^              /O/          /OOOOO  O\\          O=^          \\ ,^        =  =     \n                         O   O                        //      O      \\   /O          ,OOOOOO          =O^               OO        ,OOOO     OOO          O^           \\/         =  =     \n                          O   O                      O^      OOO^     \\^/O          /OOO OO/          =O^                OO^       ,OO  O    O/        ,O\\^                      =  =     \n                           O  ,O                   ,O      ,OO O \\     =O         ,OOOOO  O^          =O^       =         \\O\\        \\O    OO         /^ =^                      =  =     \n                            \\  ,\\                 , =\\     =OOOOO^    ,O         /O       O^          =O^       ,O.        \\OO        ,O  O/        =O   =^     /                =  =     \n                             ^  =\\               =   ,O     ,OOO     ,O.       ,OOOOOOOOOOO.          =O^       .OO.        =OO\\.      .OO.       .O^    =^    = \\               =  =     \n                              ^  =\\............./  ,   O ....,O ....=O ......./OOO/[[[...,O...........=O^........OOO.........=OOO .............../O  ,O  =^...=^  =^............./  =     \n                               ^  =\\..........,/  / O   \\\\.........=O .................../O...........=O^........OOO\\.........,OOO\\............,O^  / O  =^..,^    ,\\............O  =     \n                                   \\\\++++++++,^  O    ^  =O+++++++=O +++++++++++++++++++=O/+++++++++++=O^++++++++OOOO\\+++++++++,OOOO^+++++++++/O  ,O  O  =^+,/  / ^  O+++++++++++O  =     \n                                O   \\\\++++++/  ,O      \\  ,O ++++/O^++++++++++++++++++++OO^+++++++++++=O^++++++++OOOOO^+++++++++,OOOOO++++++,O^  /    O  =^+O  =   \\  \\ +++++++++O  =     \n                                 O   O\\++++O  ,O        O   O\\++/O^++++++++++++++++++++=OO^+++++++++++/O\\++++++++OOOOOO^++++++++++OO  O\\+++O/  ,O     O  =oO  ,O    O  =\\++++++++O  =     \n                                  O   OoooO  ,           O   \\OoOOOOOOOOOOOOOOOOOOOOOOOOOOooooooooooooOOOooooooooOO    OoooooooooooOO  OOoO   /       O  =O^ ,O      O  ,Ooooooooo  =     \n                                   \\   OO/  /              ^  =/                         OooooooooooooO[[[[[[[[[[[[[[[[   ,  [[[[[[[[[[ ,   ,\\        O      O            Ooooooo/  =     \n                                    \\  ,^  \\                \\                           =OooooooooooooO   ,]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]//         OOOOOO\\           \\  \\ooooo^  =     \n                                     ^   ,O                  O  =                       =OooooooooooooO   =                                                              ^  =Oooo^  =     \n                                     \\^ ,O                    O/                     \\   \\OoooOOOOOOOOO   =                                                               O  ,OoO^  =     \n                                       //                                             /   =OOOOOOOOOOOO   =                                                                    OO^  =     \n                                                                                       O   ,OOOOOOOOOOO   /                                                                  ^  \\^  =     \n                                                                                        \\^  ,OOOOOOOOO   /                                                                    \\     =     \n                                                                                          \\   OOOOOOO   O                                                                      O    =     \n                                                                                           O   \\OOOO   O                                                                        O   =     \n                                                                                            O   =OO  ,O                                                                          \\^ =     \n                                                                                              ^  ,  ,O                                                                             \\=     \n                                                                                               \\   ,                                                                                      \n                                                                                                / =/                                                                                      \n                                                                                                                                                                                          \n                                                                                                                                                                                          \n*/\n\nimport { Owned } from \"solmate/auth/Owned.sol\";\nimport { ReentrancyGuard } from \"solmate/utils/ReentrancyGuard.sol\";\nimport { IArtGobblers } from \"src/utils/IArtGobblers.sol\";\nimport { IGOO } from \"src/utils/IGOO.sol\";\nimport { FixedPointMathLib } from \"solmate/utils/FixedPointMathLib.sol\";\nimport { toWadUnsafe, toDaysWadUnsafe } from \"solmate/utils/SignedWadMath.sol\";\nimport { LibGOO } from \"goo-issuance/LibGOO.sol\";\n\ncontract VoltronGobblers is ReentrancyGuard, Owned {\n    using FixedPointMathLib for uint256;\n\n    /*//////////////////////////////////////////////////////////////\n                                ADDRESSES\n    //////////////////////////////////////////////////////////////*/\n\n    address public immutable artGobblers;\n    address public immutable goo;\n\n    /*//////////////////////////////////////////////////////////////\n                                USER DATA\n    //////////////////////////////////////////////////////////////*/\n\n    // gobblerId => user\n    mapping(uint256 => address) public getUserByGobblerId;\n\n    /// @notice Struct holding data relevant to each user's account.\n    struct UserData {\n        // The total number of gobblers currently owned by the user.\n        uint32 gobblersOwned;\n        // The sum of the multiples of all gobblers the user holds.\n        uint32 emissionMultiple;\n        // User's goo balance at time of last checkpointing.\n        uint128 virtualBalance;\n        // claimed pool's gobbler number\n        uint16 claimedNum;\n        // Timestamp of the last goo balance checkpoint.\n        uint48 lastTimestamp;\n    }\n    /// @notice Maps user addresses to their account data.\n\n    mapping(address => UserData) public getUserData;\n\n    /*//////////////////////////////////////////////////////////////\n                                POOL DATA\n    //////////////////////////////////////////////////////////////*/\n\n    /// @dev An enum for representing whether to\n    /// increase or decrease a user's goo balance.\n    enum GooBalanceUpdateType {\n        INCREASE,\n        DECREASE\n    }\n\n    struct GlobalData {\n        // The total number of gobblers currently owned by the user.\n        uint32 totalGobblersOwned;\n        // The sum of the multiples of all gobblers the user holds.\n        uint32 totalEmissionMultiple;\n        // User's goo balance at time of last checkpointing.\n        uint128 totalVirtualBalance;\n        // Timestamp of the last goo balance checkpoint.\n        uint48 lastTimestamp;\n    }\n\n    GlobalData public globalData;\n\n    mapping(uint256 => bool) public gobblersClaimed;\n    uint256[] public claimableGobblers;\n    uint256 public claimableGobblersNum;\n\n    // only use when stop mint gobblers and could claim goo in pool\n    struct VoltronGooData {\n        uint128 claimableGoo;\n        uint64 lastTimestamp;\n    }\n\n    VoltronGooData public voltronGooData;\n\n    /*//////////////////////////////////////////////////////////////\n                                admin\n    //////////////////////////////////////////////////////////////*/\n\n    bool mintLock;\n    bool claimGobblerLock;\n    bool claimGooLock = true;\n\n    /*//////////////////////////////////////////////////////////////\n                                EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event GobblerDeposited(address indexed user, uint256[] indexed IndexedGobblerIds, uint256[] gobblerIds);\n    event GobblerWithdrawn(address indexed user, uint256[] indexed IndexedGobblerIds, uint256[] gobblerIds);\n    event GooBalanceUpdated(address indexed user, uint256 newGooBalance);\n    event GobblerMinted(uint256 indexed num, uint256[] indexed IndexedGobblerIds, uint256[] gobblerIds);\n    event GobblersClaimed(address indexed user, uint256[] indexed IndexedGobblerIds, uint256[] gobblerIds);\n    event VoltronGooClaimed(address indexed to, uint256 indexed amount);\n\n    /*//////////////////////////////////////////////////////////////\n                                MODIFIER\n    //////////////////////////////////////////////////////////////*/\n\n    modifier canMint() {\n        require(!mintLock, \"MINT_LOCK\");\n        _;\n    }\n\n    modifier canClaimGobbler() {\n        require(!claimGobblerLock, \"CLAIM_GOBBLER_LOCK\");\n        _;\n    }\n\n    modifier canClaimGoo() {\n        require(!claimGooLock, \"CLAIM_GOO_LOCK\");\n        _;\n    }\n\n    constructor(address admin_, address artGobblers_, address goo_) Owned(admin_) {\n        artGobblers = artGobblers_;\n        goo = goo_;\n    }\n\n    function depositGobblers(uint256[] calldata gobblerIds) external nonReentrant {\n        // update user virtual balance of GOO\n        updateGlobalBalance();\n        updateUserGooBalance(msg.sender, 0, GooBalanceUpdateType.INCREASE);\n\n        uint256 id;\n        address holder;\n        uint32 emissionMultiple;\n        uint32 sumEmissionMultiple;\n\n        uint32 totalNumber = uint32(gobblerIds.length);\n        for (uint256 i = 0; i < totalNumber; ++i) {\n            id = gobblerIds[i];\n            (holder,, emissionMultiple) = IArtGobblers(artGobblers).getGobblerData(id);\n            require(holder == msg.sender, \"WRONG_OWNER\");\n            require(emissionMultiple > 0, \"GOBBLER_MUST_BE_REVEALED\");\n\n            sumEmissionMultiple += emissionMultiple;\n\n            getUserByGobblerId[id] = msg.sender;\n\n            IArtGobblers(artGobblers).transferFrom(msg.sender, address(this), id);\n        }\n\n        // update user data\n        getUserData[msg.sender].gobblersOwned += totalNumber;\n        getUserData[msg.sender].emissionMultiple += sumEmissionMultiple;\n\n        // update global data\n        globalData.totalGobblersOwned += totalNumber;\n        globalData.totalEmissionMultiple += sumEmissionMultiple;\n\n        emit GobblerDeposited(msg.sender, gobblerIds, gobblerIds);\n    }\n\n    function withdrawGobblers(uint256[] calldata gobblerIds) external nonReentrant {\n        // update user virtual balance of GOO\n        updateGlobalBalance();\n        updateUserGooBalance(msg.sender, 0, GooBalanceUpdateType.DECREASE);\n\n        uint256 id;\n        address holder;\n        uint32 emissionMultiple;\n        uint32 sumEmissionMultiple;\n\n        uint32 totalNumber = uint32(gobblerIds.length);\n        for (uint256 i = 0; i < totalNumber; ++i) {\n            id = gobblerIds[i];\n            (holder,, emissionMultiple) = IArtGobblers(artGobblers).getGobblerData(id);\n            require(getUserByGobblerId[id] == msg.sender, \"WRONG_OWNER\");\n\n            sumEmissionMultiple += emissionMultiple;\n\n            delete getUserByGobblerId[id];\n\n            IArtGobblers(artGobblers).transferFrom(address(this), msg.sender, id);\n        }\n\n        // update user data\n        getUserData[msg.sender].gobblersOwned -= totalNumber;\n        getUserData[msg.sender].emissionMultiple -= sumEmissionMultiple;\n\n        // update global data\n        globalData.totalGobblersOwned -= totalNumber;\n        globalData.totalEmissionMultiple -= sumEmissionMultiple;\n\n        emit GobblerWithdrawn(msg.sender, gobblerIds, gobblerIds);\n    }\n\n    function mintVoltronGobblers(uint256 maxPrice, uint256 num) external nonReentrant canMint {\n        uint256[] memory gobblerIds = new uint256[](num);\n        for (uint256 i = 0; i < num; i++) {\n            uint256 gobblerId = IArtGobblers(artGobblers).mintFromGoo(maxPrice, true);\n            gobblerIds[i] = gobblerId;\n            claimableGobblers.push(gobblerId);\n        }\n        claimableGobblersNum += num;\n        emit GobblerMinted(num, gobblerIds, gobblerIds);\n    }\n\n    function claimVoltronGobblers(uint256[] calldata gobblerIds) external nonReentrant canClaimGobbler {\n        uint256 globalBalance = updateGlobalBalance();\n        uint256 userVirtualBalance = updateUserGooBalance(msg.sender, 0, GooBalanceUpdateType.DECREASE);\n\n        uint256 claimableNum;\n        // Since depositors before have already claimed their voltron gobblers,\n        // the last depositor will take all the voltron gobblers\n        if (getUserData[msg.sender].emissionMultiple >= globalData.totalEmissionMultiple) {\n            claimableNum = claimableGobblersNum;\n        } else {\n            // (user's virtual goo / global virtual goo) * total claimable num - claimed num\n            claimableNum =\n                userVirtualBalance.divWadDown(globalBalance).mulWadDown(claimableGobblers.length) - uint256(getUserData[msg.sender].claimedNum);\n        }\n\n\n        uint256 claimNum = gobblerIds.length;\n        require(claimableNum >= claimNum, \"CLAIM_TOO_MUCH\");\n\n        getUserData[msg.sender].claimedNum += uint16(claimNum);\n        claimableGobblersNum -= claimNum;\n\n        // claim gobblers\n        for (uint256 i = 0; i < claimNum; i++) {\n            uint256 id = gobblerIds[i];\n            require(!gobblersClaimed[id], \"GOBBLER_ALREADY_CLAIMED\");\n            gobblersClaimed[id] = true;\n            IArtGobblers(artGobblers).transferFrom(address(this), msg.sender, id);\n        }\n\n        emit GobblersClaimed(msg.sender, gobblerIds, gobblerIds);\n    }\n\n    function claimVoltronGoo() external nonReentrant canClaimGoo {\n        // require all pool gobblers have been claimed\n        require(mintLock, \"SHOULD_STOP_MINT\");\n        require(claimableGobblersNum == 0, \"SHOULD_CLAIM_GOBBLER\");\n\n        uint128 claimableGoo = voltronGooData.claimableGoo;\n\n        if (uint256(voltronGooData.lastTimestamp) < block.timestamp) {\n            claimableGoo = uint128(IArtGobblers(artGobblers).gooBalance(address(this)));\n            IArtGobblers(artGobblers).removeGoo(claimableGoo);\n            voltronGooData.lastTimestamp = uint48(block.timestamp);\n        }\n\n        uint256 globalBalance = updateGlobalBalance();\n        uint256 updatedVirtualBalance = updateUserGooBalance(msg.sender, 0, GooBalanceUpdateType.DECREASE);\n\n        uint256 amount;\n        // Since depositors before have already claimed their voltron gobblers,\n        // the last depositor will take all the voltron gobblers\n        if (getUserData[msg.sender].emissionMultiple >= globalData.totalEmissionMultiple) {\n            amount = claimableGoo;\n        } else {\n            // (user's virtual goo / global virtual goo) * total cliamable goo\n            amount = updatedVirtualBalance.divWadDown(globalBalance).mulWadDown(claimableGoo);\n        }        \n        voltronGooData.claimableGoo = uint128(claimableGoo - amount);\n\n        IGOO(goo).transfer(msg.sender, amount);\n\n        emit VoltronGooClaimed(msg.sender, amount);\n    }\n\n    function updateGlobalBalance() public returns (uint256) {\n        uint256 updatedBalance = LibGOO.computeGOOBalance(\n            globalData.totalEmissionMultiple,\n            globalData.totalVirtualBalance,\n            uint256(toDaysWadUnsafe(block.timestamp - globalData.lastTimestamp))\n        );\n        // update global balance\n        globalData.totalVirtualBalance = uint128(updatedBalance);\n        globalData.lastTimestamp = uint48(block.timestamp);\n        return updatedBalance;\n    }\n\n    /// @notice Update a user's virtual goo balance.\n    /// @param user The user whose virtual goo balance we should update.\n    /// @param gooAmount The amount of goo to update the user's virtual balance by.\n    /// @param updateType Whether to increase or decrease the user's balance by gooAmount.\n    function updateUserGooBalance(address user, uint256 gooAmount, GooBalanceUpdateType updateType) internal returns (uint256) {\n        // Will revert due to underflow if we're decreasing by more than the user's current balance.\n        // Don't need to do checked addition in the increase case, but we do it anyway for convenience.\n        uint256 updatedBalance = updateType == GooBalanceUpdateType.INCREASE ? gooBalance(user) + gooAmount : gooBalance(user) - gooAmount;\n\n        // Snapshot the user's new goo balance with the current timestamp.\n        getUserData[user].virtualBalance = uint128(updatedBalance);\n        getUserData[user].lastTimestamp = uint48(block.timestamp);\n\n        emit GooBalanceUpdated(user, updatedBalance);\n        return updatedBalance;\n    }\n\n    /// @notice Calculate a user's virtual goo balance.\n    /// @param user The user to query balance for.\n    function gooBalance(address user) public view returns (uint256) {\n        // Compute the user's virtual goo balance by leveraging LibGOO.\n        // prettier-ignore\n        return LibGOO.computeGOOBalance(\n            getUserData[user].emissionMultiple,\n            getUserData[user].virtualBalance,\n            uint256(toDaysWadUnsafe(block.timestamp - getUserData[user].lastTimestamp))\n        );\n    }\n\n    function setMintLock(bool isLock) external onlyOwner {\n        mintLock = isLock;\n    }\n\n    function setClaimGobblerLock(bool isLock) external onlyOwner {\n        claimGobblerLock = isLock;\n    }\n\n    function setClaimGooLock(bool isLock) external onlyOwner {\n        claimGooLock = isLock;\n    }\n}\n"
    },
    "lib/solmate/src/auth/Owned.sol": {
      "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Simple single owner authorization mixin.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/auth/Owned.sol)\nabstract contract Owned {\n    /*//////////////////////////////////////////////////////////////\n                                 EVENTS\n    //////////////////////////////////////////////////////////////*/\n\n    event OwnershipTransferred(address indexed user, address indexed newOwner);\n\n    /*//////////////////////////////////////////////////////////////\n                            OWNERSHIP STORAGE\n    //////////////////////////////////////////////////////////////*/\n\n    address public owner;\n\n    modifier onlyOwner() virtual {\n        require(msg.sender == owner, \"UNAUTHORIZED\");\n\n        _;\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                               CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    constructor(address _owner) {\n        owner = _owner;\n\n        emit OwnershipTransferred(address(0), _owner);\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                             OWNERSHIP LOGIC\n    //////////////////////////////////////////////////////////////*/\n\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        owner = newOwner;\n\n        emit OwnershipTransferred(msg.sender, newOwner);\n    }\n}\n"
    },
    "lib/solmate/src/utils/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Gas optimized reentrancy protection for smart contracts.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol)\n/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol)\nabstract contract ReentrancyGuard {\n    uint256 private locked = 1;\n\n    modifier nonReentrant() virtual {\n        require(locked == 1, \"REENTRANCY\");\n\n        locked = 2;\n\n        _;\n\n        locked = 1;\n    }\n}\n"
    },
    "src/utils/IArtGobblers.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IArtGobblers {\n    event Approval(address indexed owner, address indexed spender, uint256 indexed id);\n    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n    event ArtGobbled(address indexed user, uint256 indexed gobblerId, address indexed nft, uint256 id);\n    event GobblerClaimed(address indexed user, uint256 indexed gobblerId);\n    event GobblerPurchased(address indexed user, uint256 indexed gobblerId, uint256 price);\n    event GobblersRevealed(address indexed user, uint256 numGobblers, uint256 lastRevealedId);\n    event GooBalanceUpdated(address indexed user, uint256 newGooBalance);\n    event LegendaryGobblerMinted(address indexed user, uint256 indexed gobblerId, uint256[] burnedGobblerIds);\n    event OwnerUpdated(address indexed user, address indexed newOwner);\n    event RandProviderUpgraded(address indexed user, address indexed newRandProvider);\n    event RandomnessFulfilled(uint256 randomness);\n    event RandomnessRequested(address indexed user, uint256 toBeRevealed);\n    event ReservedGobblersMinted(address indexed user, uint256 lastMintedGobblerId, uint256 numGobblersEach);\n    event Transfer(address indexed from, address indexed to, uint256 indexed id);\n\n    function BASE_URI() external view returns (string memory);\n    function FIRST_LEGENDARY_GOBBLER_ID() external view returns (uint256);\n    function LEGENDARY_AUCTION_INTERVAL() external view returns (uint256);\n    function LEGENDARY_GOBBLER_INITIAL_START_PRICE() external view returns (uint256);\n    function LEGENDARY_SUPPLY() external view returns (uint256);\n    function MAX_MINTABLE() external view returns (uint256);\n    function MAX_SUPPLY() external view returns (uint256);\n    function MINTLIST_SUPPLY() external view returns (uint256);\n    function RESERVED_SUPPLY() external view returns (uint256);\n    function UNREVEALED_URI() external view returns (string memory);\n    function acceptRandomSeed(bytes32, uint256 randomness) external;\n    function addGoo(uint256 gooAmount) external;\n    function approve(address spender, uint256 id) external;\n    function balanceOf(address owner) external view returns (uint256);\n    function burnGooForPages(address user, uint256 gooAmount) external;\n    function claimGobbler(bytes32[] memory proof) external returns (uint256 gobblerId);\n    function community() external view returns (address);\n    function currentNonLegendaryId() external view returns (uint128);\n    function getApproved(uint256) external view returns (address);\n    function getCopiesOfArtGobbledByGobbler(uint256, address, uint256) external view returns (uint256);\n    function getGobblerData(uint256) external view returns (address owner, uint64 idx, uint32 emissionMultiple);\n    function getGobblerEmissionMultiple(uint256 gobblerId) external view returns (uint256);\n    function getTargetSaleTime(int256 sold) external view returns (int256);\n    function getUserData(address)\n        external\n        view\n        returns (uint32 gobblersOwned, uint32 emissionMultiple, uint128 lastBalance, uint64 lastTimestamp);\n    function getUserEmissionMultiple(address user) external view returns (uint256);\n    function getVRGDAPrice(int256 timeSinceStart, uint256 sold) external view returns (uint256);\n    function gobble(uint256 gobblerId, address nft, uint256 id, bool isERC1155) external;\n    function gobblerPrice() external view returns (uint256);\n    function gobblerRevealsData()\n        external\n        view\n        returns (uint64 randomSeed, uint64 nextRevealTimestamp, uint56 lastRevealedId, uint56 toBeRevealed, bool waitingForSeed);\n    function goo() external view returns (address);\n    function gooBalance(address user) external view returns (uint256);\n    function hasClaimedMintlistGobbler(address) external view returns (bool);\n    function isApprovedForAll(address, address) external view returns (bool);\n    function legendaryGobblerAuctionData() external view returns (uint128 startPrice, uint128 numSold);\n    function legendaryGobblerPrice() external view returns (uint256);\n    function logisticLimit() external view returns (int256);\n    function logisticLimitDoubled() external view returns (int256);\n    function merkleRoot() external view returns (bytes32);\n    function mintFromGoo(uint256 maxPrice, bool useVirtualBalance) external returns (uint256 gobblerId);\n    function mintLegendaryGobbler(uint256[] memory gobblerIds) external returns (uint256 gobblerId);\n    function mintReservedGobblers(uint256 numGobblersEach) external returns (uint256 lastMintedGobblerId);\n    function mintStart() external view returns (uint256);\n    function name() external view returns (string memory);\n    function numMintedForReserves() external view returns (uint256);\n    function numMintedFromGoo() external view returns (uint128);\n    function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) external returns (bytes4);\n    function onERC1155Received(address, address, uint256, uint256, bytes memory) external returns (bytes4);\n    function owner() external view returns (address);\n    function ownerOf(uint256 id) external view returns (address owner);\n    function pages() external view returns (address);\n    function randProvider() external view returns (address);\n    function removeGoo(uint256 gooAmount) external;\n    function requestRandomSeed() external returns (bytes32);\n    function revealGobblers(uint256 numGobblers) external;\n    function safeTransferFrom(address from, address to, uint256 id) external;\n    function safeTransferFrom(address from, address to, uint256 id, bytes memory data) external;\n    function setApprovalForAll(address operator, bool approved) external;\n    function setOwner(address newOwner) external;\n    function supportsInterface(bytes4 interfaceId) external pure returns (bool);\n    function symbol() external view returns (string memory);\n    function targetPrice() external view returns (int256);\n    function team() external view returns (address);\n    function tokenURI(uint256 gobblerId) external view returns (string memory);\n    function transferFrom(address from, address to, uint256 id) external;\n    function upgradeRandProvider(address newRandProvider) external;\n}\n"
    },
    "src/utils/IGOO.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IGOO {\n    event Approval(address indexed owner, address indexed spender, uint256 amount);\n    event Transfer(address indexed from, address indexed to, uint256 amount);\n\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n    function allowance(address, address) external view returns (uint256);\n    function approve(address spender, uint256 amount) external returns (bool);\n    function artGobblers() external view returns (address);\n    function balanceOf(address) external view returns (uint256);\n    function burnForGobblers(address from, uint256 amount) external;\n    function burnForPages(address from, uint256 amount) external;\n    function decimals() external view returns (uint8);\n    function mintForGobblers(address to, uint256 amount) external;\n    function name() external view returns (string memory);\n    function nonces(address) external view returns (uint256);\n    function pages() external view returns (address);\n    function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;\n    function symbol() external view returns (string memory);\n    function totalSupply() external view returns (uint256);\n    function transfer(address to, uint256 amount) external returns (bool);\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
    },
    "lib/solmate/src/utils/FixedPointMathLib.sol": {
      "content": "// SPDX-License-Identifier: AGPL-3.0-only\npragma solidity >=0.8.0;\n\n/// @notice Arithmetic library with operations for fixed-point numbers.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)\n/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)\nlibrary FixedPointMathLib {\n    /*//////////////////////////////////////////////////////////////\n                    SIMPLIFIED FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    uint256 internal constant MAX_UINT256 = 2**256 - 1;\n\n    uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.\n\n    function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.\n    }\n\n    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.\n    }\n\n    function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.\n    }\n\n    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {\n        return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                    LOW LEVEL FIXED POINT OPERATIONS\n    //////////////////////////////////////////////////////////////*/\n\n    function mulDivDown(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // Divide x * y by the denominator.\n            z := div(mul(x, y), denominator)\n        }\n    }\n\n    function mulDivUp(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))\n            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {\n                revert(0, 0)\n            }\n\n            // If x * y modulo the denominator is strictly greater than 0,\n            // 1 is added to round up the division of x * y by the denominator.\n            z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))\n        }\n    }\n\n    function rpow(\n        uint256 x,\n        uint256 n,\n        uint256 scalar\n    ) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            switch x\n            case 0 {\n                switch n\n                case 0 {\n                    // 0 ** 0 = 1\n                    z := scalar\n                }\n                default {\n                    // 0 ** n = 0\n                    z := 0\n                }\n            }\n            default {\n                switch mod(n, 2)\n                case 0 {\n                    // If n is even, store scalar in z for now.\n                    z := scalar\n                }\n                default {\n                    // If n is odd, store x in z for now.\n                    z := x\n                }\n\n                // Shifting right by 1 is like dividing by 2.\n                let half := shr(1, scalar)\n\n                for {\n                    // Shift n right by 1 before looping to halve it.\n                    n := shr(1, n)\n                } n {\n                    // Shift n right by 1 each iteration to halve it.\n                    n := shr(1, n)\n                } {\n                    // Revert immediately if x ** 2 would overflow.\n                    // Equivalent to iszero(eq(div(xx, x), x)) here.\n                    if shr(128, x) {\n                        revert(0, 0)\n                    }\n\n                    // Store x squared.\n                    let xx := mul(x, x)\n\n                    // Round to the nearest number.\n                    let xxRound := add(xx, half)\n\n                    // Revert if xx + half overflowed.\n                    if lt(xxRound, xx) {\n                        revert(0, 0)\n                    }\n\n                    // Set x to scaled xxRound.\n                    x := div(xxRound, scalar)\n\n                    // If n is even:\n                    if mod(n, 2) {\n                        // Compute z * x.\n                        let zx := mul(z, x)\n\n                        // If z * x overflowed:\n                        if iszero(eq(div(zx, x), z)) {\n                            // Revert if x is non-zero.\n                            if iszero(iszero(x)) {\n                                revert(0, 0)\n                            }\n                        }\n\n                        // Round to the nearest number.\n                        let zxRound := add(zx, half)\n\n                        // Revert if zx + half overflowed.\n                        if lt(zxRound, zx) {\n                            revert(0, 0)\n                        }\n\n                        // Return properly scaled zxRound.\n                        z := div(zxRound, scalar)\n                    }\n                }\n            }\n        }\n    }\n\n    /*//////////////////////////////////////////////////////////////\n                        GENERAL NUMBER UTILITIES\n    //////////////////////////////////////////////////////////////*/\n\n    function sqrt(uint256 x) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let y := x // We start y at x, which will help us make our initial estimate.\n\n            z := 181 // The \"correct\" value is 1, but this saves a multiplication later.\n\n            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad\n            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.\n\n            // We check y >= 2^(k + 8) but shift right by k bits\n            // each branch to ensure that if x >= 256, then y >= 256.\n            if iszero(lt(y, 0x10000000000000000000000000000000000)) {\n                y := shr(128, y)\n                z := shl(64, z)\n            }\n            if iszero(lt(y, 0x1000000000000000000)) {\n                y := shr(64, y)\n                z := shl(32, z)\n            }\n            if iszero(lt(y, 0x10000000000)) {\n                y := shr(32, y)\n                z := shl(16, z)\n            }\n            if iszero(lt(y, 0x1000000)) {\n                y := shr(16, y)\n                z := shl(8, z)\n            }\n\n            // Goal was to get z*z*y within a small factor of x. More iterations could\n            // get y in a tighter range. Currently, we will have y in [256, 256*2^16).\n            // We ensured y >= 256 so that the relative difference between y and y+1 is small.\n            // That's not possible if x < 256 but we can just verify those cases exhaustively.\n\n            // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.\n            // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.\n            // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.\n\n            // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range\n            // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.\n\n            // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate\n            // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.\n\n            // There is no overflow risk here since y < 2^136 after the first branch above.\n            z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.\n\n            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n            z := shr(1, add(z, div(x, z)))\n\n            // If x+1 is a perfect square, the Babylonian method cycles between\n            // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.\n            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division\n            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.\n            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.\n            z := sub(z, lt(div(x, z), z))\n        }\n    }\n\n    function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Mod x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            z := mod(x, y)\n        }\n    }\n\n    function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Divide x by y. Note this will return\n            // 0 instead of reverting if y is zero.\n            r := div(x, y)\n        }\n    }\n\n    function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Add 1 to x * y if x % y > 0. Note this will\n            // return 0 instead of reverting if y is zero.\n            z := add(gt(mod(x, y), 0), div(x, y))\n        }\n    }\n}\n"
    },
    "lib/solmate/src/utils/SignedWadMath.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\n/// @notice Signed 18 decimal fixed point (wad) arithmetic library.\n/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol)\n/// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html)\n\n/// @dev Will not revert on overflow, only use where overflow is not possible.\nfunction toWadUnsafe(uint256 x) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Multiply x by 1e18.\n        r := mul(x, 1000000000000000000)\n    }\n}\n\n/// @dev Takes an integer amount of seconds and converts it to a wad amount of days.\n/// @dev Will not revert on overflow, only use where overflow is not possible.\n/// @dev Not meant for negative second amounts, it assumes x is positive.\nfunction toDaysWadUnsafe(uint256 x) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Multiply x by 1e18 and then divide it by 86400.\n        r := div(mul(x, 1000000000000000000), 86400)\n    }\n}\n\n/// @dev Takes a wad amount of days and converts it to an integer amount of seconds.\n/// @dev Will not revert on overflow, only use where overflow is not possible.\n/// @dev Not meant for negative day amounts, it assumes x is positive.\nfunction fromDaysWadUnsafe(int256 x) pure returns (uint256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Multiply x by 86400 and then divide it by 1e18.\n        r := div(mul(x, 86400), 1000000000000000000)\n    }\n}\n\n/// @dev Will not revert on overflow, only use where overflow is not possible.\nfunction unsafeWadMul(int256 x, int256 y) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Multiply x by y and divide by 1e18.\n        r := sdiv(mul(x, y), 1000000000000000000)\n    }\n}\n\n/// @dev Will return 0 instead of reverting if y is zero and will\n/// not revert on overflow, only use where overflow is not possible.\nfunction unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Multiply x by 1e18 and divide it by y.\n        r := sdiv(mul(x, 1000000000000000000), y)\n    }\n}\n\nfunction wadMul(int256 x, int256 y) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Store x * y in r for now.\n        r := mul(x, y)\n\n        // Equivalent to require(x == 0 || (x * y) / x == y)\n        if iszero(or(iszero(x), eq(sdiv(r, x), y))) {\n            revert(0, 0)\n        }\n\n        // Scale the result down by 1e18.\n        r := sdiv(r, 1000000000000000000)\n    }\n}\n\nfunction wadDiv(int256 x, int256 y) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Store x * 1e18 in r for now.\n        r := mul(x, 1000000000000000000)\n\n        // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x))\n        if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) {\n            revert(0, 0)\n        }\n\n        // Divide r by y.\n        r := sdiv(r, y)\n    }\n}\n\nfunction wadExp(int256 x) pure returns (int256 r) {\n    unchecked {\n        // When the result is < 0.5 we return zero. This happens when\n        // x <= floor(log(0.5e18) * 1e18) ~ -42e18\n        if (x <= -42139678854452767551) return 0;\n\n        // When the result is > (2**255 - 1) / 1e18 we can not represent it as an\n        // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135.\n        if (x >= 135305999368893231589) revert(\"EXP_OVERFLOW\");\n\n        // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96\n        // for more intermediate precision and a binary basis. This base conversion\n        // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78.\n        x = (x << 78) / 5**18;\n\n        // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers\n        // of two such that exp(x) = exp(x') * 2**k, where k is an integer.\n        // Solving this gives k = round(x / log(2)) and x' = x - k * log(2).\n        int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96;\n        x = x - k * 54916777467707473351141471128;\n\n        // k is in the range [-61, 195].\n\n        // Evaluate using a (6, 7)-term rational approximation.\n        // p is made monic, we'll multiply by a scale factor later.\n        int256 y = x + 1346386616545796478920950773328;\n        y = ((y * x) >> 96) + 57155421227552351082224309758442;\n        int256 p = y + x - 94201549194550492254356042504812;\n        p = ((p * y) >> 96) + 28719021644029726153956944680412240;\n        p = p * x + (4385272521454847904659076985693276 << 96);\n\n        // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n        int256 q = x - 2855989394907223263936484059900;\n        q = ((q * x) >> 96) + 50020603652535783019961831881945;\n        q = ((q * x) >> 96) - 533845033583426703283633433725380;\n        q = ((q * x) >> 96) + 3604857256930695427073651918091429;\n        q = ((q * x) >> 96) - 14423608567350463180887372962807573;\n        q = ((q * x) >> 96) + 26449188498355588339934803723976023;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Div in assembly because solidity adds a zero check despite the unchecked.\n            // The q polynomial won't have zeros in the domain as all its roots are complex.\n            // No scaling is necessary because p is already 2**96 too large.\n            r := sdiv(p, q)\n        }\n\n        // r should be in the range (0.09, 0.25) * 2**96.\n\n        // We now need to multiply r by:\n        // * the scale factor s = ~6.031367120.\n        // * the 2**k factor from the range reduction.\n        // * the 1e18 / 2**96 factor for base conversion.\n        // We do this all at once, with an intermediate result in 2**213\n        // basis, so the final right shift is always by a positive amount.\n        r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k));\n    }\n}\n\nfunction wadLn(int256 x) pure returns (int256 r) {\n    unchecked {\n        require(x > 0, \"UNDEFINED\");\n\n        // We want to convert x from 10**18 fixed point to 2**96 fixed point.\n        // We do this by multiplying by 2**96 / 10**18. But since\n        // ln(x * C) = ln(x) + ln(C), we can simply do nothing here\n        // and add ln(2**96 / 10**18) at the end.\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x))\n            r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x))))\n            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))\n            r := or(r, shl(4, lt(0xffff, shr(r, x))))\n            r := or(r, shl(3, lt(0xff, shr(r, x))))\n            r := or(r, shl(2, lt(0xf, shr(r, x))))\n            r := or(r, shl(1, lt(0x3, shr(r, x))))\n            r := or(r, lt(0x1, shr(r, x)))\n        }\n\n        // Reduce range of x to (1, 2) * 2**96\n        // ln(2^k * x) = k * ln(2) + ln(x)\n        int256 k = r - 96;\n        x <<= uint256(159 - k);\n        x = int256(uint256(x) >> 159);\n\n        // Evaluate using a (8, 8)-term rational approximation.\n        // p is made monic, we will multiply by a scale factor later.\n        int256 p = x + 3273285459638523848632254066296;\n        p = ((p * x) >> 96) + 24828157081833163892658089445524;\n        p = ((p * x) >> 96) + 43456485725739037958740375743393;\n        p = ((p * x) >> 96) - 11111509109440967052023855526967;\n        p = ((p * x) >> 96) - 45023709667254063763336534515857;\n        p = ((p * x) >> 96) - 14706773417378608786704636184526;\n        p = p * x - (795164235651350426258249787498 << 96);\n\n        // We leave p in 2**192 basis so we don't need to scale it back up for the division.\n        // q is monic by convention.\n        int256 q = x + 5573035233440673466300451813936;\n        q = ((q * x) >> 96) + 71694874799317883764090561454958;\n        q = ((q * x) >> 96) + 283447036172924575727196451306956;\n        q = ((q * x) >> 96) + 401686690394027663651624208769553;\n        q = ((q * x) >> 96) + 204048457590392012362485061816622;\n        q = ((q * x) >> 96) + 31853899698501571402653359427138;\n        q = ((q * x) >> 96) + 909429971244387300277376558375;\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Div in assembly because solidity adds a zero check despite the unchecked.\n            // The q polynomial is known not to have zeros in the domain.\n            // No scaling required because p is already 2**96 too large.\n            r := sdiv(p, q)\n        }\n\n        // r is in the range (0, 0.125) * 2**96\n\n        // Finalization, we need to:\n        // * multiply by the scale factor s = 5.549…\n        // * add ln(2**96 / 10**18)\n        // * add k * ln(2)\n        // * multiply by 10**18 / 2**96 = 5**18 >> 78\n\n        // mul s * 5e18 * 2**96, base is now 5**18 * 2**192\n        r *= 1677202110996718588342820967067443963516166;\n        // add ln(2) * k * 5e18 * 2**192\n        r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k;\n        // add ln(2**96 / 10**18) * 5e18 * 2**192\n        r += 600920179829731861736702779321621459595472258049074101567377883020018308;\n        // base conversion: mul 2**18 / 2**192\n        r >>= 174;\n    }\n}\n\n/// @dev Will return 0 instead of reverting if y is zero.\nfunction unsafeDiv(int256 x, int256 y) pure returns (int256 r) {\n    /// @solidity memory-safe-assembly\n    assembly {\n        // Divide x by y.\n        r := sdiv(x, y)\n    }\n}\n"
    },
    "lib/art-gobblers/lib/goo-issuance/src/LibGOO.sol": {
      "content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport {FixedPointMathLib} from \"solmate/utils/FixedPointMathLib.sol\";\n\n/// @title GOO (Gradual Ownership Optimization) Issuance\n/// @author transmissions11 <[email protected]>\n/// @author FrankieIsLost <[email protected]>\n/// @notice Implementation of the GOO Issuance mechanism.\nlibrary LibGOO {\n    using FixedPointMathLib for uint256;\n\n    /// @notice Compute goo balance based on emission multiple, last balance, and time elapsed.\n    /// @param emissionMultiple The multiple on emissions to consider when computing the balance.\n    /// @param lastBalanceWad The last checkpointed balance to apply the emission multiple over time to, scaled by 1e18.\n    /// @param timeElapsedWad The time elapsed since the last checkpoint, scaled by 1e18.\n    function computeGOOBalance(\n        uint256 emissionMultiple,\n        uint256 lastBalanceWad,\n        uint256 timeElapsedWad\n    ) internal pure returns (uint256) {\n        unchecked {\n            // We use wad math here because timeElapsedWad is, as the name indicates, a wad.\n            uint256 timeElapsedSquaredWad = timeElapsedWad.mulWadDown(timeElapsedWad);\n\n            // prettier-ignore\n            return lastBalanceWad + // The last recorded balance.\n\n            // Don't need to do wad multiplication since we're\n            // multiplying by a plain integer with no decimals.\n            // Shift right by 2 is equivalent to division by 4.\n            ((emissionMultiple * timeElapsedSquaredWad) >> 2) +\n\n            timeElapsedWad.mulWadDown( // Terms are wads, so must mulWad.\n                // No wad multiplication for emissionMultiple * lastBalance\n                // because emissionMultiple is a plain integer with no decimals.\n                // We multiply the sqrt's radicand by 1e18 because it expects ints.\n                (emissionMultiple * lastBalanceWad * 1e18).sqrt()\n            );\n        }\n    }\n}\n"
    }
  },
  "settings": {
    "remappings": [
      "VRGDAs/=lib/art-gobblers/lib/VRGDAs/src/",
      "art-gobblers/=lib/art-gobblers/",
      "chainlink/=lib/art-gobblers/lib/chainlink/contracts/src/",
      "ds-test/=lib/art-gobblers/lib/ds-test/src/",
      "forge-std/=lib/forge-std/src/",
      "goo-issuance/=lib/art-gobblers/lib/goo-issuance/src/",
      "murky/=lib/murky/src/",
      "openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/",
      "solmate/=lib/solmate/src/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "metadata": {
      "bytecodeHash": "ipfs"
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "london",
    "libraries": {}
  }
}