{
  "address": "0x44B1d66E7B9d4467139924f31754F34cbC392f44",
  "abi": [
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_owner",
          "type": "address"
        },
        {
          "internalType": "uint8",
          "name": "_cardinality",
          "type": "uint8"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "constructor"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "uint32",
          "name": "drawId",
          "type": "uint32"
        },
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "indexed": false,
          "internalType": "struct IDrawBeacon.Draw",
          "name": "draw",
          "type": "tuple"
        }
      ],
      "name": "DrawSet",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "previousManager",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "newManager",
          "type": "address"
        }
      ],
      "name": "ManagerTransferred",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "pendingOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipOffered",
      "type": "event"
    },
    {
      "anonymous": false,
      "inputs": [
        {
          "indexed": true,
          "internalType": "address",
          "name": "previousOwner",
          "type": "address"
        },
        {
          "indexed": true,
          "internalType": "address",
          "name": "newOwner",
          "type": "address"
        }
      ],
      "name": "OwnershipTransferred",
      "type": "event"
    },
    {
      "inputs": [],
      "name": "MAX_CARDINALITY",
      "outputs": [
        {
          "internalType": "uint16",
          "name": "",
          "type": "uint16"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "claimOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "getBufferCardinality",
      "outputs": [
        {
          "internalType": "uint32",
          "name": "",
          "type": "uint32"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint32",
          "name": "drawId",
          "type": "uint32"
        }
      ],
      "name": "getDraw",
      "outputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw",
          "name": "",
          "type": "tuple"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "getDrawCount",
      "outputs": [
        {
          "internalType": "uint32",
          "name": "",
          "type": "uint32"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "uint32[]",
          "name": "_drawIds",
          "type": "uint32[]"
        }
      ],
      "name": "getDraws",
      "outputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw[]",
          "name": "",
          "type": "tuple[]"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "getNewestDraw",
      "outputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw",
          "name": "",
          "type": "tuple"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "getOldestDraw",
      "outputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw",
          "name": "",
          "type": "tuple"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "manager",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "owner",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "pendingOwner",
      "outputs": [
        {
          "internalType": "address",
          "name": "",
          "type": "address"
        }
      ],
      "stateMutability": "view",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw",
          "name": "_draw",
          "type": "tuple"
        }
      ],
      "name": "pushDraw",
      "outputs": [
        {
          "internalType": "uint32",
          "name": "",
          "type": "uint32"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [],
      "name": "renounceOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "uint256",
              "name": "winningRandomNumber",
              "type": "uint256"
            },
            {
              "internalType": "uint32",
              "name": "drawId",
              "type": "uint32"
            },
            {
              "internalType": "uint64",
              "name": "timestamp",
              "type": "uint64"
            },
            {
              "internalType": "uint64",
              "name": "beaconPeriodStartedAt",
              "type": "uint64"
            },
            {
              "internalType": "uint32",
              "name": "beaconPeriodSeconds",
              "type": "uint32"
            }
          ],
          "internalType": "struct IDrawBeacon.Draw",
          "name": "_newDraw",
          "type": "tuple"
        }
      ],
      "name": "setDraw",
      "outputs": [
        {
          "internalType": "uint32",
          "name": "",
          "type": "uint32"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_newManager",
          "type": "address"
        }
      ],
      "name": "setManager",
      "outputs": [
        {
          "internalType": "bool",
          "name": "",
          "type": "bool"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },
    {
      "inputs": [
        {
          "internalType": "address",
          "name": "_newOwner",
          "type": "address"
        }
      ],
      "name": "transferOwnership",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ],
  "transactionHash": "0x653dc0f4cacbe9f64aae19dc7dabc0cba841d3ed87efbb2ee403b53809acae68",
  "receipt": {
    "to": null,
    "from": "0xE0F4217390221aF47855E094F6e112D43C8698fE",
    "contractAddress": "0x44B1d66E7B9d4467139924f31754F34cbC392f44",
    "transactionIndex": 54,
    "gasUsed": "1355589",
    "logsBloom": "0x00000000010200000000000000000000000000000020000000800000000000000000000000000000000000000000000000008000000000000000000000000000000004000000000000000000000000800001000000000000400100400000000000000000020000000000000000000800008000000000000080000000000000400000000000000000800000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004000000000000000000001000000000000000000000000000000100000000020000000000000000000000000000000000000000000000000000200000000100000",
    "blockHash": "0xbd1ff89779bebf7a2945f3558348291f0192e16c545d840882fecb39b212e2a5",
    "transactionHash": "0x653dc0f4cacbe9f64aae19dc7dabc0cba841d3ed87efbb2ee403b53809acae68",
    "logs": [
      {
        "transactionIndex": 54,
        "blockNumber": 20226795,
        "transactionHash": "0x653dc0f4cacbe9f64aae19dc7dabc0cba841d3ed87efbb2ee403b53809acae68",
        "address": "0x44B1d66E7B9d4467139924f31754F34cbC392f44",
        "topics": [
          "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
          "0x0000000000000000000000000000000000000000000000000000000000000000",
          "0x000000000000000000000000e0f4217390221af47855e094f6e112d43c8698fe"
        ],
        "data": "0x",
        "logIndex": 219,
        "blockHash": "0xbd1ff89779bebf7a2945f3558348291f0192e16c545d840882fecb39b212e2a5"
      },
      {
        "transactionIndex": 54,
        "blockNumber": 20226795,
        "transactionHash": "0x653dc0f4cacbe9f64aae19dc7dabc0cba841d3ed87efbb2ee403b53809acae68",
        "address": "0x0000000000000000000000000000000000001010",
        "topics": [
          "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
          "0x0000000000000000000000000000000000000000000000000000000000001010",
          "0x000000000000000000000000e0f4217390221af47855e094f6e112d43c8698fe",
          "0x0000000000000000000000007b5000af8ab69fd59eb0d4f5762bff57c9c04385"
        ],
        "data": "0x00000000000000000000000000000000000000000000000000907b07c8315c00000000000000000000000000000000000000000000000005628d237e33c7fb1a0000000000000000000000000000000000000000000029504dd6b940d6fdd01900000000000000000000000000000000000000000000000561fca8766b969f1a0000000000000000000000000000000000000000000029504e6734489f2f2c19",
        "logIndex": 220,
        "blockHash": "0xbd1ff89779bebf7a2945f3558348291f0192e16c545d840882fecb39b212e2a5"
      }
    ],
    "blockNumber": 20226795,
    "cumulativeGasUsed": "7646740",
    "status": 1,
    "byzantium": true
  },
  "args": [
    "0xE0F4217390221aF47855E094F6e112D43C8698fE",
    255
  ],
  "solcInputHash": "7e8084d0a22db9e877c42567b125a31e",
  "metadata": "{\"compiler\":{\"version\":\"0.8.6+commit.11564f7e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"_cardinality\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"indexed\":false,\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"draw\",\"type\":\"tuple\"}],\"name\":\"DrawSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousManager\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newManager\",\"type\":\"address\"}],\"name\":\"ManagerTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pendingOwner\",\"type\":\"address\"}],\"name\":\"OwnershipOffered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"MAX_CARDINALITY\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBufferCardinality\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"}],\"name\":\"getDraw\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDrawCount\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"_drawIds\",\"type\":\"uint32[]\"}],\"name\":\"getDraws\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getNewestDraw\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getOldestDraw\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingOwner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"_draw\",\"type\":\"tuple\"}],\"name\":\"pushDraw\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"winningRandomNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"drawId\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"beaconPeriodStartedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"beaconPeriodSeconds\",\"type\":\"uint32\"}],\"internalType\":\"struct IDrawBeacon.Draw\",\"name\":\"_newDraw\",\"type\":\"tuple\"}],\"name\":\"setDraw\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newManager\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"PoolTogether Inc Team\",\"details\":\"A DrawBuffer store a limited number of Draws before beginning to overwrite (managed via the cardinality) previous Draws.All mainnet DrawBuffer(s) are updated directly from a DrawBeacon, but non-mainnet DrawBuffer(s) (Matic, Optimism, Arbitrum, etc...) will receive a cross-chain message, duplicating the mainnet Draw configuration - enabling a prize savings liquidity network.\",\"kind\":\"dev\",\"methods\":{\"claimOwnership()\":{\"details\":\"This function is only callable by the `_pendingOwner`.\"},\"constructor\":{\"params\":{\"_cardinality\":\"Draw ring buffer cardinality.\",\"_owner\":\"Address of the owner of the DrawBuffer.\"}},\"getBufferCardinality()\":{\"returns\":{\"_0\":\"Ring buffer cardinality\"}},\"getDraw(uint32)\":{\"details\":\"Read a Draw using the Draw.drawId to calculate position in the draws ring buffer.\",\"params\":{\"drawId\":\"Draw.drawId\"},\"returns\":{\"_0\":\"IDrawBeacon.Draw\"}},\"getDrawCount()\":{\"details\":\"If no Draws have been pushed, it will return 0.If the ring buffer is full, it will return the cardinality.Otherwise, it will return the NewestDraw index + 1.\",\"returns\":{\"_0\":\"Number of Draws held in the draw ring buffer.\"}},\"getDraws(uint32[])\":{\"details\":\"Read multiple Draws using each drawId to calculate position in the draws ring buffer.\",\"params\":{\"drawIds\":\"Array of drawIds\"},\"returns\":{\"_0\":\"IDrawBeacon.Draw[]\"}},\"getNewestDraw()\":{\"details\":\"Uses the nextDrawIndex to calculate the most recently added Draw.\",\"returns\":{\"_0\":\"IDrawBeacon.Draw\"}},\"getOldestDraw()\":{\"details\":\"Finds the oldest Draw by comparing and/or diffing totalDraws with the cardinality.\",\"returns\":{\"_0\":\"IDrawBeacon.Draw\"}},\"manager()\":{\"returns\":{\"_0\":\"Current `_manager` address.\"}},\"pendingOwner()\":{\"returns\":{\"_0\":\"Current `_pendingOwner` address.\"}},\"pushDraw((uint256,uint32,uint64,uint64,uint32))\":{\"details\":\"Push new draw onto draws history via authorized manager or owner.\",\"params\":{\"draw\":\"IDrawBeacon.Draw\"},\"returns\":{\"_0\":\"Draw.drawId\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setDraw((uint256,uint32,uint64,uint64,uint32))\":{\"details\":\"Updating a Draw should be used sparingly and only in the event an incorrect Draw parameter has been stored.\",\"params\":{\"newDraw\":\"IDrawBeacon.Draw\"},\"returns\":{\"_0\":\"Draw.drawId\"}},\"setManager(address)\":{\"details\":\"Throws if called by any account other than the owner.\",\"params\":{\"_newManager\":\"New _manager address.\"},\"returns\":{\"_0\":\"Boolean to indicate if the operation was successful or not.\"}},\"transferOwnership(address)\":{\"params\":{\"_newOwner\":\"Address to transfer ownership to.\"}}},\"title\":\"PoolTogether V4 DrawBuffer\",\"version\":1},\"userdoc\":{\"events\":{\"DrawSet(uint32,(uint256,uint32,uint64,uint64,uint32))\":{\"notice\":\"Emit when a new draw has been created.\"}},\"kind\":\"user\",\"methods\":{\"MAX_CARDINALITY()\":{\"notice\":\"Draws ring buffer max length.\"},\"claimOwnership()\":{\"notice\":\"Allows the `_pendingOwner` address to finalize the transfer.\"},\"constructor\":{\"notice\":\"Deploy DrawBuffer smart contract.\"},\"getBufferCardinality()\":{\"notice\":\"Read a ring buffer cardinality\"},\"getDraw(uint32)\":{\"notice\":\"Read a Draw from the draws ring buffer.\"},\"getDrawCount()\":{\"notice\":\"Gets the number of Draws held in the draw ring buffer.\"},\"getDraws(uint32[])\":{\"notice\":\"Read multiple Draws from the draws ring buffer.\"},\"getNewestDraw()\":{\"notice\":\"Read newest Draw from draws ring buffer.\"},\"getOldestDraw()\":{\"notice\":\"Read oldest Draw from draws ring buffer.\"},\"manager()\":{\"notice\":\"Gets current `_manager`.\"},\"owner()\":{\"notice\":\"Returns the address of the current owner.\"},\"pendingOwner()\":{\"notice\":\"Gets current `_pendingOwner`.\"},\"pushDraw((uint256,uint32,uint64,uint64,uint32))\":{\"notice\":\"Push Draw onto draws ring buffer history.\"},\"renounceOwnership()\":{\"notice\":\"Renounce ownership of the contract.\"},\"setDraw((uint256,uint32,uint64,uint64,uint32))\":{\"notice\":\"Set existing Draw in draws ring buffer with new parameters.\"},\"setManager(address)\":{\"notice\":\"Set or change of manager.\"},\"transferOwnership(address)\":{\"notice\":\"Allows current owner to set the `_pendingOwner` address.\"}},\"notice\":\"The DrawBuffer provides historical lookups of Draws via a circular ring buffer. Historical Draws can be accessed on-chain using a drawId to calculate ring buffer storage slot. The Draw settings can be created by manager/owner and existing Draws can only be updated the owner. Once a starting Draw has been added to the ring buffer, all following draws must have a sequential Draw ID.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"@pooltogether/v4-core/contracts/DrawBuffer.sol\":\"DrawBuffer\"},\"evmVersion\":\"berlin\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":2000},\"remappings\":[]},\"sources\":{\"@pooltogether/owner-manager-contracts/contracts/Manageable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Ownable.sol\\\";\\n\\n/**\\n * @title Abstract manageable contract that can be inherited by other contracts\\n * @notice Contract module based on Ownable which provides a basic access control mechanism, where\\n * there is an owner and a manager that can be granted exclusive access to specific functions.\\n *\\n * By default, the owner is the deployer of the contract.\\n *\\n * The owner account is set through a two steps process.\\n *      1. The current `owner` calls {transferOwnership} to set a `pendingOwner`\\n *      2. The `pendingOwner` calls {acceptOwnership} to accept the ownership transfer\\n *\\n * The manager account needs to be set using {setManager}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyManager`, which can be applied to your functions to restrict their use to\\n * the manager.\\n */\\nabstract contract Manageable is Ownable {\\n    address private _manager;\\n\\n    /**\\n     * @dev Emitted when `_manager` has been changed.\\n     * @param previousManager previous `_manager` address.\\n     * @param newManager new `_manager` address.\\n     */\\n    event ManagerTransferred(address indexed previousManager, address indexed newManager);\\n\\n    /* ============ External Functions ============ */\\n\\n    /**\\n     * @notice Gets current `_manager`.\\n     * @return Current `_manager` address.\\n     */\\n    function manager() public view virtual returns (address) {\\n        return _manager;\\n    }\\n\\n    /**\\n     * @notice Set or change of manager.\\n     * @dev Throws if called by any account other than the owner.\\n     * @param _newManager New _manager address.\\n     * @return Boolean to indicate if the operation was successful or not.\\n     */\\n    function setManager(address _newManager) external onlyOwner returns (bool) {\\n        return _setManager(_newManager);\\n    }\\n\\n    /* ============ Internal Functions ============ */\\n\\n    /**\\n     * @notice Set or change of manager.\\n     * @param _newManager New _manager address.\\n     * @return Boolean to indicate if the operation was successful or not.\\n     */\\n    function _setManager(address _newManager) private returns (bool) {\\n        address _previousManager = _manager;\\n\\n        require(_newManager != _previousManager, \\\"Manageable/existing-manager-address\\\");\\n\\n        _manager = _newManager;\\n\\n        emit ManagerTransferred(_previousManager, _newManager);\\n        return true;\\n    }\\n\\n    /* ============ Modifier Functions ============ */\\n\\n    /**\\n     * @dev Throws if called by any account other than the manager.\\n     */\\n    modifier onlyManager() {\\n        require(manager() == msg.sender, \\\"Manageable/caller-not-manager\\\");\\n        _;\\n    }\\n\\n    /**\\n     * @dev Throws if called by any account other than the manager or the owner.\\n     */\\n    modifier onlyManagerOrOwner() {\\n        require(manager() == msg.sender || owner() == msg.sender, \\\"Manageable/caller-not-manager-or-owner\\\");\\n        _;\\n    }\\n}\\n\",\"keccak256\":\"0xdd8ac008df192c6aa4df83e7037ab090970fda38e1f9fd712bc0ab5e0485fc04\",\"license\":\"GPL-3.0\"},\"@pooltogether/owner-manager-contracts/contracts/Ownable.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Abstract ownable contract that can be inherited by other contracts\\n * @notice Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner is the deployer of the contract.\\n *\\n * The owner account is set through a two steps process.\\n *      1. The current `owner` calls {transferOwnership} to set a `pendingOwner`\\n *      2. The `pendingOwner` calls {acceptOwnership} to accept the ownership transfer\\n *\\n * The manager account needs to be set using {setManager}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract Ownable {\\n    address private _owner;\\n    address private _pendingOwner;\\n\\n    /**\\n     * @dev Emitted when `_pendingOwner` has been changed.\\n     * @param pendingOwner new `_pendingOwner` address.\\n     */\\n    event OwnershipOffered(address indexed pendingOwner);\\n\\n    /**\\n     * @dev Emitted when `_owner` has been changed.\\n     * @param previousOwner previous `_owner` address.\\n     * @param newOwner new `_owner` address.\\n     */\\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n    /* ============ Deploy ============ */\\n\\n    /**\\n     * @notice Initializes the contract setting `_initialOwner` as the initial owner.\\n     * @param _initialOwner Initial owner of the contract.\\n     */\\n    constructor(address _initialOwner) {\\n        _setOwner(_initialOwner);\\n    }\\n\\n    /* ============ External Functions ============ */\\n\\n    /**\\n     * @notice Returns the address of the current owner.\\n     */\\n    function owner() public view virtual returns (address) {\\n        return _owner;\\n    }\\n\\n    /**\\n     * @notice Gets current `_pendingOwner`.\\n     * @return Current `_pendingOwner` address.\\n     */\\n    function pendingOwner() external view virtual returns (address) {\\n        return _pendingOwner;\\n    }\\n\\n    /**\\n     * @notice Renounce ownership of the contract.\\n     * @dev Leaves the contract without owner. It will not be possible to call\\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\\n     *\\n     * NOTE: Renouncing ownership will leave the contract without an owner,\\n     * thereby removing any functionality that is only available to the owner.\\n     */\\n    function renounceOwnership() external virtual onlyOwner {\\n        _setOwner(address(0));\\n    }\\n\\n    /**\\n    * @notice Allows current owner to set the `_pendingOwner` address.\\n    * @param _newOwner Address to transfer ownership to.\\n    */\\n    function transferOwnership(address _newOwner) external onlyOwner {\\n        require(_newOwner != address(0), \\\"Ownable/pendingOwner-not-zero-address\\\");\\n\\n        _pendingOwner = _newOwner;\\n\\n        emit OwnershipOffered(_newOwner);\\n    }\\n\\n    /**\\n    * @notice Allows the `_pendingOwner` address to finalize the transfer.\\n    * @dev This function is only callable by the `_pendingOwner`.\\n    */\\n    function claimOwnership() external onlyPendingOwner {\\n        _setOwner(_pendingOwner);\\n        _pendingOwner = address(0);\\n    }\\n\\n    /* ============ Internal Functions ============ */\\n\\n    /**\\n     * @notice Internal function to set the `_owner` of the contract.\\n     * @param _newOwner New `_owner` address.\\n     */\\n    function _setOwner(address _newOwner) private {\\n        address _oldOwner = _owner;\\n        _owner = _newOwner;\\n        emit OwnershipTransferred(_oldOwner, _newOwner);\\n    }\\n\\n    /* ============ Modifier Functions ============ */\\n\\n    /**\\n     * @dev Throws if called by any account other than the owner.\\n     */\\n    modifier onlyOwner() {\\n        require(owner() == msg.sender, \\\"Ownable/caller-not-owner\\\");\\n        _;\\n    }\\n\\n    /**\\n    * @dev Throws if called by any account other than the `pendingOwner`.\\n    */\\n    modifier onlyPendingOwner() {\\n        require(msg.sender == _pendingOwner, \\\"Ownable/caller-not-pendingOwner\\\");\\n        _;\\n    }\\n}\\n\",\"keccak256\":\"0xfd0fd374812c8af45f2633cc7cc4811ccb7bad0a3902a43aded35939eb4a00d1\",\"license\":\"GPL-3.0\"},\"@pooltogether/pooltogether-rng-contracts/contracts/RNGInterface.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.6.0;\\n\\n/// @title Random Number Generator Interface\\n/// @notice Provides an interface for requesting random numbers from 3rd-party RNG services (Chainlink VRF, Starkware VDF, etc..)\\ninterface RNGInterface {\\n\\n  /// @notice Emitted when a new request for a random number has been submitted\\n  /// @param requestId The indexed ID of the request used to get the results of the RNG service\\n  /// @param sender The indexed address of the sender of the request\\n  event RandomNumberRequested(uint32 indexed requestId, address indexed sender);\\n\\n  /// @notice Emitted when an existing request for a random number has been completed\\n  /// @param requestId The indexed ID of the request used to get the results of the RNG service\\n  /// @param randomNumber The random number produced by the 3rd-party service\\n  event RandomNumberCompleted(uint32 indexed requestId, uint256 randomNumber);\\n\\n  /// @notice Gets the last request id used by the RNG service\\n  /// @return requestId The last request id used in the last request\\n  function getLastRequestId() external view returns (uint32 requestId);\\n\\n  /// @notice Gets the Fee for making a Request against an RNG service\\n  /// @return feeToken The address of the token that is used to pay fees\\n  /// @return requestFee The fee required to be paid to make a request\\n  function getRequestFee() external view returns (address feeToken, uint256 requestFee);\\n\\n  /// @notice Sends a request for a random number to the 3rd-party service\\n  /// @dev Some services will complete the request immediately, others may have a time-delay\\n  /// @dev Some services require payment in the form of a token, such as $LINK for Chainlink VRF\\n  /// @return requestId The ID of the request used to get the results of the RNG service\\n  /// @return lockBlock The block number at which the RNG service will start generating time-delayed randomness.  The calling contract\\n  /// should \\\"lock\\\" all activity until the result is available via the `requestId`\\n  function requestRandomNumber() external returns (uint32 requestId, uint32 lockBlock);\\n\\n  /// @notice Checks if the request for randomness from the 3rd-party service has completed\\n  /// @dev For time-delayed requests, this function is used to check/confirm completion\\n  /// @param requestId The ID of the request used to get the results of the RNG service\\n  /// @return isCompleted True if the request has completed and a random number is available, false otherwise\\n  function isRequestComplete(uint32 requestId) external view returns (bool isCompleted);\\n\\n  /// @notice Gets the random number produced by the 3rd-party service\\n  /// @param requestId The ID of the request used to get the results of the RNG service\\n  /// @return randomNum The random number\\n  function randomNumber(uint32 requestId) external returns (uint256 randomNum);\\n}\\n\",\"keccak256\":\"0xf917c68439d7476cd226f475e8fce940e0cf1d32cb0ff12e8537072a07f2b1da\",\"license\":\"GPL-3.0\"},\"@pooltogether/v4-core/contracts/DrawBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity 0.8.6;\\n\\nimport \\\"@pooltogether/owner-manager-contracts/contracts/Manageable.sol\\\";\\n\\nimport \\\"./interfaces/IDrawBuffer.sol\\\";\\nimport \\\"./interfaces/IDrawBeacon.sol\\\";\\nimport \\\"./libraries/DrawRingBufferLib.sol\\\";\\n\\n/**\\n  * @title  PoolTogether V4 DrawBuffer\\n  * @author PoolTogether Inc Team\\n  * @notice The DrawBuffer provides historical lookups of Draws via a circular ring buffer.\\n            Historical Draws can be accessed on-chain using a drawId to calculate ring buffer storage slot.\\n            The Draw settings can be created by manager/owner and existing Draws can only be updated the owner.\\n            Once a starting Draw has been added to the ring buffer, all following draws must have a sequential Draw ID.\\n    @dev    A DrawBuffer store a limited number of Draws before beginning to overwrite (managed via the cardinality) previous Draws.\\n    @dev    All mainnet DrawBuffer(s) are updated directly from a DrawBeacon, but non-mainnet DrawBuffer(s) (Matic, Optimism, Arbitrum, etc...)\\n            will receive a cross-chain message, duplicating the mainnet Draw configuration - enabling a prize savings liquidity network.\\n*/\\ncontract DrawBuffer is IDrawBuffer, Manageable {\\n    using DrawRingBufferLib for DrawRingBufferLib.Buffer;\\n\\n    /// @notice Draws ring buffer max length.\\n    uint16 public constant MAX_CARDINALITY = 256;\\n\\n    /// @notice Draws ring buffer array.\\n    IDrawBeacon.Draw[MAX_CARDINALITY] private drawRingBuffer;\\n\\n    /// @notice Holds ring buffer information\\n    DrawRingBufferLib.Buffer internal bufferMetadata;\\n\\n    /* ============ Deploy ============ */\\n\\n    /**\\n     * @notice Deploy DrawBuffer smart contract.\\n     * @param _owner Address of the owner of the DrawBuffer.\\n     * @param _cardinality Draw ring buffer cardinality.\\n     */\\n    constructor(address _owner, uint8 _cardinality) Ownable(_owner) {\\n        bufferMetadata.cardinality = _cardinality;\\n    }\\n\\n    /* ============ External Functions ============ */\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getBufferCardinality() external view override returns (uint32) {\\n        return bufferMetadata.cardinality;\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getDraw(uint32 drawId) external view override returns (IDrawBeacon.Draw memory) {\\n        return drawRingBuffer[_drawIdToDrawIndex(bufferMetadata, drawId)];\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getDraws(uint32[] calldata _drawIds)\\n        external\\n        view\\n        override\\n        returns (IDrawBeacon.Draw[] memory)\\n    {\\n        IDrawBeacon.Draw[] memory draws = new IDrawBeacon.Draw[](_drawIds.length);\\n        DrawRingBufferLib.Buffer memory buffer = bufferMetadata;\\n\\n        for (uint256 index = 0; index < _drawIds.length; index++) {\\n            draws[index] = drawRingBuffer[_drawIdToDrawIndex(buffer, _drawIds[index])];\\n        }\\n\\n        return draws;\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getDrawCount() external view override returns (uint32) {\\n        DrawRingBufferLib.Buffer memory buffer = bufferMetadata;\\n\\n        if (buffer.lastDrawId == 0) {\\n            return 0;\\n        }\\n\\n        uint32 bufferNextIndex = buffer.nextIndex;\\n\\n        if (drawRingBuffer[bufferNextIndex].timestamp != 0) {\\n            return buffer.cardinality;\\n        } else {\\n            return bufferNextIndex;\\n        }\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getNewestDraw() external view override returns (IDrawBeacon.Draw memory) {\\n        return _getNewestDraw(bufferMetadata);\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function getOldestDraw() external view override returns (IDrawBeacon.Draw memory) {\\n        // oldest draw should be next available index, otherwise it's at 0\\n        DrawRingBufferLib.Buffer memory buffer = bufferMetadata;\\n        IDrawBeacon.Draw memory draw = drawRingBuffer[buffer.nextIndex];\\n\\n        if (draw.timestamp == 0) {\\n            // if draw is not init, then use draw at 0\\n            draw = drawRingBuffer[0];\\n        }\\n\\n        return draw;\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function pushDraw(IDrawBeacon.Draw memory _draw)\\n        external\\n        override\\n        onlyManagerOrOwner\\n        returns (uint32)\\n    {\\n        return _pushDraw(_draw);\\n    }\\n\\n    /// @inheritdoc IDrawBuffer\\n    function setDraw(IDrawBeacon.Draw memory _newDraw) external override onlyOwner returns (uint32) {\\n        DrawRingBufferLib.Buffer memory buffer = bufferMetadata;\\n        uint32 index = buffer.getIndex(_newDraw.drawId);\\n        drawRingBuffer[index] = _newDraw;\\n        emit DrawSet(_newDraw.drawId, _newDraw);\\n        return _newDraw.drawId;\\n    }\\n\\n    /* ============ Internal Functions ============ */\\n\\n    /**\\n     * @notice Convert a Draw.drawId to a Draws ring buffer index pointer.\\n     * @dev    The getNewestDraw.drawId() is used to calculate a Draws ID delta position.\\n     * @param _drawId Draw.drawId\\n     * @return Draws ring buffer index pointer\\n     */\\n    function _drawIdToDrawIndex(DrawRingBufferLib.Buffer memory _buffer, uint32 _drawId)\\n        internal\\n        pure\\n        returns (uint32)\\n    {\\n        return _buffer.getIndex(_drawId);\\n    }\\n\\n    /**\\n     * @notice Read newest Draw from the draws ring buffer.\\n     * @dev    Uses the lastDrawId to calculate the most recently added Draw.\\n     * @param _buffer Draw ring buffer\\n     * @return IDrawBeacon.Draw\\n     */\\n    function _getNewestDraw(DrawRingBufferLib.Buffer memory _buffer)\\n        internal\\n        view\\n        returns (IDrawBeacon.Draw memory)\\n    {\\n        return drawRingBuffer[_buffer.getIndex(_buffer.lastDrawId)];\\n    }\\n\\n    /**\\n     * @notice Push Draw onto draws ring buffer history.\\n     * @dev    Push new draw onto draws list via authorized manager or owner.\\n     * @param _newDraw IDrawBeacon.Draw\\n     * @return Draw.drawId\\n     */\\n    function _pushDraw(IDrawBeacon.Draw memory _newDraw) internal returns (uint32) {\\n        DrawRingBufferLib.Buffer memory _buffer = bufferMetadata;\\n        drawRingBuffer[_buffer.nextIndex] = _newDraw;\\n        bufferMetadata = _buffer.push(_newDraw.drawId);\\n\\n        emit DrawSet(_newDraw.drawId, _newDraw);\\n\\n        return _newDraw.drawId;\\n    }\\n}\\n\",\"keccak256\":\"0xf43efd6c3f4b3fe67b8ccbf8c69e5137ccaad68a381114afdb5f37cd820d4ccb\",\"license\":\"GPL-3.0\"},\"@pooltogether/v4-core/contracts/interfaces/IDrawBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity 0.8.6;\\n\\nimport \\\"@pooltogether/pooltogether-rng-contracts/contracts/RNGInterface.sol\\\";\\nimport \\\"./IDrawBuffer.sol\\\";\\n\\n/** @title  IDrawBeacon\\n  * @author PoolTogether Inc Team\\n  * @notice The DrawBeacon interface.\\n*/\\ninterface IDrawBeacon {\\n\\n    /// @notice Draw struct created every draw\\n    /// @param winningRandomNumber The random number returned from the RNG service\\n    /// @param drawId The monotonically increasing drawId for each draw\\n    /// @param timestamp Unix timestamp of the draw. Recorded when the draw is created by the DrawBeacon.\\n    /// @param beaconPeriodStartedAt Unix timestamp of when the draw started\\n    /// @param beaconPeriodSeconds Unix timestamp of the beacon draw period for this draw.\\n    struct Draw {\\n        uint256 winningRandomNumber;\\n        uint32 drawId;\\n        uint64 timestamp;\\n        uint64 beaconPeriodStartedAt;\\n        uint32 beaconPeriodSeconds;\\n    }\\n\\n    /**\\n     * @notice Emit when a new DrawBuffer has been set.\\n     * @param newDrawBuffer       The new DrawBuffer address\\n     */\\n    event DrawBufferUpdated(IDrawBuffer indexed newDrawBuffer);\\n\\n    /**\\n     * @notice Emit when a draw has opened.\\n     * @param startedAt Start timestamp\\n     */\\n    event BeaconPeriodStarted(uint64 indexed startedAt);\\n\\n    /**\\n     * @notice Emit when a draw has started.\\n     * @param rngRequestId  draw id\\n     * @param rngLockBlock  Block when draw becomes invalid\\n     */\\n    event DrawStarted(uint32 indexed rngRequestId, uint32 rngLockBlock);\\n\\n    /**\\n     * @notice Emit when a draw has been cancelled.\\n     * @param rngRequestId  draw id\\n     * @param rngLockBlock  Block when draw becomes invalid\\n     */\\n    event DrawCancelled(uint32 indexed rngRequestId, uint32 rngLockBlock);\\n\\n    /**\\n     * @notice Emit when a draw has been completed.\\n     * @param randomNumber  Random number generated from draw\\n     */\\n    event DrawCompleted(uint256 randomNumber);\\n\\n    /**\\n     * @notice Emit when a RNG service address is set.\\n     * @param rngService  RNG service address\\n     */\\n    event RngServiceUpdated(RNGInterface indexed rngService);\\n\\n    /**\\n     * @notice Emit when a draw timeout param is set.\\n     * @param rngTimeout  draw timeout param in seconds\\n     */\\n    event RngTimeoutSet(uint32 rngTimeout);\\n\\n    /**\\n     * @notice Emit when the drawPeriodSeconds is set.\\n     * @param drawPeriodSeconds Time between draw\\n     */\\n    event BeaconPeriodSecondsUpdated(uint32 drawPeriodSeconds);\\n\\n    /**\\n     * @notice Returns the number of seconds remaining until the beacon period can be complete.\\n     * @return The number of seconds remaining until the beacon period can be complete.\\n     */\\n    function beaconPeriodRemainingSeconds() external view returns (uint64);\\n\\n    /**\\n     * @notice Returns the timestamp at which the beacon period ends\\n     * @return The timestamp at which the beacon period ends.\\n     */\\n    function beaconPeriodEndAt() external view returns (uint64);\\n\\n    /**\\n     * @notice Returns whether a Draw can be started.\\n     * @return True if a Draw can be started, false otherwise.\\n     */\\n    function canStartDraw() external view returns (bool);\\n\\n    /**\\n     * @notice Returns whether a Draw can be completed.\\n     * @return True if a Draw can be completed, false otherwise.\\n     */\\n    function canCompleteDraw() external view returns (bool);\\n\\n    /**\\n     * @notice Calculates when the next beacon period will start.\\n     * @param time The timestamp to use as the current time\\n     * @return The timestamp at which the next beacon period would start\\n     */\\n    function calculateNextBeaconPeriodStartTime(uint64 time) external view returns (uint64);\\n\\n    /**\\n     * @notice Can be called by anyone to cancel the draw request if the RNG has timed out.\\n     */\\n    function cancelDraw() external;\\n\\n    /**\\n     * @notice Completes the Draw (RNG) request and pushes a Draw onto DrawBuffer.\\n     */\\n    function completeDraw() external;\\n\\n    /**\\n     * @notice Returns the block number that the current RNG request has been locked to.\\n     * @return The block number that the RNG request is locked to\\n     */\\n    function getLastRngLockBlock() external view returns (uint32);\\n\\n    /**\\n     * @notice Returns the current RNG Request ID.\\n     * @return The current Request ID\\n     */\\n    function getLastRngRequestId() external view returns (uint32);\\n\\n    /**\\n     * @notice Returns whether the beacon period is over\\n     * @return True if the beacon period is over, false otherwise\\n     */\\n    function isBeaconPeriodOver() external view returns (bool);\\n\\n    /**\\n     * @notice Returns whether the random number request has completed.\\n     * @return True if a random number request has completed, false otherwise.\\n     */\\n    function isRngCompleted() external view returns (bool);\\n\\n    /**\\n     * @notice Returns whether a random number has been requested\\n     * @return True if a random number has been requested, false otherwise.\\n     */\\n    function isRngRequested() external view returns (bool);\\n\\n    /**\\n     * @notice Returns whether the random number request has timed out.\\n     * @return True if a random number request has timed out, false otherwise.\\n     */\\n    function isRngTimedOut() external view returns (bool);\\n\\n    /**\\n     * @notice Allows the owner to set the beacon period in seconds.\\n     * @param beaconPeriodSeconds The new beacon period in seconds.  Must be greater than zero.\\n     */\\n    function setBeaconPeriodSeconds(uint32 beaconPeriodSeconds) external;\\n\\n    /**\\n     * @notice Allows the owner to set the RNG request timeout in seconds. This is the time that must elapsed before the RNG request can be cancelled and the pool unlocked.\\n     * @param rngTimeout The RNG request timeout in seconds.\\n     */\\n    function setRngTimeout(uint32 rngTimeout) external;\\n\\n    /**\\n     * @notice Sets the RNG service that the Prize Strategy is connected to\\n     * @param rngService The address of the new RNG service interface\\n     */\\n    function setRngService(RNGInterface rngService) external;\\n\\n    /**\\n     * @notice Starts the Draw process by starting random number request. The previous beacon period must have ended.\\n     * @dev The RNG-Request-Fee is expected to be held within this contract before calling this function\\n     */\\n    function startDraw() external;\\n\\n    /**\\n     * @notice Set global DrawBuffer variable.\\n     * @dev    All subsequent Draw requests/completions will be pushed to the new DrawBuffer.\\n     * @param newDrawBuffer DrawBuffer address\\n     * @return DrawBuffer\\n     */\\n    function setDrawBuffer(IDrawBuffer newDrawBuffer) external returns (IDrawBuffer);\\n}\\n\",\"keccak256\":\"0x43213073a191399978af2c7464c5e39af09efeeb503005d4e2a79705c40baa32\",\"license\":\"GPL-3.0\"},\"@pooltogether/v4-core/contracts/interfaces/IDrawBuffer.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity 0.8.6;\\n\\nimport \\\"../interfaces/IDrawBeacon.sol\\\";\\n\\n/** @title  IDrawBuffer\\n  * @author PoolTogether Inc Team\\n  * @notice The DrawBuffer interface.\\n*/\\ninterface IDrawBuffer {\\n    /**\\n     * @notice Emit when a new draw has been created.\\n     * @param drawId Draw id\\n     * @param draw The Draw struct\\n     */\\n    event DrawSet(uint32 indexed drawId, IDrawBeacon.Draw draw);\\n\\n    /**\\n     * @notice Read a ring buffer cardinality\\n     * @return Ring buffer cardinality\\n     */\\n    function getBufferCardinality() external view returns (uint32);\\n\\n    /**\\n     * @notice Read a Draw from the draws ring buffer.\\n     * @dev    Read a Draw using the Draw.drawId to calculate position in the draws ring buffer.\\n     * @param drawId Draw.drawId\\n     * @return IDrawBeacon.Draw\\n     */\\n    function getDraw(uint32 drawId) external view returns (IDrawBeacon.Draw memory);\\n\\n    /**\\n     * @notice Read multiple Draws from the draws ring buffer.\\n     * @dev    Read multiple Draws using each drawId to calculate position in the draws ring buffer.\\n     * @param drawIds Array of drawIds\\n     * @return IDrawBeacon.Draw[]\\n     */\\n    function getDraws(uint32[] calldata drawIds) external view returns (IDrawBeacon.Draw[] memory);\\n\\n    /**\\n     * @notice Gets the number of Draws held in the draw ring buffer.\\n     * @dev If no Draws have been pushed, it will return 0.\\n     * @dev If the ring buffer is full, it will return the cardinality.\\n     * @dev Otherwise, it will return the NewestDraw index + 1.\\n     * @return Number of Draws held in the draw ring buffer.\\n     */\\n    function getDrawCount() external view returns (uint32);\\n\\n    /**\\n     * @notice Read newest Draw from draws ring buffer.\\n     * @dev    Uses the nextDrawIndex to calculate the most recently added Draw.\\n     * @return IDrawBeacon.Draw\\n     */\\n    function getNewestDraw() external view returns (IDrawBeacon.Draw memory);\\n\\n    /**\\n     * @notice Read oldest Draw from draws ring buffer.\\n     * @dev    Finds the oldest Draw by comparing and/or diffing totalDraws with the cardinality.\\n     * @return IDrawBeacon.Draw\\n     */\\n    function getOldestDraw() external view returns (IDrawBeacon.Draw memory);\\n\\n    /**\\n     * @notice Push Draw onto draws ring buffer history.\\n     * @dev    Push new draw onto draws history via authorized manager or owner.\\n     * @param draw IDrawBeacon.Draw\\n     * @return Draw.drawId\\n     */\\n    function pushDraw(IDrawBeacon.Draw calldata draw) external returns (uint32);\\n\\n    /**\\n     * @notice Set existing Draw in draws ring buffer with new parameters.\\n     * @dev    Updating a Draw should be used sparingly and only in the event an incorrect Draw parameter has been stored.\\n     * @param newDraw IDrawBeacon.Draw\\n     * @return Draw.drawId\\n     */\\n    function setDraw(IDrawBeacon.Draw calldata newDraw) external returns (uint32);\\n}\\n\",\"keccak256\":\"0x209ff20406b6b45ff5eff40af05c41a5d697441fc84e2e015e6828d874ccaa83\",\"license\":\"GPL-3.0\"},\"@pooltogether/v4-core/contracts/libraries/DrawRingBufferLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity 0.8.6;\\n\\nimport \\\"./RingBufferLib.sol\\\";\\n\\n/// @title Library for creating and managing a draw ring buffer.\\nlibrary DrawRingBufferLib {\\n    /// @notice Draw buffer struct.\\n    struct Buffer {\\n        uint32 lastDrawId;\\n        uint32 nextIndex;\\n        uint32 cardinality;\\n    }\\n\\n    /// @notice Helper function to know if the draw ring buffer has been initialized.\\n    /// @dev since draws start at 1 and are monotonically increased, we know we are uninitialized if nextIndex = 0 and lastDrawId = 0.\\n    /// @param _buffer The buffer to check.\\n    function isInitialized(Buffer memory _buffer) internal pure returns (bool) {\\n        return !(_buffer.nextIndex == 0 && _buffer.lastDrawId == 0);\\n    }\\n\\n    /// @notice Push a draw to the buffer.\\n    /// @param _buffer The buffer to push to.\\n    /// @param _drawId The drawID to push.\\n    /// @return The new buffer.\\n    function push(Buffer memory _buffer, uint32 _drawId) internal pure returns (Buffer memory) {\\n        require(!isInitialized(_buffer) || _drawId == _buffer.lastDrawId + 1, \\\"DRB/must-be-contig\\\");\\n\\n        return\\n            Buffer({\\n                lastDrawId: _drawId,\\n                nextIndex: uint32(RingBufferLib.nextIndex(_buffer.nextIndex, _buffer.cardinality)),\\n                cardinality: _buffer.cardinality\\n            });\\n    }\\n\\n    /// @notice Get draw ring buffer index pointer.\\n    /// @param _buffer The buffer to get the `nextIndex` from.\\n    /// @param _drawId The draw id to get the index for.\\n    /// @return The draw ring buffer index pointer.\\n    function getIndex(Buffer memory _buffer, uint32 _drawId) internal pure returns (uint32) {\\n        require(isInitialized(_buffer) && _drawId <= _buffer.lastDrawId, \\\"DRB/future-draw\\\");\\n\\n        uint32 indexOffset = _buffer.lastDrawId - _drawId;\\n        require(indexOffset < _buffer.cardinality, \\\"DRB/expired-draw\\\");\\n\\n        uint256 mostRecent = RingBufferLib.newestIndex(_buffer.nextIndex, _buffer.cardinality);\\n\\n        return uint32(RingBufferLib.offset(uint32(mostRecent), indexOffset, _buffer.cardinality));\\n    }\\n}\\n\",\"keccak256\":\"0xdcf6f0b0a5c176e505dcd284d1f160fcd5b4c6ba5868047935de3cd1a41fe675\",\"license\":\"GPL-3.0\"},\"@pooltogether/v4-core/contracts/libraries/RingBufferLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity 0.8.6;\\n\\nlibrary RingBufferLib {\\n    /**\\n    * @notice Returns wrapped TWAB index.\\n    * @dev  In order to navigate the TWAB circular buffer, we need to use the modulo operator.\\n    * @dev  For example, if `_index` is equal to 32 and the TWAB circular buffer is of `_cardinality` 32,\\n    *       it will return 0 and will point to the first element of the array.\\n    * @param _index Index used to navigate through the TWAB circular buffer.\\n    * @param _cardinality TWAB buffer cardinality.\\n    * @return TWAB index.\\n    */\\n    function wrap(uint256 _index, uint256 _cardinality) internal pure returns (uint256) {\\n        return _index % _cardinality;\\n    }\\n\\n    /**\\n    * @notice Computes the negative offset from the given index, wrapped by the cardinality.\\n    * @dev  We add `_cardinality` to `_index` to be able to offset even if `_amount` is superior to `_cardinality`.\\n    * @param _index The index from which to offset\\n    * @param _amount The number of indices to offset.  This is subtracted from the given index.\\n    * @param _cardinality The number of elements in the ring buffer\\n    * @return Offsetted index.\\n     */\\n    function offset(\\n        uint256 _index,\\n        uint256 _amount,\\n        uint256 _cardinality\\n    ) internal pure returns (uint256) {\\n        return wrap(_index + _cardinality - _amount, _cardinality);\\n    }\\n\\n    /// @notice Returns the index of the last recorded TWAB\\n    /// @param _nextIndex The next available twab index.  This will be recorded to next.\\n    /// @param _cardinality The cardinality of the TWAB history.\\n    /// @return The index of the last recorded TWAB\\n    function newestIndex(uint256 _nextIndex, uint256 _cardinality)\\n        internal\\n        pure\\n        returns (uint256)\\n    {\\n        if (_cardinality == 0) {\\n            return 0;\\n        }\\n\\n        return wrap(_nextIndex + _cardinality - 1, _cardinality);\\n    }\\n\\n    /// @notice Computes the ring buffer index that follows the given one, wrapped by cardinality\\n    /// @param _index The index to increment\\n    /// @param _cardinality The number of elements in the Ring Buffer\\n    /// @return The next index relative to the given index.  Will wrap around to 0 if the next index == cardinality\\n    function nextIndex(uint256 _index, uint256 _cardinality)\\n        internal\\n        pure\\n        returns (uint256)\\n    {\\n        return wrap(_index + 1, _cardinality);\\n    }\\n}\\n\",\"keccak256\":\"0x052e3bf6bfb30f32950e322c853589a8d153cf34f4b1ee292b17eb46f2ae656c\",\"license\":\"GPL-3.0\"}},\"version\":1}",
  "bytecode": "0x608060405234801561001057600080fd5b506040516117cb3803806117cb83398101604081905261002f916100b6565b8161003981610066565b50610203805463ffffffff60401b191660ff92909216680100000000000000000291909117905550610102565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100c957600080fd5b82516001600160a01b03811681146100e057600080fd5b602084015190925060ff811681146100f757600080fd5b809150509250929050565b6116ba806101116000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d0ebdbe711610066578063d0ebdbe714610209578063d7bcb86b1461022c578063e30c39781461023f578063f2fde38b1461025057600080fd5b80638da5cb5b146101b5578063c4df5fed146101c6578063caeef7ec146101ce578063d0bb78f3146101e957600080fd5b8063648b1b4f116100d3578063648b1b4f14610176578063715018a61461017e5780638200d8731461018657806383c34aaf146101a257600080fd5b8063089eb925146101055780630edb1d2e14610132578063481c6a75146101475780634e71e0c81461016c575b600080fd5b6101186101133660046113ed565b610263565b60405163ffffffff90911681526020015b60405180910390f35b61013a61032e565b6040516101299190611533565b6002546001600160a01b03165b6040516001600160a01b039091168152602001610129565b6101746103a3565b005b61013a610431565b610174610586565b61018f61010081565b60405161ffff9091168152602001610129565b61013a6101b0366004611482565b6105fb565b6000546001600160a01b0316610154565b6101186106f6565b6102035468010000000000000000900463ffffffff16610118565b6101fc6101f7366004611378565b610798565b604051610129919061149d565b61021c61021736600461134f565b610948565b6040519015158152602001610129565b61011861023a3660046113ed565b6109bc565b6001546001600160a01b0316610154565b61017461025e36600461134f565b610ba9565b6000336102786002546001600160a01b031690565b6001600160a01b031614806102a657503361029b6000546001600160a01b031690565b6001600160a01b0316145b61031d5760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e6572000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61032682610ce5565b90505b919050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915261039e90610ee7565b905090565b6001546001600160a01b031633146103fd5760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610314565b600154610412906001600160a01b0316610f22565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084018190526801000000000000000090920416928201929092529060009060039061010081106104b2576104b2611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff640100000000830481169484018590526c010000000000000000000000008304166060840152600160a01b909104166080820152915061058057506040805160a081018252600354815260045463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b900490911660808201525b92915050565b336105996000546001600160a01b031690565b6001600160a01b0316146105ef5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b6105f96000610f22565b565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915260039061066f9084610f7f565b63ffffffff16610100811061068657610686611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b9004909116608082015292915050565b604080516060810182526102035463ffffffff80821680845264010000000083048216602085015268010000000000000000909204169282019290925260009161074257600091505090565b6020810151600363ffffffff8216610100811061076157610761611658565b6002020160010160049054906101000a900467ffffffffffffffff1667ffffffffffffffff16600014610580575060400151919050565b606060008267ffffffffffffffff8111156107b5576107b561166e565b60405190808252806020026020018201604052801561080e57816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816107d35790505b50604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915290915060005b8481101561093e57600361088b8388888581811061087157610871611658565b90506020020160208101906108869190611482565b610f7f565b63ffffffff1661010081106108a2576108a2611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b90049091166080820152835184908390811061092057610920611658565b6020026020010181905250808061093690611605565b915050610851565b5090949350505050565b60003361095d6000546001600160a01b031690565b6001600160a01b0316146109b35760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b61032682610f92565b6000336109d16000546001600160a01b031690565b6001600160a01b031614610a275760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b604080516060810182526102035463ffffffff808216835264010000000082048116602080850191909152680100000000000000009092048116938301939093528401519091600091610a7d9184919061107e16565b90508360038263ffffffff166101008110610a9a57610a9a611658565b82516002919091029190910190815560208083015160019092018054604080860151606087015160809097015163ffffffff9687166bffffffffffffffffffffffff199094169390931764010000000067ffffffffffffffff92831602177fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000091909716027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1695909517600160a01b9185169190910217905586015191519116907fc6f337e5507fd1bdebc6d79ed14168145e8c109d7b7139459692e24f06baed1790610b97908790611533565b60405180910390a25050506020015190565b33610bbc6000546001600160a01b031690565b6001600160a01b031614610c125760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b6001600160a01b038116610c8e5760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610314565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b604080516060810182526102035463ffffffff8082168352640100000000820481166020840181905268010000000000000000909204169282019290925260009183906003906101008110610d3c57610d3c611658565b825160029190910291909101908155602080830151600190920180546040850151606086015160809096015163ffffffff9586166bffffffffffffffffffffffff199093169290921764010000000067ffffffffffffffff92831602177fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000091909616027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1694909417600160a01b948416949094029390931790925590840151610e18918391906111ae16565b8051610203805460208085015160409586015163ffffffff90811668010000000000000000027fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff928216640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909516968216969096179390931716939093179091559085015191519116907fc6f337e5507fd1bdebc6d79ed14168145e8c109d7b7139459692e24f06baed1790610ed6908690611533565b60405180910390a250506020015190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152815160039061066f90849061107e565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610f8b838361107e565b9392505050565b6002546000906001600160a01b0390811690831681141561101b5760405162461bcd60e51b815260206004820152602360248201527f4d616e61676561626c652f6578697374696e672d6d616e616765722d6164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610314565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385811691821790925560405190918316907f9cb45c728de594dab506a1f1a8554e24c8eeaf983618d5ec5dd7bc6f3c49feee90600090a350600192915050565b600061108983611299565b80156110a55750826000015163ffffffff168263ffffffff1611155b6110f15760405162461bcd60e51b815260206004820152600f60248201527f4452422f6675747572652d6472617700000000000000000000000000000000006044820152606401610314565b82516000906111019084906115e0565b9050836040015163ffffffff168163ffffffff16106111625760405162461bcd60e51b815260206004820152601060248201527f4452422f657870697265642d64726177000000000000000000000000000000006044820152606401610314565b6000611182856020015163ffffffff16866040015163ffffffff166112c1565b90506111a58163ffffffff168363ffffffff16876040015163ffffffff166112ef565b95945050505050565b60408051606081018252600080825260208201819052918101919091526111d483611299565b15806111f7575082516111e89060016115a1565b63ffffffff168263ffffffff16145b6112435760405162461bcd60e51b815260206004820152601260248201527f4452422f6d7573742d62652d636f6e74696700000000000000000000000000006044820152606401610314565b60405180606001604052808363ffffffff168152602001611278856020015163ffffffff16866040015163ffffffff16611307565b63ffffffff168152602001846040015163ffffffff16815250905092915050565b6000816020015163ffffffff1660001480156112ba5750815163ffffffff16155b1592915050565b6000816112d057506000610580565b610f8b60016112df8486611589565b6112e991906115c9565b83611317565b60006112ff836112df8487611589565b949350505050565b6000610f8b6112e9846001611589565b6000610f8b8284611620565b803563ffffffff8116811461032957600080fd5b803567ffffffffffffffff8116811461032957600080fd5b60006020828403121561136157600080fd5b81356001600160a01b0381168114610f8b57600080fd5b6000806020838503121561138b57600080fd5b823567ffffffffffffffff808211156113a357600080fd5b818501915085601f8301126113b757600080fd5b8135818111156113c657600080fd5b8660208260051b85010111156113db57600080fd5b60209290920196919550909350505050565b600060a082840312156113ff57600080fd5b60405160a0810181811067ffffffffffffffff8211171561143057634e487b7160e01b600052604160045260246000fd5b6040528235815261144360208401611323565b602082015261145460408401611337565b604082015261146560608401611337565b606082015261147660808401611323565b60808201529392505050565b60006020828403121561149457600080fd5b610f8b82611323565b6020808252825182820181905260009190848201906040850190845b818110156115275761151483855180518252602081015163ffffffff80821660208501526040830151915067ffffffffffffffff80831660408601528060608501511660608601525080608084015116608085015250505050565b9284019260a092909201916001016114b9565b50909695505050505050565b60a08101610580828480518252602081015163ffffffff80821660208501526040830151915067ffffffffffffffff80831660408601528060608501511660608601525080608084015116608085015250505050565b6000821982111561159c5761159c611642565b500190565b600063ffffffff8083168185168083038211156115c0576115c0611642565b01949350505050565b6000828210156115db576115db611642565b500390565b600063ffffffff838116908316818110156115fd576115fd611642565b039392505050565b600060001982141561161957611619611642565b5060010190565b60008261163d57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220d24adc87e36960dc7264bd5ef9ac5c7908548298b076d6b21cbfb13083462bab64736f6c63430008060033",
  "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063d0ebdbe711610066578063d0ebdbe714610209578063d7bcb86b1461022c578063e30c39781461023f578063f2fde38b1461025057600080fd5b80638da5cb5b146101b5578063c4df5fed146101c6578063caeef7ec146101ce578063d0bb78f3146101e957600080fd5b8063648b1b4f116100d3578063648b1b4f14610176578063715018a61461017e5780638200d8731461018657806383c34aaf146101a257600080fd5b8063089eb925146101055780630edb1d2e14610132578063481c6a75146101475780634e71e0c81461016c575b600080fd5b6101186101133660046113ed565b610263565b60405163ffffffff90911681526020015b60405180910390f35b61013a61032e565b6040516101299190611533565b6002546001600160a01b03165b6040516001600160a01b039091168152602001610129565b6101746103a3565b005b61013a610431565b610174610586565b61018f61010081565b60405161ffff9091168152602001610129565b61013a6101b0366004611482565b6105fb565b6000546001600160a01b0316610154565b6101186106f6565b6102035468010000000000000000900463ffffffff16610118565b6101fc6101f7366004611378565b610798565b604051610129919061149d565b61021c61021736600461134f565b610948565b6040519015158152602001610129565b61011861023a3660046113ed565b6109bc565b6001546001600160a01b0316610154565b61017461025e36600461134f565b610ba9565b6000336102786002546001600160a01b031690565b6001600160a01b031614806102a657503361029b6000546001600160a01b031690565b6001600160a01b0316145b61031d5760405162461bcd60e51b815260206004820152602660248201527f4d616e61676561626c652f63616c6c65722d6e6f742d6d616e616765722d6f7260448201527f2d6f776e6572000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61032682610ce5565b90505b919050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915261039e90610ee7565b905090565b6001546001600160a01b031633146103fd5760405162461bcd60e51b815260206004820152601f60248201527f4f776e61626c652f63616c6c65722d6e6f742d70656e64696e674f776e6572006044820152606401610314565b600154610412906001600160a01b0316610f22565b6001805473ffffffffffffffffffffffffffffffffffffffff19169055565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084018190526801000000000000000090920416928201929092529060009060039061010081106104b2576104b2611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff640100000000830481169484018590526c010000000000000000000000008304166060840152600160a01b909104166080820152915061058057506040805160a081018252600354815260045463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b900490911660808201525b92915050565b336105996000546001600160a01b031690565b6001600160a01b0316146105ef5760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b6105f96000610f22565b565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915260039061066f9084610f7f565b63ffffffff16610100811061068657610686611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b9004909116608082015292915050565b604080516060810182526102035463ffffffff80821680845264010000000083048216602085015268010000000000000000909204169282019290925260009161074257600091505090565b6020810151600363ffffffff8216610100811061076157610761611658565b6002020160010160049054906101000a900467ffffffffffffffff1667ffffffffffffffff16600014610580575060400151919050565b606060008267ffffffffffffffff8111156107b5576107b561166e565b60405190808252806020026020018201604052801561080e57816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816107d35790505b50604080516060810182526102035463ffffffff808216835264010000000082048116602084015268010000000000000000909104169181019190915290915060005b8481101561093e57600361088b8388888581811061087157610871611658565b90506020020160208101906108869190611482565b610f7f565b63ffffffff1661010081106108a2576108a2611658565b6040805160a08101825260029290920292909201805482526001015463ffffffff808216602084015267ffffffffffffffff64010000000083048116948401949094526c0100000000000000000000000082049093166060830152600160a01b90049091166080820152835184908390811061092057610920611658565b6020026020010181905250808061093690611605565b915050610851565b5090949350505050565b60003361095d6000546001600160a01b031690565b6001600160a01b0316146109b35760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b61032682610f92565b6000336109d16000546001600160a01b031690565b6001600160a01b031614610a275760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b604080516060810182526102035463ffffffff808216835264010000000082048116602080850191909152680100000000000000009092048116938301939093528401519091600091610a7d9184919061107e16565b90508360038263ffffffff166101008110610a9a57610a9a611658565b82516002919091029190910190815560208083015160019092018054604080860151606087015160809097015163ffffffff9687166bffffffffffffffffffffffff199094169390931764010000000067ffffffffffffffff92831602177fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000091909716027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1695909517600160a01b9185169190910217905586015191519116907fc6f337e5507fd1bdebc6d79ed14168145e8c109d7b7139459692e24f06baed1790610b97908790611533565b60405180910390a25050506020015190565b33610bbc6000546001600160a01b031690565b6001600160a01b031614610c125760405162461bcd60e51b815260206004820152601860248201527f4f776e61626c652f63616c6c65722d6e6f742d6f776e657200000000000000006044820152606401610314565b6001600160a01b038116610c8e5760405162461bcd60e51b815260206004820152602560248201527f4f776e61626c652f70656e64696e674f776e65722d6e6f742d7a65726f2d616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610314565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f239a2ddded15777fa246aed5f7e1a9bc69a39d4eb4a397034d1d85766cca7d4c90600090a250565b604080516060810182526102035463ffffffff8082168352640100000000820481166020840181905268010000000000000000909204169282019290925260009183906003906101008110610d3c57610d3c611658565b825160029190910291909101908155602080830151600190920180546040850151606086015160809096015163ffffffff9586166bffffffffffffffffffffffff199093169290921764010000000067ffffffffffffffff92831602177fffffffffffffffff000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000091909616027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1694909417600160a01b948416949094029390931790925590840151610e18918391906111ae16565b8051610203805460208085015160409586015163ffffffff90811668010000000000000000027fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff928216640100000000027fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909516968216969096179390931716939093179091559085015191519116907fc6f337e5507fd1bdebc6d79ed14168145e8c109d7b7139459692e24f06baed1790610ed6908690611533565b60405180910390a250506020015190565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152815160039061066f90849061107e565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610f8b838361107e565b9392505050565b6002546000906001600160a01b0390811690831681141561101b5760405162461bcd60e51b815260206004820152602360248201527f4d616e61676561626c652f6578697374696e672d6d616e616765722d6164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610314565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385811691821790925560405190918316907f9cb45c728de594dab506a1f1a8554e24c8eeaf983618d5ec5dd7bc6f3c49feee90600090a350600192915050565b600061108983611299565b80156110a55750826000015163ffffffff168263ffffffff1611155b6110f15760405162461bcd60e51b815260206004820152600f60248201527f4452422f6675747572652d6472617700000000000000000000000000000000006044820152606401610314565b82516000906111019084906115e0565b9050836040015163ffffffff168163ffffffff16106111625760405162461bcd60e51b815260206004820152601060248201527f4452422f657870697265642d64726177000000000000000000000000000000006044820152606401610314565b6000611182856020015163ffffffff16866040015163ffffffff166112c1565b90506111a58163ffffffff168363ffffffff16876040015163ffffffff166112ef565b95945050505050565b60408051606081018252600080825260208201819052918101919091526111d483611299565b15806111f7575082516111e89060016115a1565b63ffffffff168263ffffffff16145b6112435760405162461bcd60e51b815260206004820152601260248201527f4452422f6d7573742d62652d636f6e74696700000000000000000000000000006044820152606401610314565b60405180606001604052808363ffffffff168152602001611278856020015163ffffffff16866040015163ffffffff16611307565b63ffffffff168152602001846040015163ffffffff16815250905092915050565b6000816020015163ffffffff1660001480156112ba5750815163ffffffff16155b1592915050565b6000816112d057506000610580565b610f8b60016112df8486611589565b6112e991906115c9565b83611317565b60006112ff836112df8487611589565b949350505050565b6000610f8b6112e9846001611589565b6000610f8b8284611620565b803563ffffffff8116811461032957600080fd5b803567ffffffffffffffff8116811461032957600080fd5b60006020828403121561136157600080fd5b81356001600160a01b0381168114610f8b57600080fd5b6000806020838503121561138b57600080fd5b823567ffffffffffffffff808211156113a357600080fd5b818501915085601f8301126113b757600080fd5b8135818111156113c657600080fd5b8660208260051b85010111156113db57600080fd5b60209290920196919550909350505050565b600060a082840312156113ff57600080fd5b60405160a0810181811067ffffffffffffffff8211171561143057634e487b7160e01b600052604160045260246000fd5b6040528235815261144360208401611323565b602082015261145460408401611337565b604082015261146560608401611337565b606082015261147660808401611323565b60808201529392505050565b60006020828403121561149457600080fd5b610f8b82611323565b6020808252825182820181905260009190848201906040850190845b818110156115275761151483855180518252602081015163ffffffff80821660208501526040830151915067ffffffffffffffff80831660408601528060608501511660608601525080608084015116608085015250505050565b9284019260a092909201916001016114b9565b50909695505050505050565b60a08101610580828480518252602081015163ffffffff80821660208501526040830151915067ffffffffffffffff80831660408601528060608501511660608601525080608084015116608085015250505050565b6000821982111561159c5761159c611642565b500190565b600063ffffffff8083168185168083038211156115c0576115c0611642565b01949350505050565b6000828210156115db576115db611642565b500390565b600063ffffffff838116908316818110156115fd576115fd611642565b039392505050565b600060001982141561161957611619611642565b5060010190565b60008261163d57634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220d24adc87e36960dc7264bd5ef9ac5c7908548298b076d6b21cbfb13083462bab64736f6c63430008060033",
  "devdoc": {
    "author": "PoolTogether Inc Team",
    "details": "A DrawBuffer store a limited number of Draws before beginning to overwrite (managed via the cardinality) previous Draws.All mainnet DrawBuffer(s) are updated directly from a DrawBeacon, but non-mainnet DrawBuffer(s) (Matic, Optimism, Arbitrum, etc...) will receive a cross-chain message, duplicating the mainnet Draw configuration - enabling a prize savings liquidity network.",
    "kind": "dev",
    "methods": {
      "claimOwnership()": {
        "details": "This function is only callable by the `_pendingOwner`."
      },
      "constructor": {
        "params": {
          "_cardinality": "Draw ring buffer cardinality.",
          "_owner": "Address of the owner of the DrawBuffer."
        }
      },
      "getBufferCardinality()": {
        "returns": {
          "_0": "Ring buffer cardinality"
        }
      },
      "getDraw(uint32)": {
        "details": "Read a Draw using the Draw.drawId to calculate position in the draws ring buffer.",
        "params": {
          "drawId": "Draw.drawId"
        },
        "returns": {
          "_0": "IDrawBeacon.Draw"
        }
      },
      "getDrawCount()": {
        "details": "If no Draws have been pushed, it will return 0.If the ring buffer is full, it will return the cardinality.Otherwise, it will return the NewestDraw index + 1.",
        "returns": {
          "_0": "Number of Draws held in the draw ring buffer."
        }
      },
      "getDraws(uint32[])": {
        "details": "Read multiple Draws using each drawId to calculate position in the draws ring buffer.",
        "params": {
          "drawIds": "Array of drawIds"
        },
        "returns": {
          "_0": "IDrawBeacon.Draw[]"
        }
      },
      "getNewestDraw()": {
        "details": "Uses the nextDrawIndex to calculate the most recently added Draw.",
        "returns": {
          "_0": "IDrawBeacon.Draw"
        }
      },
      "getOldestDraw()": {
        "details": "Finds the oldest Draw by comparing and/or diffing totalDraws with the cardinality.",
        "returns": {
          "_0": "IDrawBeacon.Draw"
        }
      },
      "manager()": {
        "returns": {
          "_0": "Current `_manager` address."
        }
      },
      "pendingOwner()": {
        "returns": {
          "_0": "Current `_pendingOwner` address."
        }
      },
      "pushDraw((uint256,uint32,uint64,uint64,uint32))": {
        "details": "Push new draw onto draws history via authorized manager or owner.",
        "params": {
          "draw": "IDrawBeacon.Draw"
        },
        "returns": {
          "_0": "Draw.drawId"
        }
      },
      "renounceOwnership()": {
        "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner."
      },
      "setDraw((uint256,uint32,uint64,uint64,uint32))": {
        "details": "Updating a Draw should be used sparingly and only in the event an incorrect Draw parameter has been stored.",
        "params": {
          "newDraw": "IDrawBeacon.Draw"
        },
        "returns": {
          "_0": "Draw.drawId"
        }
      },
      "setManager(address)": {
        "details": "Throws if called by any account other than the owner.",
        "params": {
          "_newManager": "New _manager address."
        },
        "returns": {
          "_0": "Boolean to indicate if the operation was successful or not."
        }
      },
      "transferOwnership(address)": {
        "params": {
          "_newOwner": "Address to transfer ownership to."
        }
      }
    },
    "title": "PoolTogether V4 DrawBuffer",
    "version": 1
  },
  "userdoc": {
    "events": {
      "DrawSet(uint32,(uint256,uint32,uint64,uint64,uint32))": {
        "notice": "Emit when a new draw has been created."
      }
    },
    "kind": "user",
    "methods": {
      "MAX_CARDINALITY()": {
        "notice": "Draws ring buffer max length."
      },
      "claimOwnership()": {
        "notice": "Allows the `_pendingOwner` address to finalize the transfer."
      },
      "constructor": {
        "notice": "Deploy DrawBuffer smart contract."
      },
      "getBufferCardinality()": {
        "notice": "Read a ring buffer cardinality"
      },
      "getDraw(uint32)": {
        "notice": "Read a Draw from the draws ring buffer."
      },
      "getDrawCount()": {
        "notice": "Gets the number of Draws held in the draw ring buffer."
      },
      "getDraws(uint32[])": {
        "notice": "Read multiple Draws from the draws ring buffer."
      },
      "getNewestDraw()": {
        "notice": "Read newest Draw from draws ring buffer."
      },
      "getOldestDraw()": {
        "notice": "Read oldest Draw from draws ring buffer."
      },
      "manager()": {
        "notice": "Gets current `_manager`."
      },
      "owner()": {
        "notice": "Returns the address of the current owner."
      },
      "pendingOwner()": {
        "notice": "Gets current `_pendingOwner`."
      },
      "pushDraw((uint256,uint32,uint64,uint64,uint32))": {
        "notice": "Push Draw onto draws ring buffer history."
      },
      "renounceOwnership()": {
        "notice": "Renounce ownership of the contract."
      },
      "setDraw((uint256,uint32,uint64,uint64,uint32))": {
        "notice": "Set existing Draw in draws ring buffer with new parameters."
      },
      "setManager(address)": {
        "notice": "Set or change of manager."
      },
      "transferOwnership(address)": {
        "notice": "Allows current owner to set the `_pendingOwner` address."
      }
    },
    "notice": "The DrawBuffer provides historical lookups of Draws via a circular ring buffer. Historical Draws can be accessed on-chain using a drawId to calculate ring buffer storage slot. The Draw settings can be created by manager/owner and existing Draws can only be updated the owner. Once a starting Draw has been added to the ring buffer, all following draws must have a sequential Draw ID.",
    "version": 1
  },
  "storageLayout": {
    "storage": [
      {
        "astId": 4754,
        "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
        "label": "_owner",
        "offset": 0,
        "slot": "0",
        "type": "t_address"
      },
      {
        "astId": 4756,
        "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
        "label": "_pendingOwner",
        "offset": 0,
        "slot": "1",
        "type": "t_address"
      },
      {
        "astId": 4652,
        "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
        "label": "_manager",
        "offset": 0,
        "slot": "2",
        "type": "t_address"
      },
      {
        "astId": 6042,
        "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
        "label": "drawRingBuffer",
        "offset": 0,
        "slot": "3",
        "type": "t_array(t_struct(Draw)9822_storage)256_storage"
      },
      {
        "astId": 6046,
        "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
        "label": "bufferMetadata",
        "offset": 0,
        "slot": "515",
        "type": "t_struct(Buffer)10954_storage"
      }
    ],
    "types": {
      "t_address": {
        "encoding": "inplace",
        "label": "address",
        "numberOfBytes": "20"
      },
      "t_array(t_struct(Draw)9822_storage)256_storage": {
        "base": "t_struct(Draw)9822_storage",
        "encoding": "inplace",
        "label": "struct IDrawBeacon.Draw[256]",
        "numberOfBytes": "16384"
      },
      "t_struct(Buffer)10954_storage": {
        "encoding": "inplace",
        "label": "struct DrawRingBufferLib.Buffer",
        "members": [
          {
            "astId": 10949,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "lastDrawId",
            "offset": 0,
            "slot": "0",
            "type": "t_uint32"
          },
          {
            "astId": 10951,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "nextIndex",
            "offset": 4,
            "slot": "0",
            "type": "t_uint32"
          },
          {
            "astId": 10953,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "cardinality",
            "offset": 8,
            "slot": "0",
            "type": "t_uint32"
          }
        ],
        "numberOfBytes": "32"
      },
      "t_struct(Draw)9822_storage": {
        "encoding": "inplace",
        "label": "struct IDrawBeacon.Draw",
        "members": [
          {
            "astId": 9813,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "winningRandomNumber",
            "offset": 0,
            "slot": "0",
            "type": "t_uint256"
          },
          {
            "astId": 9815,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "drawId",
            "offset": 0,
            "slot": "1",
            "type": "t_uint32"
          },
          {
            "astId": 9817,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "timestamp",
            "offset": 4,
            "slot": "1",
            "type": "t_uint64"
          },
          {
            "astId": 9819,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "beaconPeriodStartedAt",
            "offset": 12,
            "slot": "1",
            "type": "t_uint64"
          },
          {
            "astId": 9821,
            "contract": "@pooltogether/v4-core/contracts/DrawBuffer.sol:DrawBuffer",
            "label": "beaconPeriodSeconds",
            "offset": 20,
            "slot": "1",
            "type": "t_uint32"
          }
        ],
        "numberOfBytes": "64"
      },
      "t_uint256": {
        "encoding": "inplace",
        "label": "uint256",
        "numberOfBytes": "32"
      },
      "t_uint32": {
        "encoding": "inplace",
        "label": "uint32",
        "numberOfBytes": "4"
      },
      "t_uint64": {
        "encoding": "inplace",
        "label": "uint64",
        "numberOfBytes": "8"
      }
    }
  }
}