From c10803f35795c6e89961fa5d2fd11270e37efdd6 Mon Sep 17 00:00:00 2001 From: Kyrylo Klymenko Date: Wed, 23 Oct 2024 17:40:24 +0200 Subject: [PATCH] Deployment to Sepolia --- ...arERC20VotingWithHatsProposalCreation.json | 1388 +++++++++++++++ ...rERC721VotingWithHatsProposalCreation.json | 1494 +++++++++++++++++ .../8098c390a54ad5a8bcff70bed7c24a3c.json | 395 +++++ 3 files changed, 3277 insertions(+) create mode 100644 deployments/sepolia/LinearERC20VotingWithHatsProposalCreation.json create mode 100644 deployments/sepolia/LinearERC721VotingWithHatsProposalCreation.json create mode 100644 deployments/sepolia/solcInputs/8098c390a54ad5a8bcff70bed7c24a3c.json diff --git a/deployments/sepolia/LinearERC20VotingWithHatsProposalCreation.json b/deployments/sepolia/LinearERC20VotingWithHatsProposalCreation.json new file mode 100644 index 00000000..f30603dc --- /dev/null +++ b/deployments/sepolia/LinearERC20VotingWithHatsProposalCreation.json @@ -0,0 +1,1388 @@ +{ + "address": "0x4F5d44477C0Da5df31c2c5Bdd291224035708C39", + "abi": [ + { + "inputs": [], + "name": "AlreadyVoted", + "type": "error" + }, + { + "inputs": [], + "name": "HatAlreadyWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "HatNotWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBasisNumerator", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidHatsContract", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidProposal", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidQuorumNumerator", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTokenAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVote", + "type": "error" + }, + { + "inputs": [], + "name": "NoHatsWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyAzorius", + "type": "error" + }, + { + "inputs": [], + "name": "VotingEnded", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "azoriusModule", + "type": "address" + } + ], + "name": "AzoriusSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "basisNumerator", + "type": "uint256" + } + ], + "name": "BasisNumeratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "hatId", + "type": "uint256" + } + ], + "name": "HatRemovedFromWhitelist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "hatId", + "type": "uint256" + } + ], + "name": "HatWhitelisted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "proposalId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "votingEndBlock", + "type": "uint32" + } + ], + "name": "ProposalInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "quorumNumerator", + "type": "uint256" + } + ], + "name": "QuorumNumeratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "requiredProposerWeight", + "type": "uint256" + } + ], + "name": "RequiredProposerWeightUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "azoriusModule", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "StrategySetUp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "voter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "proposalId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "voteType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "weight", + "type": "uint256" + } + ], + "name": "Voted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "votingPeriod", + "type": "uint32" + } + ], + "name": "VotingPeriodUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "BASIS_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "QUORUM_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "azoriusModule", + "outputs": [ + { + "internalType": "contract IAzorius", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "basisNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "getProposalVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "noVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "abstainVotes", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endBlock", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "votingSupply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "getProposalVotingSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_voter", + "type": "address" + }, + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "getVotingWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistedHatsCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "governanceToken", + "outputs": [ + { + "internalType": "contract IVotes", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "hasVoted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hatsContract", + "outputs": [ + { + "internalType": "contract IHats", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "initializeProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "isHatWhitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "isPassed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "isProposer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_noVotes", + "type": "uint256" + } + ], + "name": "meetsBasis", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_totalSupply", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_abstainVotes", + "type": "uint256" + } + ], + "name": "meetsQuorum", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quorumNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "quorumVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "removeHatFromWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requiredProposerWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_azoriusModule", + "type": "address" + } + ], + "name": "setAzorius", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "initializeParams", + "type": "bytes" + } + ], + "name": "setUp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_basisNumerator", + "type": "uint256" + } + ], + "name": "updateBasisNumerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_quorumNumerator", + "type": "uint256" + } + ], + "name": "updateQuorumNumerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_requiredProposerWeight", + "type": "uint256" + } + ], + "name": "updateRequiredProposerWeight", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_votingPeriod", + "type": "uint32" + } + ], + "name": "updateVotingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "_voteType", + "type": "uint8" + } + ], + "name": "vote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "votingEndBlock", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "votingPeriod", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "whitelistHat", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "whitelistedHatIds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x255f465108d54babaeea38632f8e99557a06dada02576b8e47df05c3c02fa065", + "receipt": { + "to": null, + "from": "0x637366C372a9096b262bd2fe6c40D7BCc6239976", + "contractAddress": "0x4F5d44477C0Da5df31c2c5Bdd291224035708C39", + "transactionIndex": 57, + "gasUsed": "1600644", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x44495c55d4829971c35b95a1352513a0ee99295867ff59db9060c2fc52aeb8c6", + "transactionHash": "0x255f465108d54babaeea38632f8e99557a06dada02576b8e47df05c3c02fa065", + "logs": [ + { + "transactionIndex": 57, + "blockNumber": 6929977, + "transactionHash": "0x255f465108d54babaeea38632f8e99557a06dada02576b8e47df05c3c02fa065", + "address": "0x4F5d44477C0Da5df31c2c5Bdd291224035708C39", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 70, + "blockHash": "0x44495c55d4829971c35b95a1352513a0ee99295867ff59db9060c2fc52aeb8c6" + } + ], + "blockNumber": 6929977, + "cumulativeGasUsed": "7217014", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "8098c390a54ad5a8bcff70bed7c24a3c", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"AlreadyVoted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HatAlreadyWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HatNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBasisNumerator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidHatsContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProposal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidQuorumNumerator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTokenAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVote\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoHatsWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyAzorius\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VotingEnded\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"azoriusModule\",\"type\":\"address\"}],\"name\":\"AzoriusSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"basisNumerator\",\"type\":\"uint256\"}],\"name\":\"BasisNumeratorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"hatId\",\"type\":\"uint256\"}],\"name\":\"HatRemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"hatId\",\"type\":\"uint256\"}],\"name\":\"HatWhitelisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"proposalId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"votingEndBlock\",\"type\":\"uint32\"}],\"name\":\"ProposalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"quorumNumerator\",\"type\":\"uint256\"}],\"name\":\"QuorumNumeratorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"requiredProposerWeight\",\"type\":\"uint256\"}],\"name\":\"RequiredProposerWeightUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"azoriusModule\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"StrategySetUp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"proposalId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"voteType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"Voted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"votingPeriod\",\"type\":\"uint32\"}],\"name\":\"VotingPeriodUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASIS_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"QUORUM_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"azoriusModule\",\"outputs\":[{\"internalType\":\"contract IAzorius\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"basisNumerator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"getProposalVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"noVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"abstainVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"startBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"endBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"votingSupply\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"getProposalVotingSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"getVotingWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWhitelistedHatsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governanceToken\",\"outputs\":[{\"internalType\":\"contract IVotes\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"hasVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hatsContract\",\"outputs\":[{\"internalType\":\"contract IHats\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"initializeProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"isHatWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"isPassed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"isProposer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_noVotes\",\"type\":\"uint256\"}],\"name\":\"meetsBasis\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalSupply\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_abstainVotes\",\"type\":\"uint256\"}],\"name\":\"meetsQuorum\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quorumNumerator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"quorumVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"removeHatFromWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"requiredProposerWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_azoriusModule\",\"type\":\"address\"}],\"name\":\"setAzorius\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initializeParams\",\"type\":\"bytes\"}],\"name\":\"setUp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_basisNumerator\",\"type\":\"uint256\"}],\"name\":\"updateBasisNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_quorumNumerator\",\"type\":\"uint256\"}],\"name\":\"updateQuorumNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_requiredProposerWeight\",\"type\":\"uint256\"}],\"name\":\"updateRequiredProposerWeight\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_votingPeriod\",\"type\":\"uint32\"}],\"name\":\"updateVotingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"_voteType\",\"type\":\"uint8\"}],\"name\":\"vote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"votingEndBlock\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"votingPeriod\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"whitelistHat\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedHatIds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"getProposalVotes(uint32)\":{\"params\":{\"_proposalId\":\"id of the Proposal\"},\"returns\":{\"abstainVotes\":\"current count of \\\"ABSTAIN\\\" votes\",\"endBlock\":\"block number voting ends\",\"noVotes\":\"current count of \\\"NO\\\" votes\",\"startBlock\":\"block number voting starts\",\"yesVotes\":\"current count of \\\"YES\\\" votes\"}},\"getProposalVotingSupply(uint32)\":{\"params\":{\"_proposalId\":\"id of the Proposal\"},\"returns\":{\"_0\":\"uint256 voting supply snapshot for the given _proposalId\"}},\"getVotingWeight(address,uint32)\":{\"params\":{\"_proposalId\":\"id of the Proposal\",\"_voter\":\"address of the voter\"},\"returns\":{\"_0\":\"uint256 the address' voting weight\"}},\"getWhitelistedHatsCount()\":{\"returns\":{\"_0\":\"The number of whitelisted hats\"}},\"hasVoted(uint32,address)\":{\"params\":{\"_address\":\"address to check\",\"_proposalId\":\"id of the Proposal to check\"},\"returns\":{\"_0\":\"bool true if the address has voted on the Proposal, otherwise false\"}},\"initializeProposal(bytes)\":{\"params\":{\"_data\":\"arbitrary data to pass to this BaseStrategy\"}},\"isHatWhitelisted(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to check\"},\"returns\":{\"_0\":\"True if the hat is whitelisted, false otherwise\"}},\"isPassed(uint32)\":{\"params\":{\"_proposalId\":\"proposalId to check\"},\"returns\":{\"_0\":\"bool true if the proposal has passed, otherwise false\"}},\"isProposer(address)\":{\"details\":\"Checks if an address is authorized to create proposals.\",\"params\":{\"_address\":\"The address to check for proposal creation authorization.\"},\"returns\":{\"_0\":\"bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise.\"}},\"meetsBasis(uint256,uint256)\":{\"params\":{\"_noVotes\":\"number of votes against\",\"_yesVotes\":\"number of votes in favor\"},\"returns\":{\"_0\":\"bool whether the yes votes meets the set basis\"}},\"meetsQuorum(uint256,uint256,uint256)\":{\"params\":{\"_abstainVotes\":\"number of votes abstaining\",\"_totalSupply\":\"the total supply of tokens\",\"_yesVotes\":\"number of votes in favor\"},\"returns\":{\"_0\":\"bool whether the total number of yes votes + abstain meets the quorum\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"quorumVotes(uint32)\":{\"params\":{\"_proposalId\":\"The ID of the proposal to get quorum votes for\"},\"returns\":{\"_0\":\"uint256 The quantity of votes required to meet quorum\"}},\"removeHatFromWhitelist(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to remove from the whitelist\"}},\"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.\"},\"setAzorius(address)\":{\"params\":{\"_azoriusModule\":\"address of the Azorius Safe module\"}},\"setUp(bytes)\":{\"params\":{\"initializeParams\":\"encoded initialization parameters: `address _owner`, `address _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`, `uint256 _quorumNumerator`, `uint256 _basisNumerator`, `address _hatsContract`, `uint256[] _initialWhitelistedHats`\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"updateBasisNumerator(uint256)\":{\"params\":{\"_basisNumerator\":\"numerator to use\"}},\"updateQuorumNumerator(uint256)\":{\"params\":{\"_quorumNumerator\":\"numerator to use when calculating quorum (over 1,000,000)\"}},\"updateRequiredProposerWeight(uint256)\":{\"params\":{\"_requiredProposerWeight\":\"required token voting weight\"}},\"updateVotingPeriod(uint32)\":{\"params\":{\"_votingPeriod\":\"voting time period (in blocks)\"}},\"vote(uint32,uint8)\":{\"params\":{\"_proposalId\":\"id of the Proposal to vote on\",\"_voteType\":\"Proposal support as defined in VoteType (NO, YES, ABSTAIN)\"}},\"votingEndBlock(uint32)\":{\"params\":{\"_proposalId\":\"proposalId to check\"},\"returns\":{\"_0\":\"uint32 block number when voting ends on the Proposal\"}},\"whitelistHat(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to whitelist\"}}},\"version\":1},\"userdoc\":{\"errors\":{\"InvalidQuorumNumerator()\":[{\"notice\":\"Ensures the numerator cannot be larger than the denominator. \"}]},\"kind\":\"user\",\"methods\":{\"BASIS_DENOMINATOR()\":{\"notice\":\"The denominator to use when calculating basis (1,000,000). \"},\"QUORUM_DENOMINATOR()\":{\"notice\":\"The denominator to use when calculating quorum (1,000,000). \"},\"basisNumerator()\":{\"notice\":\"The numerator to use when calculating basis (adjustable). \"},\"getProposalVotes(uint32)\":{\"notice\":\"Returns the current state of the specified Proposal.\"},\"getProposalVotingSupply(uint32)\":{\"notice\":\"Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change, it is necessary to calculate quorum from the supply available at the time of the Proposal's creation, not when it is being voted on passes / fails.\"},\"getVotingWeight(address,uint32)\":{\"notice\":\"Calculates the voting weight an address has for a specific Proposal.\"},\"getWhitelistedHatsCount()\":{\"notice\":\"Returns the number of whitelisted hats.\"},\"hasVoted(uint32,address)\":{\"notice\":\"Returns whether an address has voted on the specified Proposal.\"},\"initializeProposal(bytes)\":{\"notice\":\"Called by the [Azorius](../Azorius.md) module. This notifies this [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created.\"},\"isHatWhitelisted(uint256)\":{\"notice\":\"Checks if a hat is whitelisted.\"},\"isPassed(uint32)\":{\"notice\":\"Returns whether a Proposal has been passed.\"},\"isProposer(address)\":{\"notice\":\"This function overrides the isProposer function from the parent contract. It iterates through all whitelisted Hat IDs and checks if the given address is wearing any of them using the Hats Protocol.\"},\"meetsBasis(uint256,uint256)\":{\"notice\":\"Calculates whether a vote meets its basis.\"},\"meetsQuorum(uint256,uint256,uint256)\":{\"notice\":\"Calculates whether a vote meets quorum. This is calculated based on yes votes + abstain votes.\"},\"quorumNumerator()\":{\"notice\":\"The numerator to use when calculating quorum (adjustable). \"},\"quorumVotes(uint32)\":{\"notice\":\"Calculates the total number of votes required for a proposal to meet quorum. \"},\"removeHatFromWhitelist(uint256)\":{\"notice\":\"Removes a Hat from the whitelist for proposal creation.\"},\"requiredProposerWeight()\":{\"notice\":\"Voting weight required to be able to submit Proposals. \"},\"setAzorius(address)\":{\"notice\":\"Sets the address of the [Azorius](../Azorius.md) contract this [BaseStrategy](../BaseStrategy.md) is being used on.\"},\"setUp(bytes)\":{\"notice\":\"Sets up the contract with its initial parameters.\"},\"updateBasisNumerator(uint256)\":{\"notice\":\"Updates the `basisNumerator` for future Proposals.\"},\"updateQuorumNumerator(uint256)\":{\"notice\":\"Updates the quorum required for future Proposals.\"},\"updateRequiredProposerWeight(uint256)\":{\"notice\":\"Updates the voting weight required to submit new Proposals.\"},\"updateVotingPeriod(uint32)\":{\"notice\":\"Updates the voting time period for new Proposals.\"},\"vote(uint32,uint8)\":{\"notice\":\"Casts votes for a Proposal, equal to the caller's token delegation.\"},\"votingEndBlock(uint32)\":{\"notice\":\"Returns the block number voting ends on a given Proposal.\"},\"votingPeriod()\":{\"notice\":\"Number of blocks a new Proposal can be voted on. \"},\"whitelistHat(uint256)\":{\"notice\":\"Adds a Hat to the whitelist for proposal creation.\"},\"whitelistedHatIds(uint256)\":{\"notice\":\"Array to store whitelisted Hat IDs. \"}},\"notice\":\"An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that enables linear (i.e. 1 to 1) ERC21 based token voting, with proposal creation restricted to users wearing whitelisted Hats.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol\":\"LinearERC20VotingWithHatsProposalCreation\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nabstract contract FactoryFriendly is OwnableUpgradeable {\\n function setUp(bytes memory initializeParams) public virtual;\\n}\\n\",\"keccak256\":\"0x96e61585b7340a901a54eb4c157ce28b630bff3d9d4597dfaac692128ea458c4\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev 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 account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\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 OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\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() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/governance/utils/IVotes.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\\n *\\n * _Available since v4.5._\\n */\\ninterface IVotes {\\n /**\\n * @dev Emitted when an account changes their delegate.\\n */\\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\\n\\n /**\\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\\n */\\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\\n\\n /**\\n * @dev Returns the current amount of votes that `account` has.\\n */\\n function getVotes(address account) external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\\n */\\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\\n *\\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\\n * vote.\\n */\\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\\n\\n /**\\n * @dev Returns the delegate that `account` has chosen.\\n */\\n function delegates(address account) external view returns (address);\\n\\n /**\\n * @dev Delegates votes from the sender to `delegatee`.\\n */\\n function delegate(address delegatee) external;\\n\\n /**\\n * @dev Delegates votes from signer to `delegatee`.\\n */\\n function delegateBySig(\\n address delegatee,\\n uint256 nonce,\\n uint256 expiry,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\",\"keccak256\":\"0xf5324a55ee9c0b4a840ea57c055ac9d046f88986ceef567e1cf68113e46a79c0\",\"license\":\"MIT\"},\"contracts/azorius/BaseQuorumPercent.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * An Azorius extension contract that enables percent based quorums.\\n * Intended to be implemented by [BaseStrategy](./BaseStrategy.md) implementations.\\n */\\nabstract contract BaseQuorumPercent is OwnableUpgradeable {\\n \\n /** The numerator to use when calculating quorum (adjustable). */\\n uint256 public quorumNumerator;\\n\\n /** The denominator to use when calculating quorum (1,000,000). */\\n uint256 public constant QUORUM_DENOMINATOR = 1_000_000;\\n\\n /** Ensures the numerator cannot be larger than the denominator. */\\n error InvalidQuorumNumerator();\\n\\n event QuorumNumeratorUpdated(uint256 quorumNumerator);\\n\\n /** \\n * Updates the quorum required for future Proposals.\\n *\\n * @param _quorumNumerator numerator to use when calculating quorum (over 1,000,000)\\n */\\n function updateQuorumNumerator(uint256 _quorumNumerator) public virtual onlyOwner {\\n _updateQuorumNumerator(_quorumNumerator);\\n }\\n\\n /** Internal implementation of `updateQuorumNumerator`. */\\n function _updateQuorumNumerator(uint256 _quorumNumerator) internal virtual {\\n if (_quorumNumerator > QUORUM_DENOMINATOR)\\n revert InvalidQuorumNumerator();\\n\\n quorumNumerator = _quorumNumerator;\\n\\n emit QuorumNumeratorUpdated(_quorumNumerator);\\n }\\n\\n /**\\n * Calculates whether a vote meets quorum. This is calculated based on yes votes + abstain\\n * votes.\\n *\\n * @param _totalSupply the total supply of tokens\\n * @param _yesVotes number of votes in favor\\n * @param _abstainVotes number of votes abstaining\\n * @return bool whether the total number of yes votes + abstain meets the quorum\\n */\\n function meetsQuorum(uint256 _totalSupply, uint256 _yesVotes, uint256 _abstainVotes) public view returns (bool) {\\n return _yesVotes + _abstainVotes >= (_totalSupply * quorumNumerator) / QUORUM_DENOMINATOR;\\n }\\n\\n /**\\n * Calculates the total number of votes required for a proposal to meet quorum.\\n * \\n * @param _proposalId The ID of the proposal to get quorum votes for\\n * @return uint256 The quantity of votes required to meet quorum\\n */\\n function quorumVotes(uint32 _proposalId) public view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x0218f97766d3b796f72e4ee0e1b267e72ccad8d979dfd14c5699f93d05c64c29\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/BaseStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport { IAzorius } from \\\"./interfaces/IAzorius.sol\\\";\\nimport { IBaseStrategy } from \\\"./interfaces/IBaseStrategy.sol\\\";\\nimport { FactoryFriendly } from \\\"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\\\";\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * The base abstract contract for all voting strategies in Azorius.\\n */\\nabstract contract BaseStrategy is OwnableUpgradeable, FactoryFriendly, IBaseStrategy {\\n\\n event AzoriusSet(address indexed azoriusModule);\\n event StrategySetUp(address indexed azoriusModule, address indexed owner);\\n\\n error OnlyAzorius();\\n\\n IAzorius public azoriusModule;\\n\\n /**\\n * Ensures that only the [Azorius](./Azorius.md) contract that pertains to this \\n * [BaseStrategy](./BaseStrategy.md) can call functions on it.\\n */\\n modifier onlyAzorius() {\\n if (msg.sender != address(azoriusModule)) revert OnlyAzorius();\\n _;\\n }\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /** @inheritdoc IBaseStrategy*/\\n function setAzorius(address _azoriusModule) external onlyOwner {\\n azoriusModule = IAzorius(_azoriusModule);\\n emit AzoriusSet(_azoriusModule);\\n }\\n\\n /** @inheritdoc IBaseStrategy*/\\n function initializeProposal(bytes memory _data) external virtual;\\n\\n /** @inheritdoc IBaseStrategy*/\\n function isPassed(uint32 _proposalId) external view virtual returns (bool);\\n\\n /** @inheritdoc IBaseStrategy*/\\n function isProposer(address _address) external view virtual returns (bool);\\n\\n /** @inheritdoc IBaseStrategy*/\\n function votingEndBlock(uint32 _proposalId) external view virtual returns (uint32);\\n\\n /**\\n * Sets the address of the [Azorius](Azorius.md) module contract.\\n *\\n * @param _azoriusModule address of the Azorius module\\n */\\n function _setAzorius(address _azoriusModule) internal {\\n azoriusModule = IAzorius(_azoriusModule);\\n emit AzoriusSet(_azoriusModule);\\n }\\n}\\n\",\"keccak256\":\"0xd04aeec28b5a7c7bad44f2c9dfe7641240e319b8d76d05f940453a258411c567\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/BaseVotingBasisPercent.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * An Azorius extension contract that enables percent based voting basis calculations.\\n *\\n * Intended to be implemented by BaseStrategy implementations, this allows for voting strategies\\n * to dictate any basis strategy for passing a Proposal between >50% (simple majority) to 100%.\\n *\\n * See https://en.wikipedia.org/wiki/Voting#Voting_basis.\\n * See https://en.wikipedia.org/wiki/Supermajority.\\n */\\nabstract contract BaseVotingBasisPercent is OwnableUpgradeable {\\n \\n /** The numerator to use when calculating basis (adjustable). */\\n uint256 public basisNumerator;\\n\\n /** The denominator to use when calculating basis (1,000,000). */\\n uint256 public constant BASIS_DENOMINATOR = 1_000_000;\\n\\n error InvalidBasisNumerator();\\n\\n event BasisNumeratorUpdated(uint256 basisNumerator);\\n\\n /**\\n * Updates the `basisNumerator` for future Proposals.\\n *\\n * @param _basisNumerator numerator to use\\n */\\n function updateBasisNumerator(uint256 _basisNumerator) public virtual onlyOwner {\\n _updateBasisNumerator(_basisNumerator);\\n }\\n\\n /** Internal implementation of `updateBasisNumerator`. */\\n function _updateBasisNumerator(uint256 _basisNumerator) internal virtual {\\n if (_basisNumerator > BASIS_DENOMINATOR || _basisNumerator < BASIS_DENOMINATOR / 2)\\n revert InvalidBasisNumerator();\\n\\n basisNumerator = _basisNumerator;\\n\\n emit BasisNumeratorUpdated(_basisNumerator);\\n }\\n\\n /**\\n * Calculates whether a vote meets its basis.\\n *\\n * @param _yesVotes number of votes in favor\\n * @param _noVotes number of votes against\\n * @return bool whether the yes votes meets the set basis\\n */\\n function meetsBasis(uint256 _yesVotes, uint256 _noVotes) public view returns (bool) {\\n return _yesVotes > (_yesVotes + _noVotes) * basisNumerator / BASIS_DENOMINATOR;\\n }\\n}\\n\",\"keccak256\":\"0x568d4c7f3e5de10272ec675cd745a53b414ca2e3388bfeff19d8addf9e324c7e\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/HatsProposalCreationWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/full/IHats.sol\\\";\\n\\nabstract contract HatsProposalCreationWhitelist is OwnableUpgradeable {\\n event HatWhitelisted(uint256 hatId);\\n event HatRemovedFromWhitelist(uint256 hatId);\\n\\n IHats public hatsContract;\\n\\n /** Array to store whitelisted Hat IDs. */\\n uint256[] public whitelistedHatIds;\\n\\n error InvalidHatsContract();\\n error NoHatsWhitelisted();\\n error HatAlreadyWhitelisted();\\n error HatNotWhitelisted();\\n\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters:\\n * `address _hatsContract`, `uint256[] _initialWhitelistedHats`\\n */\\n function setUp(bytes memory initializeParams) public virtual {\\n (address _hatsContract, uint256[] memory _initialWhitelistedHats) = abi\\n .decode(initializeParams, (address, uint256[]));\\n\\n if (_hatsContract == address(0)) revert InvalidHatsContract();\\n hatsContract = IHats(_hatsContract);\\n\\n if (_initialWhitelistedHats.length == 0) revert NoHatsWhitelisted();\\n for (uint256 i = 0; i < _initialWhitelistedHats.length; i++) {\\n _whitelistHat(_initialWhitelistedHats[i]);\\n }\\n }\\n\\n /**\\n * Adds a Hat to the whitelist for proposal creation.\\n * @param _hatId The ID of the Hat to whitelist\\n */\\n function whitelistHat(uint256 _hatId) external onlyOwner {\\n _whitelistHat(_hatId);\\n }\\n\\n /**\\n * Internal function to add a Hat to the whitelist.\\n * @param _hatId The ID of the Hat to whitelist\\n */\\n function _whitelistHat(uint256 _hatId) internal {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) revert HatAlreadyWhitelisted();\\n }\\n whitelistedHatIds.push(_hatId);\\n emit HatWhitelisted(_hatId);\\n }\\n\\n /**\\n * Removes a Hat from the whitelist for proposal creation.\\n * @param _hatId The ID of the Hat to remove from the whitelist\\n */\\n function removeHatFromWhitelist(uint256 _hatId) external onlyOwner {\\n bool found = false;\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) {\\n whitelistedHatIds[i] = whitelistedHatIds[\\n whitelistedHatIds.length - 1\\n ];\\n whitelistedHatIds.pop();\\n found = true;\\n break;\\n }\\n }\\n if (!found) revert HatNotWhitelisted();\\n\\n emit HatRemovedFromWhitelist(_hatId);\\n }\\n\\n /**\\n * @dev Checks if an address is authorized to create proposals.\\n * @param _address The address to check for proposal creation authorization.\\n * @return bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise.\\n * @notice This function overrides the isProposer function from the parent contract.\\n * It iterates through all whitelisted Hat IDs and checks if the given address\\n * is wearing any of them using the Hats Protocol.\\n */\\n function isProposer(address _address) public view virtual returns (bool) {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (hatsContract.isWearerOfHat(_address, whitelistedHatIds[i])) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * Returns the number of whitelisted hats.\\n * @return The number of whitelisted hats\\n */\\n function getWhitelistedHatsCount() public view returns (uint256) {\\n return whitelistedHatIds.length;\\n }\\n\\n /**\\n * Checks if a hat is whitelisted.\\n * @param _hatId The ID of the Hat to check\\n * @return True if the hat is whitelisted, false otherwise\\n */\\n function isHatWhitelisted(uint256 _hatId) public view returns (bool) {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) {\\n return true;\\n }\\n }\\n return false;\\n }\\n}\\n\",\"keccak256\":\"0xa5696079ca64c569d3a648538649fcfa335609b65c328013bd5ff2aa51acc560\",\"license\":\"MIT\"},\"contracts/azorius/LinearERC20VotingExtensible.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport {IVotes} from \\\"@openzeppelin/contracts/governance/utils/IVotes.sol\\\";\\nimport {BaseStrategy, IBaseStrategy} from \\\"./BaseStrategy.sol\\\";\\nimport {BaseQuorumPercent} from \\\"./BaseQuorumPercent.sol\\\";\\nimport {BaseVotingBasisPercent} from \\\"./BaseVotingBasisPercent.sol\\\";\\n\\n/**\\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\\n * enables linear (i.e. 1 to 1) token voting. Each token delegated to a given address\\n * in an `ERC20Votes` token equals 1 vote for a Proposal.\\n *\\n * This contract is an extensible version of LinearERC20Voting, with all functions\\n * marked as `virtual`. This allows other contracts to inherit from it and override\\n * any part of its functionality. The existence of this contract enables the creation\\n * of more specialized voting strategies that build upon the basic linear ERC20 voting\\n * mechanism while allowing for customization of specific aspects as needed.\\n */\\nabstract contract LinearERC20VotingExtensible is\\n BaseStrategy,\\n BaseQuorumPercent,\\n BaseVotingBasisPercent\\n{\\n /**\\n * The voting options for a Proposal.\\n */\\n enum VoteType {\\n NO, // disapproves of executing the Proposal\\n YES, // approves of executing the Proposal\\n ABSTAIN // neither YES nor NO, i.e. voting \\\"present\\\"\\n }\\n\\n /**\\n * Defines the current state of votes on a particular Proposal.\\n */\\n struct ProposalVotes {\\n uint32 votingStartBlock; // block that voting starts at\\n uint32 votingEndBlock; // block that voting ends\\n uint256 noVotes; // current number of NO votes for the Proposal\\n uint256 yesVotes; // current number of YES votes for the Proposal\\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\\n mapping(address => bool) hasVoted; // whether a given address has voted yet or not\\n }\\n\\n IVotes public governanceToken;\\n\\n /** Number of blocks a new Proposal can be voted on. */\\n uint32 public votingPeriod;\\n\\n /** Voting weight required to be able to submit Proposals. */\\n uint256 public requiredProposerWeight;\\n\\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\\n mapping(uint256 => ProposalVotes) internal proposalVotes;\\n\\n event VotingPeriodUpdated(uint32 votingPeriod);\\n event RequiredProposerWeightUpdated(uint256 requiredProposerWeight);\\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\\n event Voted(\\n address voter,\\n uint32 proposalId,\\n uint8 voteType,\\n uint256 weight\\n );\\n\\n error InvalidProposal();\\n error VotingEnded();\\n error AlreadyVoted();\\n error InvalidVote();\\n error InvalidTokenAddress();\\n\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters: `address _owner`,\\n * `IVotes _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`,\\n * `uint256 _requiredProposerWeight`, `uint256 _quorumNumerator`,\\n * `uint256 _basisNumerator`\\n */\\n function setUp(\\n bytes memory initializeParams\\n ) public virtual override initializer {\\n (\\n address _owner,\\n IVotes _governanceToken,\\n address _azoriusModule,\\n uint32 _votingPeriod,\\n uint256 _requiredProposerWeight,\\n uint256 _quorumNumerator,\\n uint256 _basisNumerator\\n ) = abi.decode(\\n initializeParams,\\n (address, IVotes, address, uint32, uint256, uint256, uint256)\\n );\\n if (address(_governanceToken) == address(0))\\n revert InvalidTokenAddress();\\n\\n governanceToken = _governanceToken;\\n __Ownable_init();\\n transferOwnership(_owner);\\n _setAzorius(_azoriusModule);\\n _updateQuorumNumerator(_quorumNumerator);\\n _updateBasisNumerator(_basisNumerator);\\n _updateVotingPeriod(_votingPeriod);\\n _updateRequiredProposerWeight(_requiredProposerWeight);\\n\\n emit StrategySetUp(_azoriusModule, _owner);\\n }\\n\\n /**\\n * Updates the voting time period for new Proposals.\\n *\\n * @param _votingPeriod voting time period (in blocks)\\n */\\n function updateVotingPeriod(\\n uint32 _votingPeriod\\n ) external virtual onlyOwner {\\n _updateVotingPeriod(_votingPeriod);\\n }\\n\\n /**\\n * Updates the voting weight required to submit new Proposals.\\n *\\n * @param _requiredProposerWeight required token voting weight\\n */\\n function updateRequiredProposerWeight(\\n uint256 _requiredProposerWeight\\n ) external virtual onlyOwner {\\n _updateRequiredProposerWeight(_requiredProposerWeight);\\n }\\n\\n /**\\n * Casts votes for a Proposal, equal to the caller's token delegation.\\n *\\n * @param _proposalId id of the Proposal to vote on\\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\\n */\\n function vote(uint32 _proposalId, uint8 _voteType) external virtual {\\n _vote(\\n _proposalId,\\n msg.sender,\\n _voteType,\\n getVotingWeight(msg.sender, _proposalId)\\n );\\n }\\n\\n /**\\n * Returns the current state of the specified Proposal.\\n *\\n * @param _proposalId id of the Proposal\\n * @return noVotes current count of \\\"NO\\\" votes\\n * @return yesVotes current count of \\\"YES\\\" votes\\n * @return abstainVotes current count of \\\"ABSTAIN\\\" votes\\n * @return startBlock block number voting starts\\n * @return endBlock block number voting ends\\n */\\n function getProposalVotes(\\n uint32 _proposalId\\n )\\n external\\n view\\n virtual\\n returns (\\n uint256 noVotes,\\n uint256 yesVotes,\\n uint256 abstainVotes,\\n uint32 startBlock,\\n uint32 endBlock,\\n uint256 votingSupply\\n )\\n {\\n noVotes = proposalVotes[_proposalId].noVotes;\\n yesVotes = proposalVotes[_proposalId].yesVotes;\\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\\n startBlock = proposalVotes[_proposalId].votingStartBlock;\\n endBlock = proposalVotes[_proposalId].votingEndBlock;\\n votingSupply = getProposalVotingSupply(_proposalId);\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function initializeProposal(\\n bytes memory _data\\n ) public virtual override onlyAzorius {\\n uint32 proposalId = abi.decode(_data, (uint32));\\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\\n\\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\\n\\n emit ProposalInitialized(proposalId, _votingEndBlock);\\n }\\n\\n /**\\n * Returns whether an address has voted on the specified Proposal.\\n *\\n * @param _proposalId id of the Proposal to check\\n * @param _address address to check\\n * @return bool true if the address has voted on the Proposal, otherwise false\\n */\\n function hasVoted(\\n uint32 _proposalId,\\n address _address\\n ) public view virtual returns (bool) {\\n return proposalVotes[_proposalId].hasVoted[_address];\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function isPassed(\\n uint32 _proposalId\\n ) public view virtual override returns (bool) {\\n return (block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\\n meetsQuorum(\\n getProposalVotingSupply(_proposalId),\\n proposalVotes[_proposalId].yesVotes,\\n proposalVotes[_proposalId].abstainVotes\\n ) && // yes + abstain votes meets the quorum\\n meetsBasis(\\n proposalVotes[_proposalId].yesVotes,\\n proposalVotes[_proposalId].noVotes\\n )); // yes votes meets the basis\\n }\\n\\n /**\\n * Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change,\\n * it is necessary to calculate quorum from the supply available at the time of the Proposal's creation,\\n * not when it is being voted on passes / fails.\\n *\\n * @param _proposalId id of the Proposal\\n * @return uint256 voting supply snapshot for the given _proposalId\\n */\\n function getProposalVotingSupply(\\n uint32 _proposalId\\n ) public view virtual returns (uint256) {\\n return\\n governanceToken.getPastTotalSupply(\\n proposalVotes[_proposalId].votingStartBlock\\n );\\n }\\n\\n /**\\n * Calculates the voting weight an address has for a specific Proposal.\\n *\\n * @param _voter address of the voter\\n * @param _proposalId id of the Proposal\\n * @return uint256 the address' voting weight\\n */\\n function getVotingWeight(\\n address _voter,\\n uint32 _proposalId\\n ) public view virtual returns (uint256) {\\n return\\n governanceToken.getPastVotes(\\n _voter,\\n proposalVotes[_proposalId].votingStartBlock\\n );\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function isProposer(\\n address _address\\n ) public view virtual override returns (bool) {\\n return\\n governanceToken.getPastVotes(_address, block.number - 1) >=\\n requiredProposerWeight;\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function votingEndBlock(\\n uint32 _proposalId\\n ) public view virtual override returns (uint32) {\\n return proposalVotes[_proposalId].votingEndBlock;\\n }\\n\\n /** Internal implementation of `updateVotingPeriod`. */\\n function _updateVotingPeriod(uint32 _votingPeriod) internal virtual {\\n votingPeriod = _votingPeriod;\\n emit VotingPeriodUpdated(_votingPeriod);\\n }\\n\\n /** Internal implementation of `updateRequiredProposerWeight`. */\\n function _updateRequiredProposerWeight(\\n uint256 _requiredProposerWeight\\n ) internal virtual {\\n requiredProposerWeight = _requiredProposerWeight;\\n emit RequiredProposerWeightUpdated(_requiredProposerWeight);\\n }\\n\\n /**\\n * Internal function for casting a vote on a Proposal.\\n *\\n * @param _proposalId id of the Proposal\\n * @param _voter address casting the vote\\n * @param _voteType vote support, as defined in VoteType\\n * @param _weight amount of voting weight cast, typically the\\n * total number of tokens delegated\\n */\\n function _vote(\\n uint32 _proposalId,\\n address _voter,\\n uint8 _voteType,\\n uint256 _weight\\n ) internal virtual {\\n if (proposalVotes[_proposalId].votingEndBlock == 0)\\n revert InvalidProposal();\\n if (block.number > proposalVotes[_proposalId].votingEndBlock)\\n revert VotingEnded();\\n if (proposalVotes[_proposalId].hasVoted[_voter]) revert AlreadyVoted();\\n\\n proposalVotes[_proposalId].hasVoted[_voter] = true;\\n\\n if (_voteType == uint8(VoteType.NO)) {\\n proposalVotes[_proposalId].noVotes += _weight;\\n } else if (_voteType == uint8(VoteType.YES)) {\\n proposalVotes[_proposalId].yesVotes += _weight;\\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\\n proposalVotes[_proposalId].abstainVotes += _weight;\\n } else {\\n revert InvalidVote();\\n }\\n\\n emit Voted(_voter, _proposalId, _voteType, _weight);\\n }\\n\\n /** @inheritdoc BaseQuorumPercent*/\\n function quorumVotes(\\n uint32 _proposalId\\n ) public view virtual override returns (uint256) {\\n return\\n (quorumNumerator * getProposalVotingSupply(_proposalId)) /\\n QUORUM_DENOMINATOR;\\n }\\n}\\n\",\"keccak256\":\"0x250ed3053dc97247da6124fc9611c575ba05d4b8e61d2b583d8c8e47e27fbc96\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport {LinearERC20VotingExtensible} from \\\"./LinearERC20VotingExtensible.sol\\\";\\nimport {HatsProposalCreationWhitelist} from \\\"./HatsProposalCreationWhitelist.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\n\\n/**\\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\\n * enables linear (i.e. 1 to 1) ERC21 based token voting, with proposal creation\\n * restricted to users wearing whitelisted Hats.\\n */\\ncontract LinearERC20VotingWithHatsProposalCreation is\\n HatsProposalCreationWhitelist,\\n LinearERC20VotingExtensible\\n{\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters: `address _owner`,\\n * `address _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`,\\n * `uint256 _quorumNumerator`, `uint256 _basisNumerator`, `address _hatsContract`,\\n * `uint256[] _initialWhitelistedHats`\\n */\\n function setUp(\\n bytes memory initializeParams\\n )\\n public\\n override(HatsProposalCreationWhitelist, LinearERC20VotingExtensible)\\n {\\n (\\n address _owner,\\n address _governanceToken,\\n address _azoriusModule,\\n uint32 _votingPeriod,\\n uint256 _quorumNumerator,\\n uint256 _basisNumerator,\\n address _hatsContract,\\n uint256[] memory _initialWhitelistedHats\\n ) = abi.decode(\\n initializeParams,\\n (\\n address,\\n address,\\n address,\\n uint32,\\n uint256,\\n uint256,\\n address,\\n uint256[]\\n )\\n );\\n\\n LinearERC20VotingExtensible.setUp(\\n abi.encode(\\n _owner,\\n _governanceToken,\\n _azoriusModule,\\n _votingPeriod,\\n 0, // requiredProposerWeight is zero because we only care about the hat check\\n _quorumNumerator,\\n _basisNumerator\\n )\\n );\\n\\n HatsProposalCreationWhitelist.setUp(\\n abi.encode(_hatsContract, _initialWhitelistedHats)\\n );\\n }\\n\\n /** @inheritdoc HatsProposalCreationWhitelist*/\\n function isProposer(\\n address _address\\n )\\n public\\n view\\n override(HatsProposalCreationWhitelist, LinearERC20VotingExtensible)\\n returns (bool)\\n {\\n return HatsProposalCreationWhitelist.isProposer(_address);\\n }\\n}\\n\",\"keccak256\":\"0xafc4d8b957064b487a873e11f877633553fcc8b475382cb96a08ff633c6b4c7b\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/interfaces/IAzorius.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\nimport { Enum } from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\n/**\\n * The base interface for the Azorius governance Safe module.\\n * Azorius conforms to the Zodiac pattern for Safe modules: https://github.com/gnosis/zodiac\\n *\\n * Azorius manages the state of Proposals submitted to a DAO, along with the associated strategies\\n * ([BaseStrategy](../BaseStrategy.md)) for voting that are enabled on the DAO.\\n *\\n * Any given DAO can support multiple voting BaseStrategies, and these strategies are intended to be\\n * as customizable as possible.\\n *\\n * Proposals begin in the `ACTIVE` state and will ultimately end in either\\n * the `EXECUTED`, `EXPIRED`, or `FAILED` state.\\n *\\n * `ACTIVE` - a new proposal begins in this state, and stays in this state\\n * for the duration of its voting period.\\n *\\n * `TIMELOCKED` - A proposal that passes enters the `TIMELOCKED` state, during which\\n * it cannot yet be executed. This is to allow time for token holders\\n * to potentially exit their position, as well as parent DAOs time to\\n * initiate a freeze, if they choose to do so. A proposal stays timelocked\\n * for the duration of its `timelockPeriod`.\\n *\\n * `EXECUTABLE` - Following the `TIMELOCKED` state, a passed proposal becomes `EXECUTABLE`,\\n * and can then finally be executed on chain by anyone.\\n *\\n * `EXECUTED` - the final state for a passed proposal. The proposal has been executed\\n * on the blockchain.\\n *\\n * `EXPIRED` - a passed proposal which is not executed before its `executionPeriod` has\\n * elapsed will be `EXPIRED`, and can no longer be executed.\\n *\\n * `FAILED` - a failed proposal (as defined by its [BaseStrategy](../BaseStrategy.md) \\n * `isPassed` function). For a basic strategy, this would mean it received more \\n * NO votes than YES or did not achieve quorum. \\n */\\ninterface IAzorius {\\n\\n /** Represents a transaction to perform on the blockchain. */\\n struct Transaction {\\n address to; // destination address of the transaction\\n uint256 value; // amount of ETH to transfer with the transaction\\n bytes data; // encoded function call data of the transaction\\n Enum.Operation operation; // Operation type, Call or DelegateCall\\n }\\n\\n /** Holds details pertaining to a single proposal. */\\n struct Proposal {\\n uint32 executionCounter; // count of transactions that have been executed within the proposal\\n uint32 timelockPeriod; // time (in blocks) this proposal will be timelocked for if it passes\\n uint32 executionPeriod; // time (in blocks) this proposal has to be executed after timelock ends before it is expired\\n address strategy; // BaseStrategy contract this proposal was created on\\n bytes32[] txHashes; // hashes of the transactions that are being proposed\\n }\\n\\n /** The list of states in which a Proposal can be in at any given time. */\\n enum ProposalState {\\n ACTIVE,\\n TIMELOCKED,\\n EXECUTABLE,\\n EXECUTED,\\n EXPIRED,\\n FAILED\\n }\\n\\n /**\\n * Enables a [BaseStrategy](../BaseStrategy.md) implementation for newly created Proposals.\\n *\\n * Multiple strategies can be enabled, and new Proposals will be able to be\\n * created using any of the currently enabled strategies.\\n *\\n * @param _strategy contract address of the BaseStrategy to be enabled\\n */\\n function enableStrategy(address _strategy) external;\\n\\n /**\\n * Disables a previously enabled [BaseStrategy](../BaseStrategy.md) implementation for new proposals.\\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\\n *\\n * @param _prevStrategy BaseStrategy address that pointed in the linked list to the strategy to be removed\\n * @param _strategy address of the BaseStrategy to be removed\\n */\\n function disableStrategy(address _prevStrategy, address _strategy) external;\\n\\n /**\\n * Updates the `timelockPeriod` for newly created Proposals.\\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\\n *\\n * @param _timelockPeriod timelockPeriod (in blocks) to be used for new Proposals\\n */\\n function updateTimelockPeriod(uint32 _timelockPeriod) external;\\n\\n /**\\n * Updates the execution period for future Proposals.\\n *\\n * @param _executionPeriod new execution period (in blocks)\\n */\\n function updateExecutionPeriod(uint32 _executionPeriod) external;\\n\\n /**\\n * Submits a new Proposal, using one of the enabled [BaseStrategies](../BaseStrategy.md).\\n * New Proposals begin immediately in the `ACTIVE` state.\\n *\\n * @param _strategy address of the BaseStrategy implementation which the Proposal will use\\n * @param _data arbitrary data passed to the BaseStrategy implementation. This may not be used by all strategies, \\n * but is included in case future strategy contracts have a need for it\\n * @param _transactions array of transactions to propose\\n * @param _metadata additional data such as a title/description to submit with the proposal\\n */\\n function submitProposal(\\n address _strategy,\\n bytes memory _data,\\n Transaction[] calldata _transactions,\\n string calldata _metadata\\n ) external;\\n\\n /**\\n * Executes all transactions within a Proposal.\\n * This will only be able to be called if the Proposal passed.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @param _targets target contracts for each transaction\\n * @param _values ETH values to be sent with each transaction\\n * @param _data transaction data to be executed\\n * @param _operations Calls or Delegatecalls\\n */\\n function executeProposal(\\n uint32 _proposalId,\\n address[] memory _targets,\\n uint256[] memory _values,\\n bytes[] memory _data,\\n Enum.Operation[] memory _operations\\n ) external;\\n\\n /**\\n * Returns whether a [BaseStrategy](../BaseStrategy.md) implementation is enabled.\\n *\\n * @param _strategy contract address of the BaseStrategy to check\\n * @return bool True if the strategy is enabled, otherwise False\\n */\\n function isStrategyEnabled(address _strategy) external view returns (bool);\\n\\n /**\\n * Returns an array of enabled [BaseStrategy](../BaseStrategy.md) contract addresses.\\n * Because the list of BaseStrategies is technically unbounded, this\\n * requires the address of the first strategy you would like, along\\n * with the total count of strategies to return, rather than\\n * returning the whole list at once.\\n *\\n * @param _startAddress contract address of the BaseStrategy to start with\\n * @param _count maximum number of BaseStrategies that should be returned\\n * @return _strategies array of BaseStrategies\\n * @return _next next BaseStrategy contract address in the linked list\\n */\\n function getStrategies(\\n address _startAddress,\\n uint256 _count\\n ) external view returns (address[] memory _strategies, address _next);\\n\\n /**\\n * Gets the state of a Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @return ProposalState uint256 ProposalState enum value representing the\\n * current state of the proposal\\n */\\n function proposalState(uint32 _proposalId) external view returns (ProposalState);\\n\\n /**\\n * Generates the data for the module transaction hash (required for signing).\\n *\\n * @param _to target address of the transaction\\n * @param _value ETH value to send with the transaction\\n * @param _data encoded function call data of the transaction\\n * @param _operation Enum.Operation to use for the transaction\\n * @param _nonce Safe nonce of the transaction\\n * @return bytes hashed transaction data\\n */\\n function generateTxHashData(\\n address _to,\\n uint256 _value,\\n bytes memory _data,\\n Enum.Operation _operation,\\n uint256 _nonce\\n ) external view returns (bytes memory);\\n\\n /**\\n * Returns the `keccak256` hash of the specified transaction.\\n *\\n * @param _to target address of the transaction\\n * @param _value ETH value to send with the transaction\\n * @param _data encoded function call data of the transaction\\n * @param _operation Enum.Operation to use for the transaction\\n * @return bytes32 transaction hash\\n */\\n function getTxHash(\\n address _to,\\n uint256 _value,\\n bytes memory _data,\\n Enum.Operation _operation\\n ) external view returns (bytes32);\\n\\n /**\\n * Returns the hash of a transaction in a Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @param _txIndex index of the transaction within the Proposal\\n * @return bytes32 hash of the specified transaction\\n */\\n function getProposalTxHash(uint32 _proposalId, uint32 _txIndex) external view returns (bytes32);\\n\\n /**\\n * Returns the transaction hashes associated with a given `proposalId`.\\n *\\n * @param _proposalId identifier of the Proposal to get transaction hashes for\\n * @return bytes32[] array of transaction hashes\\n */\\n function getProposalTxHashes(uint32 _proposalId) external view returns (bytes32[] memory);\\n\\n /**\\n * Returns details about the specified Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @return _strategy address of the BaseStrategy contract the Proposal is on\\n * @return _txHashes hashes of the transactions the Proposal contains\\n * @return _timelockPeriod time (in blocks) the Proposal is timelocked for\\n * @return _executionPeriod time (in blocks) the Proposal must be executed within, after timelock ends\\n * @return _executionCounter counter of how many of the Proposals transactions have been executed\\n */\\n function getProposal(uint32 _proposalId) external view\\n returns (\\n address _strategy,\\n bytes32[] memory _txHashes,\\n uint32 _timelockPeriod,\\n uint32 _executionPeriod,\\n uint32 _executionCounter\\n );\\n}\\n\",\"keccak256\":\"0x1a656aacd0b0f11dec2b92d70153dc3a1b7019e9f76dd43f7c91a21fb8cfef3d\",\"license\":\"MIT\"},\"contracts/azorius/interfaces/IBaseStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\n/**\\n * The specification for a voting strategy in Azorius.\\n *\\n * Each IBaseStrategy implementation need only implement the given functions here,\\n * which allows for highly composable but simple or complex voting strategies.\\n *\\n * It should be noted that while many voting strategies make use of parameters such as\\n * voting period or quorum, that is a detail of the individual strategy itself, and not\\n * a requirement for the Azorius protocol.\\n */\\ninterface IBaseStrategy {\\n\\n /**\\n * Sets the address of the [Azorius](../Azorius.md) contract this \\n * [BaseStrategy](../BaseStrategy.md) is being used on.\\n *\\n * @param _azoriusModule address of the Azorius Safe module\\n */\\n function setAzorius(address _azoriusModule) external;\\n\\n /**\\n * Called by the [Azorius](../Azorius.md) module. This notifies this \\n * [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created.\\n *\\n * @param _data arbitrary data to pass to this BaseStrategy\\n */\\n function initializeProposal(bytes memory _data) external;\\n\\n /**\\n * Returns whether a Proposal has been passed.\\n *\\n * @param _proposalId proposalId to check\\n * @return bool true if the proposal has passed, otherwise false\\n */\\n function isPassed(uint32 _proposalId) external view returns (bool);\\n\\n /**\\n * Returns whether the specified address can submit a Proposal with\\n * this [BaseStrategy](../BaseStrategy.md).\\n *\\n * This allows a BaseStrategy to place any limits it would like on\\n * who can create new Proposals, such as requiring a minimum token\\n * delegation.\\n *\\n * @param _address address to check\\n * @return bool true if the address can submit a Proposal, otherwise false\\n */\\n function isProposer(address _address) external view returns (bool);\\n\\n /**\\n * Returns the block number voting ends on a given Proposal.\\n *\\n * @param _proposalId proposalId to check\\n * @return uint32 block number when voting ends on the Proposal\\n */\\n function votingEndBlock(uint32 _proposalId) external view returns (uint32);\\n}\\n\",\"keccak256\":\"0x5ad8cdea65caa49f4116c67ebcbc12094676ac64d70c35643a4cc517c8b220fe\",\"license\":\"LGPL-3.0-only\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHats {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n}\\n\",\"keccak256\":\"0x8e35022f5c0fcf0059033abec78ec890f0cf3bbac09d6d24051cff9679239511\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611b81806100ed6000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c80638a2f2c8a11610125578063a7713a70116100ad578063d3c22b381161007c578063d3c22b3814610472578063deb61c15146104b6578063e8575a7f146104ff578063f2fde38b14610512578063f96dae0a1461052557600080fd5b8063a7713a701461043a578063a77a81d014610443578063bf7e2c7f14610456578063ca1dc30b1461045f57600080fd5b806397e39fef116100f457806397e39fef146103e55780639bff4df4146103f85780639dd783c214610401578063a09c4f6814610414578063a4f9edbf1461042757600080fd5b80638a2f2c8a1461039b5780638da5cb5b146103ae578063918f84bf146103bf5780639767fb72146103d257600080fd5b806350631bfe116101a85780636fef541a116101775780636fef541a1461036e578063709e23f814610378578063715018a61461038057806374ec29a0146103885780638081be911461036e57600080fd5b806350631bfe146102dc57806353a8b320146102ff57806355a9dbd91461031257806366b629551461034357600080fd5b80631e2972e8116101e45780631e2972e81461029057806333f48a5e146102a357806337938ab3146102b65780633a622c52146102c957600080fd5b806302a251a31461021657806306f3f9e61461024757806308453ad21461025c5780631236af7c1461027d575b600080fd5b606a5461022d90600160a01b900463ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b61025a610255366004611532565b610538565b005b61026f61026a36600461155d565b61054c565b60405190815260200161023e565b61026f61028b36600461155d565b6105d5565b61026f61029e366004611532565b6105fb565b61025a6102b136600461155d565b61061c565b61025a6102c436600461158f565b61062d565b61025a6102d7366004611532565b61067f565b6102ef6102ea366004611532565b61079c565b604051901515815260200161023e565b6102ef61030d36600461155d565b6107f2565b61022d61032036600461155d565b63ffffffff9081166000908152606c602052604090205464010000000090041690565b606754610356906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b61026f620f424081565b60665461026f565b61025a610880565b6102ef61039636600461158f565b610894565b61025a6103a9366004611532565b61089f565b6033546001600160a01b0316610356565b6102ef6103cd3660046115ac565b6108b0565b61025a6103e03660046115ce565b6108e2565b606554610356906001600160a01b031681565b61026f606b5481565b6102ef61040f36600461160d565b6108fb565b61025a610422366004611532565b61092d565b61025a610435366004611680565b61093e565b61026f60685481565b61025a610451366004611680565b610a0a565b61026f60695481565b61026f61046d366004611715565b610af1565b6102ef610480366004611743565b63ffffffff82166000908152606c602090815260408083206001600160a01b038516845260040190915290205460ff1692915050565b6104c96104c436600461155d565b610b86565b6040805196875260208701959095529385019290925263ffffffff908116606085015216608083015260a082015260c00161023e565b61025a61050d366004611532565b610bd5565b61025a61052036600461158f565b610be6565b606a54610356906001600160a01b031681565b610540610c61565b61054981610cbb565b50565b606a5463ffffffff8281166000908152606c6020526040808220549051632394e7a360e21b815292166004830152916001600160a01b031690638e539e8c90602401602060405180830381865afa1580156105ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cf9190611771565b92915050565b6000620f42406105e48361054c565b6068546105f191906117a0565b6105cf91906117b7565b6066818154811061060b57600080fd5b600091825260209091200154905081565b610624610c61565b61054981610d1b565b610635610c61565b606780546001600160a01b0319166001600160a01b0383169081179091556040517fac8d831a6ed53a98387842e08d9e0893c1d478f4a3710b254e22bd58c06b269090600090a250565b610687610c61565b6000805b6066548110156107455782606682815481106106a9576106a96117d9565b90600052602060002001540361073357606680546106c9906001906117ef565b815481106106d9576106d96117d9565b9060005260206000200154606682815481106106f7576106f76117d9565b600091825260209091200155606680548061071457610714611802565b6001900381819060005260206000200160009055905560019150610745565b8061073d81611818565b91505061068b565b508061076457604051634b8d041f60e01b815260040160405180910390fd5b6040518281527f50544666722f5a4554f2716b5efb2ce814101451643c8856221fef06b5e9803b906020015b60405180910390a15050565b6000805b6066548110156107e95782606682815481106107be576107be6117d9565b9060005260206000200154036107d75750600192915050565b806107e181611818565b9150506107a0565b50600092915050565b63ffffffff8082166000908152606c60205260408120549091640100000000909104164311801561084f575061084f61082a8361054c565b63ffffffff84166000908152606c6020526040902060028101546003909101546108fb565b80156105cf575063ffffffff82166000908152606c6020526040902060028101546001909101546105cf91906108b0565b610888610c61565b6108926000610d6f565b565b60006105cf82610dc1565b6108a7610c61565b61054981610e93565b6000620f424060695483856108c59190611831565b6108cf91906117a0565b6108d991906117b7565b90921192915050565b6108f78233836108f23387610af1565b610ec8565b5050565b6000620f42406068548561090f91906117a0565b61091991906117b7565b6109238385611831565b1015949350505050565b610935610c61565b610549816110e7565b6000806000806000806000808880602001905181019061095e91906118c4565b604080516001600160a01b03808b166020830152808a1692820192909252908716606082015263ffffffff86166080820152600060a082015260c0810185905260e08101849052979f50959d50939b5091995097509550935091506109d590610100016040516020818303038152906040526111a9565b6109ff82826040516020016109eb929190611978565b6040516020818303038152906040526113a2565b505050505050505050565b6067546001600160a01b03163314610a35576040516358c30ce160e01b815260040160405180910390fd5b600081806020019051810190610a4b91906119ce565b606a54909150600090610a6b90600160a01b900463ffffffff16436119eb565b63ffffffff8381166000818152606c6020908152604091829020805467ffffffffffffffff191664010000000087871690810263ffffffff1916919091174390961695909517905581519283528201929092529192507f80d0ad93bba25e53bf67fa9f2d13df59f04795ec2f91b9b3c1f607666daf9d64910160405180910390a1505050565b606a5463ffffffff8281166000908152606c6020526040808220549051630748d63560e31b81526001600160a01b03878116600483015291909316602484015290921690633a46b1a890604401602060405180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611771565b9392505050565b63ffffffff8082166000908152606c6020526040812060018101546002820154600383015492549194909382821692640100000000900490911690610bca8761054c565b905091939550919395565b610bdd610c61565b61054981611468565b610bee610c61565b6001600160a01b038116610c585760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61054981610d6f565b6033546001600160a01b031633146108925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c4f565b620f4240811115610cdf57604051630d2a3fcb60e41b815260040160405180910390fd5b60688190556040518181527f0cc18e3862a55e514917eb8f248561dd65e0fbbba65f5468f203e92193635dd3906020015b60405180910390a150565b606a805463ffffffff60a01b1916600160a01b63ffffffff8416908102919091179091556040519081527f70770ce479f70673c3ed8fff63cfb758a6ffdddc30cab7c63d54c8d825e3948890602001610d10565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b6066548110156107e957606554606680546001600160a01b0390921691634352409a91869185908110610dfa57610dfa6117d9565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e739190611a0f565b15610e815750600192915050565b80610e8b81611818565b915050610dc5565b606b8190556040518181527f93deb5027728f04c9fd8d7bcea2efb36cc7a6a7876236649f2952de0aa89a01190602001610d10565b63ffffffff8085166000908152606c602052604081205464010000000090049091169003610f0957604051631dc0650160e31b815260040160405180910390fd5b63ffffffff8085166000908152606c6020526040902054640100000000900416431115610f4957604051637a19ed0560e01b815260040160405180910390fd5b63ffffffff84166000908152606c602090815260408083206001600160a01b038716845260040190915290205460ff1615610f9757604051637c9a1cf960e01b815260040160405180910390fd5b63ffffffff84166000908152606c602090815260408083206001600160a01b03871684526004019091529020805460ff1916600117905560ff82166110095763ffffffff84166000908152606c602052604081206001018054839290610ffe908490611831565b9091555061108a9050565b60001960ff83160161103d5763ffffffff84166000908152606c602052604081206002018054839290610ffe908490611831565b60011960ff8316016110715763ffffffff84166000908152606c602052604081206003018054839290610ffe908490611831565b604051636aee863360e11b815260040160405180910390fd5b604080516001600160a01b038516815263ffffffff8616602082015260ff8416818301526060810183905290517fe82b577bd384111662dd034b9114cbe59b26ea201f009d385006518ed28bed819181900360800190a150505050565b60005b606654811015611143578160668281548110611108576111086117d9565b9060005260206000200154036111315760405163634a456360e01b815260040160405180910390fd5b8061113b81611818565b9150506110ea565b50606680546001810182556000919091527f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354018190556040518181527f30590a8684cec4e5a2b48765f391c996b9a004652478a8f41dc46658ccb699ed90602001610d10565b600054610100900460ff16158080156111c95750600054600160ff909116105b806111e35750303b1580156111e3575060005460ff166001145b6112465760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c4f565b6000805460ff191660011790558015611269576000805461ff0019166101001790555b6000806000806000806000888060200190518101906112889190611a31565b959c50939a5091985096509450925090506001600160a01b0386166112c057604051630f58058360e11b815260040160405180910390fd5b606a80546001600160a01b0319166001600160a01b0388161790556112e36114d8565b6112ec87610be6565b6112f585610635565b6112fe82610cbb565b61130781611468565b61131084610d1b565b61131983610e93565b866001600160a01b0316856001600160a01b03167fca32f512f02914f6bc16a49e786443029061b9adc5a987fd2f6efa56c0116a1660405160405180910390a35050505050505080156108f7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610790565b600080828060200190518101906113b99190611aaf565b90925090506001600160a01b0382166113e5576040516350e80d4360e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b038416179055805160000361142257604051632a2b50e760e01b815260040160405180910390fd5b60005b815181101561146257611450828281518110611443576114436117d9565b60200260200101516110e7565b8061145a81611818565b915050611425565b50505050565b620f424081118061148557506114826002620f42406117b7565b81105b156114a3576040516302396b6b60e61b815260040160405180910390fd5b60698190556040518181527f406c076eac4d3dde1c5d55793e80239daa8c60ee971390ce3d9f90ca4206295390602001610d10565b600054610100900460ff166114ff5760405162461bcd60e51b8152600401610c4f90611b00565b610892600054610100900460ff166115295760405162461bcd60e51b8152600401610c4f90611b00565b61089233610d6f565b60006020828403121561154457600080fd5b5035919050565b63ffffffff8116811461054957600080fd5b60006020828403121561156f57600080fd5b8135610b7f8161154b565b6001600160a01b038116811461054957600080fd5b6000602082840312156115a157600080fd5b8135610b7f8161157a565b600080604083850312156115bf57600080fd5b50508035926020909101359150565b600080604083850312156115e157600080fd5b82356115ec8161154b565b9150602083013560ff8116811461160257600080fd5b809150509250929050565b60008060006060848603121561162257600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561167857611678611639565b604052919050565b6000602080838503121561169357600080fd5b823567ffffffffffffffff808211156116ab57600080fd5b818501915085601f8301126116bf57600080fd5b8135818111156116d1576116d1611639565b6116e3601f8201601f1916850161164f565b915080825286848285010111156116f957600080fd5b8084840185840137600090820190930192909252509392505050565b6000806040838503121561172857600080fd5b82356117338161157a565b915060208301356116028161154b565b6000806040838503121561175657600080fd5b82356117618161154b565b915060208301356116028161157a565b60006020828403121561178357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176105cf576105cf61178a565b6000826117d457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b818103818111156105cf576105cf61178a565b634e487b7160e01b600052603160045260246000fd5b60006001820161182a5761182a61178a565b5060010190565b808201808211156105cf576105cf61178a565b600082601f83011261185557600080fd5b8151602067ffffffffffffffff82111561187157611871611639565b8160051b61188082820161164f565b928352848101820192828101908785111561189a57600080fd5b83870192505b848310156118b9578251825291830191908301906118a0565b979650505050505050565b600080600080600080600080610100898b0312156118e157600080fd5b88516118ec8161157a565b60208a01519098506118fd8161157a565b60408a015190975061190e8161157a565b60608a015190965061191f8161154b565b809550506080890151935060a0890151925060c089015161193f8161157a565b60e08a015190925067ffffffffffffffff81111561195c57600080fd5b6119688b828c01611844565b9150509295985092959890939650565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b818110156119c1578451835293830193918301916001016119a5565b5090979650505050505050565b6000602082840312156119e057600080fd5b8151610b7f8161154b565b63ffffffff818116838216019080821115611a0857611a0861178a565b5092915050565b600060208284031215611a2157600080fd5b81518015158114610b7f57600080fd5b600080600080600080600060e0888a031215611a4c57600080fd5b8751611a578161157a565b6020890151909750611a688161157a565b6040890151909650611a798161157a565b6060890151909550611a8a8161154b565b809450506080880151925060a0880151915060c0880151905092959891949750929550565b60008060408385031215611ac257600080fd5b8251611acd8161157a565b602084015190925067ffffffffffffffff811115611aea57600080fd5b611af685828601611844565b9150509250929050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220ab328fb1a4e093d4d12859e26cec37e663125c61070ccda93b874f45821b408b64736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102115760003560e01c80638a2f2c8a11610125578063a7713a70116100ad578063d3c22b381161007c578063d3c22b3814610472578063deb61c15146104b6578063e8575a7f146104ff578063f2fde38b14610512578063f96dae0a1461052557600080fd5b8063a7713a701461043a578063a77a81d014610443578063bf7e2c7f14610456578063ca1dc30b1461045f57600080fd5b806397e39fef116100f457806397e39fef146103e55780639bff4df4146103f85780639dd783c214610401578063a09c4f6814610414578063a4f9edbf1461042757600080fd5b80638a2f2c8a1461039b5780638da5cb5b146103ae578063918f84bf146103bf5780639767fb72146103d257600080fd5b806350631bfe116101a85780636fef541a116101775780636fef541a1461036e578063709e23f814610378578063715018a61461038057806374ec29a0146103885780638081be911461036e57600080fd5b806350631bfe146102dc57806353a8b320146102ff57806355a9dbd91461031257806366b629551461034357600080fd5b80631e2972e8116101e45780631e2972e81461029057806333f48a5e146102a357806337938ab3146102b65780633a622c52146102c957600080fd5b806302a251a31461021657806306f3f9e61461024757806308453ad21461025c5780631236af7c1461027d575b600080fd5b606a5461022d90600160a01b900463ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b61025a610255366004611532565b610538565b005b61026f61026a36600461155d565b61054c565b60405190815260200161023e565b61026f61028b36600461155d565b6105d5565b61026f61029e366004611532565b6105fb565b61025a6102b136600461155d565b61061c565b61025a6102c436600461158f565b61062d565b61025a6102d7366004611532565b61067f565b6102ef6102ea366004611532565b61079c565b604051901515815260200161023e565b6102ef61030d36600461155d565b6107f2565b61022d61032036600461155d565b63ffffffff9081166000908152606c602052604090205464010000000090041690565b606754610356906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b61026f620f424081565b60665461026f565b61025a610880565b6102ef61039636600461158f565b610894565b61025a6103a9366004611532565b61089f565b6033546001600160a01b0316610356565b6102ef6103cd3660046115ac565b6108b0565b61025a6103e03660046115ce565b6108e2565b606554610356906001600160a01b031681565b61026f606b5481565b6102ef61040f36600461160d565b6108fb565b61025a610422366004611532565b61092d565b61025a610435366004611680565b61093e565b61026f60685481565b61025a610451366004611680565b610a0a565b61026f60695481565b61026f61046d366004611715565b610af1565b6102ef610480366004611743565b63ffffffff82166000908152606c602090815260408083206001600160a01b038516845260040190915290205460ff1692915050565b6104c96104c436600461155d565b610b86565b6040805196875260208701959095529385019290925263ffffffff908116606085015216608083015260a082015260c00161023e565b61025a61050d366004611532565b610bd5565b61025a61052036600461158f565b610be6565b606a54610356906001600160a01b031681565b610540610c61565b61054981610cbb565b50565b606a5463ffffffff8281166000908152606c6020526040808220549051632394e7a360e21b815292166004830152916001600160a01b031690638e539e8c90602401602060405180830381865afa1580156105ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105cf9190611771565b92915050565b6000620f42406105e48361054c565b6068546105f191906117a0565b6105cf91906117b7565b6066818154811061060b57600080fd5b600091825260209091200154905081565b610624610c61565b61054981610d1b565b610635610c61565b606780546001600160a01b0319166001600160a01b0383169081179091556040517fac8d831a6ed53a98387842e08d9e0893c1d478f4a3710b254e22bd58c06b269090600090a250565b610687610c61565b6000805b6066548110156107455782606682815481106106a9576106a96117d9565b90600052602060002001540361073357606680546106c9906001906117ef565b815481106106d9576106d96117d9565b9060005260206000200154606682815481106106f7576106f76117d9565b600091825260209091200155606680548061071457610714611802565b6001900381819060005260206000200160009055905560019150610745565b8061073d81611818565b91505061068b565b508061076457604051634b8d041f60e01b815260040160405180910390fd5b6040518281527f50544666722f5a4554f2716b5efb2ce814101451643c8856221fef06b5e9803b906020015b60405180910390a15050565b6000805b6066548110156107e95782606682815481106107be576107be6117d9565b9060005260206000200154036107d75750600192915050565b806107e181611818565b9150506107a0565b50600092915050565b63ffffffff8082166000908152606c60205260408120549091640100000000909104164311801561084f575061084f61082a8361054c565b63ffffffff84166000908152606c6020526040902060028101546003909101546108fb565b80156105cf575063ffffffff82166000908152606c6020526040902060028101546001909101546105cf91906108b0565b610888610c61565b6108926000610d6f565b565b60006105cf82610dc1565b6108a7610c61565b61054981610e93565b6000620f424060695483856108c59190611831565b6108cf91906117a0565b6108d991906117b7565b90921192915050565b6108f78233836108f23387610af1565b610ec8565b5050565b6000620f42406068548561090f91906117a0565b61091991906117b7565b6109238385611831565b1015949350505050565b610935610c61565b610549816110e7565b6000806000806000806000808880602001905181019061095e91906118c4565b604080516001600160a01b03808b166020830152808a1692820192909252908716606082015263ffffffff86166080820152600060a082015260c0810185905260e08101849052979f50959d50939b5091995097509550935091506109d590610100016040516020818303038152906040526111a9565b6109ff82826040516020016109eb929190611978565b6040516020818303038152906040526113a2565b505050505050505050565b6067546001600160a01b03163314610a35576040516358c30ce160e01b815260040160405180910390fd5b600081806020019051810190610a4b91906119ce565b606a54909150600090610a6b90600160a01b900463ffffffff16436119eb565b63ffffffff8381166000818152606c6020908152604091829020805467ffffffffffffffff191664010000000087871690810263ffffffff1916919091174390961695909517905581519283528201929092529192507f80d0ad93bba25e53bf67fa9f2d13df59f04795ec2f91b9b3c1f607666daf9d64910160405180910390a1505050565b606a5463ffffffff8281166000908152606c6020526040808220549051630748d63560e31b81526001600160a01b03878116600483015291909316602484015290921690633a46b1a890604401602060405180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611771565b9392505050565b63ffffffff8082166000908152606c6020526040812060018101546002820154600383015492549194909382821692640100000000900490911690610bca8761054c565b905091939550919395565b610bdd610c61565b61054981611468565b610bee610c61565b6001600160a01b038116610c585760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61054981610d6f565b6033546001600160a01b031633146108925760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c4f565b620f4240811115610cdf57604051630d2a3fcb60e41b815260040160405180910390fd5b60688190556040518181527f0cc18e3862a55e514917eb8f248561dd65e0fbbba65f5468f203e92193635dd3906020015b60405180910390a150565b606a805463ffffffff60a01b1916600160a01b63ffffffff8416908102919091179091556040519081527f70770ce479f70673c3ed8fff63cfb758a6ffdddc30cab7c63d54c8d825e3948890602001610d10565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b6066548110156107e957606554606680546001600160a01b0390921691634352409a91869185908110610dfa57610dfa6117d9565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa158015610e4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e739190611a0f565b15610e815750600192915050565b80610e8b81611818565b915050610dc5565b606b8190556040518181527f93deb5027728f04c9fd8d7bcea2efb36cc7a6a7876236649f2952de0aa89a01190602001610d10565b63ffffffff8085166000908152606c602052604081205464010000000090049091169003610f0957604051631dc0650160e31b815260040160405180910390fd5b63ffffffff8085166000908152606c6020526040902054640100000000900416431115610f4957604051637a19ed0560e01b815260040160405180910390fd5b63ffffffff84166000908152606c602090815260408083206001600160a01b038716845260040190915290205460ff1615610f9757604051637c9a1cf960e01b815260040160405180910390fd5b63ffffffff84166000908152606c602090815260408083206001600160a01b03871684526004019091529020805460ff1916600117905560ff82166110095763ffffffff84166000908152606c602052604081206001018054839290610ffe908490611831565b9091555061108a9050565b60001960ff83160161103d5763ffffffff84166000908152606c602052604081206002018054839290610ffe908490611831565b60011960ff8316016110715763ffffffff84166000908152606c602052604081206003018054839290610ffe908490611831565b604051636aee863360e11b815260040160405180910390fd5b604080516001600160a01b038516815263ffffffff8616602082015260ff8416818301526060810183905290517fe82b577bd384111662dd034b9114cbe59b26ea201f009d385006518ed28bed819181900360800190a150505050565b60005b606654811015611143578160668281548110611108576111086117d9565b9060005260206000200154036111315760405163634a456360e01b815260040160405180910390fd5b8061113b81611818565b9150506110ea565b50606680546001810182556000919091527f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354018190556040518181527f30590a8684cec4e5a2b48765f391c996b9a004652478a8f41dc46658ccb699ed90602001610d10565b600054610100900460ff16158080156111c95750600054600160ff909116105b806111e35750303b1580156111e3575060005460ff166001145b6112465760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c4f565b6000805460ff191660011790558015611269576000805461ff0019166101001790555b6000806000806000806000888060200190518101906112889190611a31565b959c50939a5091985096509450925090506001600160a01b0386166112c057604051630f58058360e11b815260040160405180910390fd5b606a80546001600160a01b0319166001600160a01b0388161790556112e36114d8565b6112ec87610be6565b6112f585610635565b6112fe82610cbb565b61130781611468565b61131084610d1b565b61131983610e93565b866001600160a01b0316856001600160a01b03167fca32f512f02914f6bc16a49e786443029061b9adc5a987fd2f6efa56c0116a1660405160405180910390a35050505050505080156108f7576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610790565b600080828060200190518101906113b99190611aaf565b90925090506001600160a01b0382166113e5576040516350e80d4360e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b038416179055805160000361142257604051632a2b50e760e01b815260040160405180910390fd5b60005b815181101561146257611450828281518110611443576114436117d9565b60200260200101516110e7565b8061145a81611818565b915050611425565b50505050565b620f424081118061148557506114826002620f42406117b7565b81105b156114a3576040516302396b6b60e61b815260040160405180910390fd5b60698190556040518181527f406c076eac4d3dde1c5d55793e80239daa8c60ee971390ce3d9f90ca4206295390602001610d10565b600054610100900460ff166114ff5760405162461bcd60e51b8152600401610c4f90611b00565b610892600054610100900460ff166115295760405162461bcd60e51b8152600401610c4f90611b00565b61089233610d6f565b60006020828403121561154457600080fd5b5035919050565b63ffffffff8116811461054957600080fd5b60006020828403121561156f57600080fd5b8135610b7f8161154b565b6001600160a01b038116811461054957600080fd5b6000602082840312156115a157600080fd5b8135610b7f8161157a565b600080604083850312156115bf57600080fd5b50508035926020909101359150565b600080604083850312156115e157600080fd5b82356115ec8161154b565b9150602083013560ff8116811461160257600080fd5b809150509250929050565b60008060006060848603121561162257600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561167857611678611639565b604052919050565b6000602080838503121561169357600080fd5b823567ffffffffffffffff808211156116ab57600080fd5b818501915085601f8301126116bf57600080fd5b8135818111156116d1576116d1611639565b6116e3601f8201601f1916850161164f565b915080825286848285010111156116f957600080fd5b8084840185840137600090820190930192909252509392505050565b6000806040838503121561172857600080fd5b82356117338161157a565b915060208301356116028161154b565b6000806040838503121561175657600080fd5b82356117618161154b565b915060208301356116028161157a565b60006020828403121561178357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176105cf576105cf61178a565b6000826117d457634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b818103818111156105cf576105cf61178a565b634e487b7160e01b600052603160045260246000fd5b60006001820161182a5761182a61178a565b5060010190565b808201808211156105cf576105cf61178a565b600082601f83011261185557600080fd5b8151602067ffffffffffffffff82111561187157611871611639565b8160051b61188082820161164f565b928352848101820192828101908785111561189a57600080fd5b83870192505b848310156118b9578251825291830191908301906118a0565b979650505050505050565b600080600080600080600080610100898b0312156118e157600080fd5b88516118ec8161157a565b60208a01519098506118fd8161157a565b60408a015190975061190e8161157a565b60608a015190965061191f8161154b565b809550506080890151935060a0890151925060c089015161193f8161157a565b60e08a015190925067ffffffffffffffff81111561195c57600080fd5b6119688b828c01611844565b9150509295985092959890939650565b6001600160a01b038316815260406020808301829052835191830182905260009184820191906060850190845b818110156119c1578451835293830193918301916001016119a5565b5090979650505050505050565b6000602082840312156119e057600080fd5b8151610b7f8161154b565b63ffffffff818116838216019080821115611a0857611a0861178a565b5092915050565b600060208284031215611a2157600080fd5b81518015158114610b7f57600080fd5b600080600080600080600060e0888a031215611a4c57600080fd5b8751611a578161157a565b6020890151909750611a688161157a565b6040890151909650611a798161157a565b6060890151909550611a8a8161154b565b809450506080880151925060a0880151915060c0880151905092959891949750929550565b60008060408385031215611ac257600080fd5b8251611acd8161157a565b602084015190925067ffffffffffffffff811115611aea57600080fd5b611af685828601611844565b9150509250929050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220ab328fb1a4e093d4d12859e26cec37e663125c61070ccda93b874f45821b408b64736f6c63430008130033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "getProposalVotes(uint32)": { + "params": { + "_proposalId": "id of the Proposal" + }, + "returns": { + "abstainVotes": "current count of \"ABSTAIN\" votes", + "endBlock": "block number voting ends", + "noVotes": "current count of \"NO\" votes", + "startBlock": "block number voting starts", + "yesVotes": "current count of \"YES\" votes" + } + }, + "getProposalVotingSupply(uint32)": { + "params": { + "_proposalId": "id of the Proposal" + }, + "returns": { + "_0": "uint256 voting supply snapshot for the given _proposalId" + } + }, + "getVotingWeight(address,uint32)": { + "params": { + "_proposalId": "id of the Proposal", + "_voter": "address of the voter" + }, + "returns": { + "_0": "uint256 the address' voting weight" + } + }, + "getWhitelistedHatsCount()": { + "returns": { + "_0": "The number of whitelisted hats" + } + }, + "hasVoted(uint32,address)": { + "params": { + "_address": "address to check", + "_proposalId": "id of the Proposal to check" + }, + "returns": { + "_0": "bool true if the address has voted on the Proposal, otherwise false" + } + }, + "initializeProposal(bytes)": { + "params": { + "_data": "arbitrary data to pass to this BaseStrategy" + } + }, + "isHatWhitelisted(uint256)": { + "params": { + "_hatId": "The ID of the Hat to check" + }, + "returns": { + "_0": "True if the hat is whitelisted, false otherwise" + } + }, + "isPassed(uint32)": { + "params": { + "_proposalId": "proposalId to check" + }, + "returns": { + "_0": "bool true if the proposal has passed, otherwise false" + } + }, + "isProposer(address)": { + "details": "Checks if an address is authorized to create proposals.", + "params": { + "_address": "The address to check for proposal creation authorization." + }, + "returns": { + "_0": "bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise." + } + }, + "meetsBasis(uint256,uint256)": { + "params": { + "_noVotes": "number of votes against", + "_yesVotes": "number of votes in favor" + }, + "returns": { + "_0": "bool whether the yes votes meets the set basis" + } + }, + "meetsQuorum(uint256,uint256,uint256)": { + "params": { + "_abstainVotes": "number of votes abstaining", + "_totalSupply": "the total supply of tokens", + "_yesVotes": "number of votes in favor" + }, + "returns": { + "_0": "bool whether the total number of yes votes + abstain meets the quorum" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "quorumVotes(uint32)": { + "params": { + "_proposalId": "The ID of the proposal to get quorum votes for" + }, + "returns": { + "_0": "uint256 The quantity of votes required to meet quorum" + } + }, + "removeHatFromWhitelist(uint256)": { + "params": { + "_hatId": "The ID of the Hat to remove from the whitelist" + } + }, + "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." + }, + "setAzorius(address)": { + "params": { + "_azoriusModule": "address of the Azorius Safe module" + } + }, + "setUp(bytes)": { + "params": { + "initializeParams": "encoded initialization parameters: `address _owner`, `address _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`, `uint256 _quorumNumerator`, `uint256 _basisNumerator`, `address _hatsContract`, `uint256[] _initialWhitelistedHats`" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "updateBasisNumerator(uint256)": { + "params": { + "_basisNumerator": "numerator to use" + } + }, + "updateQuorumNumerator(uint256)": { + "params": { + "_quorumNumerator": "numerator to use when calculating quorum (over 1,000,000)" + } + }, + "updateRequiredProposerWeight(uint256)": { + "params": { + "_requiredProposerWeight": "required token voting weight" + } + }, + "updateVotingPeriod(uint32)": { + "params": { + "_votingPeriod": "voting time period (in blocks)" + } + }, + "vote(uint32,uint8)": { + "params": { + "_proposalId": "id of the Proposal to vote on", + "_voteType": "Proposal support as defined in VoteType (NO, YES, ABSTAIN)" + } + }, + "votingEndBlock(uint32)": { + "params": { + "_proposalId": "proposalId to check" + }, + "returns": { + "_0": "uint32 block number when voting ends on the Proposal" + } + }, + "whitelistHat(uint256)": { + "params": { + "_hatId": "The ID of the Hat to whitelist" + } + } + }, + "version": 1 + }, + "userdoc": { + "errors": { + "InvalidQuorumNumerator()": [ + { + "notice": "Ensures the numerator cannot be larger than the denominator. " + } + ] + }, + "kind": "user", + "methods": { + "BASIS_DENOMINATOR()": { + "notice": "The denominator to use when calculating basis (1,000,000). " + }, + "QUORUM_DENOMINATOR()": { + "notice": "The denominator to use when calculating quorum (1,000,000). " + }, + "basisNumerator()": { + "notice": "The numerator to use when calculating basis (adjustable). " + }, + "getProposalVotes(uint32)": { + "notice": "Returns the current state of the specified Proposal." + }, + "getProposalVotingSupply(uint32)": { + "notice": "Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change, it is necessary to calculate quorum from the supply available at the time of the Proposal's creation, not when it is being voted on passes / fails." + }, + "getVotingWeight(address,uint32)": { + "notice": "Calculates the voting weight an address has for a specific Proposal." + }, + "getWhitelistedHatsCount()": { + "notice": "Returns the number of whitelisted hats." + }, + "hasVoted(uint32,address)": { + "notice": "Returns whether an address has voted on the specified Proposal." + }, + "initializeProposal(bytes)": { + "notice": "Called by the [Azorius](../Azorius.md) module. This notifies this [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created." + }, + "isHatWhitelisted(uint256)": { + "notice": "Checks if a hat is whitelisted." + }, + "isPassed(uint32)": { + "notice": "Returns whether a Proposal has been passed." + }, + "isProposer(address)": { + "notice": "This function overrides the isProposer function from the parent contract. It iterates through all whitelisted Hat IDs and checks if the given address is wearing any of them using the Hats Protocol." + }, + "meetsBasis(uint256,uint256)": { + "notice": "Calculates whether a vote meets its basis." + }, + "meetsQuorum(uint256,uint256,uint256)": { + "notice": "Calculates whether a vote meets quorum. This is calculated based on yes votes + abstain votes." + }, + "quorumNumerator()": { + "notice": "The numerator to use when calculating quorum (adjustable). " + }, + "quorumVotes(uint32)": { + "notice": "Calculates the total number of votes required for a proposal to meet quorum. " + }, + "removeHatFromWhitelist(uint256)": { + "notice": "Removes a Hat from the whitelist for proposal creation." + }, + "requiredProposerWeight()": { + "notice": "Voting weight required to be able to submit Proposals. " + }, + "setAzorius(address)": { + "notice": "Sets the address of the [Azorius](../Azorius.md) contract this [BaseStrategy](../BaseStrategy.md) is being used on." + }, + "setUp(bytes)": { + "notice": "Sets up the contract with its initial parameters." + }, + "updateBasisNumerator(uint256)": { + "notice": "Updates the `basisNumerator` for future Proposals." + }, + "updateQuorumNumerator(uint256)": { + "notice": "Updates the quorum required for future Proposals." + }, + "updateRequiredProposerWeight(uint256)": { + "notice": "Updates the voting weight required to submit new Proposals." + }, + "updateVotingPeriod(uint32)": { + "notice": "Updates the voting time period for new Proposals." + }, + "vote(uint32,uint8)": { + "notice": "Casts votes for a Proposal, equal to the caller's token delegation." + }, + "votingEndBlock(uint32)": { + "notice": "Returns the block number voting ends on a given Proposal." + }, + "votingPeriod()": { + "notice": "Number of blocks a new Proposal can be voted on. " + }, + "whitelistHat(uint256)": { + "notice": "Adds a Hat to the whitelist for proposal creation." + }, + "whitelistedHatIds(uint256)": { + "notice": "Array to store whitelisted Hat IDs. " + } + }, + "notice": "An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that enables linear (i.e. 1 to 1) ERC21 based token voting, with proposal creation restricted to users wearing whitelisted Hats.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3585, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3588, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6487, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 3379, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3499, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 16744, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "hatsContract", + "offset": 0, + "slot": "101", + "type": "t_contract(IHats)22245" + }, + { + "astId": 16748, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "whitelistedHatIds", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 16551, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "azoriusModule", + "offset": 0, + "slot": "103", + "type": "t_contract(IAzorius)21329" + }, + { + "astId": 16440, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "quorumNumerator", + "offset": 0, + "slot": "104", + "type": "t_uint256" + }, + { + "astId": 16651, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "basisNumerator", + "offset": 0, + "slot": "105", + "type": "t_uint256" + }, + { + "astId": 17692, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "governanceToken", + "offset": 0, + "slot": "106", + "type": "t_contract(IVotes)9759" + }, + { + "astId": 17695, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "votingPeriod", + "offset": 20, + "slot": "106", + "type": "t_uint32" + }, + { + "astId": 17698, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "requiredProposerWeight", + "offset": 0, + "slot": "107", + "type": "t_uint256" + }, + { + "astId": 17704, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "proposalVotes", + "offset": 0, + "slot": "108", + "type": "t_mapping(t_uint256,t_struct(ProposalVotes)17689_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IAzorius)21329": { + "encoding": "inplace", + "label": "contract IAzorius", + "numberOfBytes": "20" + }, + "t_contract(IHats)22245": { + "encoding": "inplace", + "label": "contract IHats", + "numberOfBytes": "20" + }, + "t_contract(IVotes)9759": { + "encoding": "inplace", + "label": "contract IVotes", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_struct(ProposalVotes)17689_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct LinearERC20VotingExtensible.ProposalVotes)", + "numberOfBytes": "32", + "value": "t_struct(ProposalVotes)17689_storage" + }, + "t_struct(ProposalVotes)17689_storage": { + "encoding": "inplace", + "label": "struct LinearERC20VotingExtensible.ProposalVotes", + "members": [ + { + "astId": 17676, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "votingStartBlock", + "offset": 0, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 17678, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "votingEndBlock", + "offset": 4, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 17680, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "noVotes", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 17682, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "yesVotes", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 17684, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "abstainVotes", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 17688, + "contract": "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol:LinearERC20VotingWithHatsProposalCreation", + "label": "hasVoted", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_bool)" + } + ], + "numberOfBytes": "160" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/LinearERC721VotingWithHatsProposalCreation.json b/deployments/sepolia/LinearERC721VotingWithHatsProposalCreation.json new file mode 100644 index 00000000..cd5b5bae --- /dev/null +++ b/deployments/sepolia/LinearERC721VotingWithHatsProposalCreation.json @@ -0,0 +1,1494 @@ +{ + "address": "0x17C592C9Ce1ED1ba0e9a593d8c38978448D21157", + "abi": [ + { + "inputs": [], + "name": "HatAlreadyWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "HatNotWhitelisted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "IdAlreadyVoted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "IdNotOwned", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidBasisNumerator", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidHatsContract", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParams", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidProposal", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidTokenAddress", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidVote", + "type": "error" + }, + { + "inputs": [], + "name": "NoHatsWhitelisted", + "type": "error" + }, + { + "inputs": [], + "name": "NoVotingWeight", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyAzorius", + "type": "error" + }, + { + "inputs": [], + "name": "TokenAlreadySet", + "type": "error" + }, + { + "inputs": [], + "name": "TokenNotSet", + "type": "error" + }, + { + "inputs": [], + "name": "VotingEnded", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "azoriusModule", + "type": "address" + } + ], + "name": "AzoriusSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "basisNumerator", + "type": "uint256" + } + ], + "name": "BasisNumeratorUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "weight", + "type": "uint256" + } + ], + "name": "GovernanceTokenAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "name": "GovernanceTokenRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "hatId", + "type": "uint256" + } + ], + "name": "HatRemovedFromWhitelist", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "hatId", + "type": "uint256" + } + ], + "name": "HatWhitelisted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "proposalId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "votingEndBlock", + "type": "uint32" + } + ], + "name": "ProposalInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "proposerThreshold", + "type": "uint256" + } + ], + "name": "ProposerThresholdUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "quorumThreshold", + "type": "uint256" + } + ], + "name": "QuorumThresholdUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "azoriusModule", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "StrategySetUp", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "voter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "proposalId", + "type": "uint32" + }, + { + "indexed": false, + "internalType": "uint8", + "name": "voteType", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "tokenAddresses", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "tokenIds", + "type": "uint256[]" + } + ], + "name": "Voted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint32", + "name": "votingPeriod", + "type": "uint32" + } + ], + "name": "VotingPeriodUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "BASIS_DENOMINATOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_weight", + "type": "uint256" + } + ], + "name": "addGovernanceToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "azoriusModule", + "outputs": [ + { + "internalType": "contract IAzorius", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "basisNumerator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAllTokenAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "getProposalVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "noVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "abstainVotes", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "startBlock", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "endBlock", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenAddress", + "type": "address" + } + ], + "name": "getTokenWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getWhitelistedHatsCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + }, + { + "internalType": "address", + "name": "_tokenAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "hasVoted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "hatsContract", + "outputs": [ + { + "internalType": "contract IHats", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "name": "initializeProposal", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "isHatWhitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "isPassed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + } + ], + "name": "isProposer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_noVotes", + "type": "uint256" + } + ], + "name": "meetsBasis", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "proposalVotes", + "outputs": [ + { + "internalType": "uint32", + "name": "votingStartBlock", + "type": "uint32" + }, + { + "internalType": "uint32", + "name": "votingEndBlock", + "type": "uint32" + }, + { + "internalType": "uint256", + "name": "noVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "yesVotes", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "abstainVotes", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposerThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "quorumThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_tokenAddress", + "type": "address" + } + ], + "name": "removeGovernanceToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "removeHatFromWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_azoriusModule", + "type": "address" + } + ], + "name": "setAzorius", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "initializeParams", + "type": "bytes" + } + ], + "name": "setUp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "tokenAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "tokenWeights", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_basisNumerator", + "type": "uint256" + } + ], + "name": "updateBasisNumerator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_proposerThreshold", + "type": "uint256" + } + ], + "name": "updateProposerThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_quorumThreshold", + "type": "uint256" + } + ], + "name": "updateQuorumThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_votingPeriod", + "type": "uint32" + } + ], + "name": "updateVotingPeriod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + }, + { + "internalType": "uint8", + "name": "_voteType", + "type": "uint8" + }, + { + "internalType": "address[]", + "name": "_tokenAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "_tokenIds", + "type": "uint256[]" + } + ], + "name": "vote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "_proposalId", + "type": "uint32" + } + ], + "name": "votingEndBlock", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "votingPeriod", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_hatId", + "type": "uint256" + } + ], + "name": "whitelistHat", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "whitelistedHatIds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "transactionHash": "0x6306fee4747b40bce95f1fd5331718451cafcf6ed959026f143e8d378e3dff06", + "receipt": { + "to": null, + "from": "0x637366C372a9096b262bd2fe6c40D7BCc6239976", + "contractAddress": "0x17C592C9Ce1ED1ba0e9a593d8c38978448D21157", + "transactionIndex": 44, + "gasUsed": "1972405", + "logsBloom": "0x00000000000000000002000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080040000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x60c352bab771bd776319425f3d6c1081eb9f002ec82d66e83732b13f5a7c19d8", + "transactionHash": "0x6306fee4747b40bce95f1fd5331718451cafcf6ed959026f143e8d378e3dff06", + "logs": [ + { + "transactionIndex": 44, + "blockNumber": 6929978, + "transactionHash": "0x6306fee4747b40bce95f1fd5331718451cafcf6ed959026f143e8d378e3dff06", + "address": "0x17C592C9Ce1ED1ba0e9a593d8c38978448D21157", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", + "logIndex": 75, + "blockHash": "0x60c352bab771bd776319425f3d6c1081eb9f002ec82d66e83732b13f5a7c19d8" + } + ], + "blockNumber": 6929978, + "cumulativeGasUsed": "5698271", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "8098c390a54ad5a8bcff70bed7c24a3c", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"HatAlreadyWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"HatNotWhitelisted\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"IdAlreadyVoted\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"IdNotOwned\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidBasisNumerator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidHatsContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParams\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidProposal\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTokenAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidVote\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoHatsWhitelisted\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoVotingWeight\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyAzorius\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenAlreadySet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenNotSet\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VotingEnded\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"azoriusModule\",\"type\":\"address\"}],\"name\":\"AzoriusSet\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"basisNumerator\",\"type\":\"uint256\"}],\"name\":\"BasisNumeratorUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"GovernanceTokenAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"GovernanceTokenRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"hatId\",\"type\":\"uint256\"}],\"name\":\"HatRemovedFromWhitelist\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"hatId\",\"type\":\"uint256\"}],\"name\":\"HatWhitelisted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"proposalId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"votingEndBlock\",\"type\":\"uint32\"}],\"name\":\"ProposalInitialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proposerThreshold\",\"type\":\"uint256\"}],\"name\":\"ProposerThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"quorumThreshold\",\"type\":\"uint256\"}],\"name\":\"QuorumThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"azoriusModule\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"StrategySetUp\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"proposalId\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"voteType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tokenAddresses\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"}],\"name\":\"Voted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"votingPeriod\",\"type\":\"uint32\"}],\"name\":\"VotingPeriodUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"BASIS_DENOMINATOR\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_weight\",\"type\":\"uint256\"}],\"name\":\"addGovernanceToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"azoriusModule\",\"outputs\":[{\"internalType\":\"contract IAzorius\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"basisNumerator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTokenAddresses\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"getProposalVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"noVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"abstainVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"startBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"endBlock\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getTokenWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getWhitelistedHatsCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tokenId\",\"type\":\"uint256\"}],\"name\":\"hasVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"hatsContract\",\"outputs\":[{\"internalType\":\"contract IHats\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"initializeProposal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"isHatWhitelisted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"isPassed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_address\",\"type\":\"address\"}],\"name\":\"isProposer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_noVotes\",\"type\":\"uint256\"}],\"name\":\"meetsBasis\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"proposalVotes\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"votingStartBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"votingEndBlock\",\"type\":\"uint32\"},{\"internalType\":\"uint256\",\"name\":\"noVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"yesVotes\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"abstainVotes\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proposerThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"quorumThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"removeGovernanceToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"removeHatFromWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_azoriusModule\",\"type\":\"address\"}],\"name\":\"setAzorius\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initializeParams\",\"type\":\"bytes\"}],\"name\":\"setUp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenAddresses\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_basisNumerator\",\"type\":\"uint256\"}],\"name\":\"updateBasisNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_proposerThreshold\",\"type\":\"uint256\"}],\"name\":\"updateProposerThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_quorumThreshold\",\"type\":\"uint256\"}],\"name\":\"updateQuorumThreshold\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_votingPeriod\",\"type\":\"uint32\"}],\"name\":\"updateVotingPeriod\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"},{\"internalType\":\"uint8\",\"name\":\"_voteType\",\"type\":\"uint8\"},{\"internalType\":\"address[]\",\"name\":\"_tokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_tokenIds\",\"type\":\"uint256[]\"}],\"name\":\"vote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"_proposalId\",\"type\":\"uint32\"}],\"name\":\"votingEndBlock\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"votingPeriod\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_hatId\",\"type\":\"uint256\"}],\"name\":\"whitelistHat\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"whitelistedHatIds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"}},\"kind\":\"dev\",\"methods\":{\"addGovernanceToken(address,uint256)\":{\"params\":{\"_tokenAddress\":\"the address of the ERC-721 token\",\"_weight\":\"the number of votes each NFT id is worth\"}},\"getProposalVotes(uint32)\":{\"params\":{\"_proposalId\":\"id of the Proposal\"},\"returns\":{\"abstainVotes\":\"current count of \\\"ABSTAIN\\\" votes\",\"endBlock\":\"block number voting ends\",\"noVotes\":\"current count of \\\"NO\\\" votes\",\"startBlock\":\"block number voting starts\",\"yesVotes\":\"current count of \\\"YES\\\" votes\"}},\"getTokenWeight(address)\":{\"params\":{\"_tokenAddress\":\"the ERC-721 token address\"}},\"getWhitelistedHatsCount()\":{\"returns\":{\"_0\":\"The number of whitelisted hats\"}},\"hasVoted(uint32,address,uint256)\":{\"params\":{\"_proposalId\":\"the id of the Proposal\",\"_tokenAddress\":\"the ERC-721 contract address\",\"_tokenId\":\"the unique id of the NFT\"}},\"initializeProposal(bytes)\":{\"params\":{\"_data\":\"arbitrary data to pass to this BaseStrategy\"}},\"isHatWhitelisted(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to check\"},\"returns\":{\"_0\":\"True if the hat is whitelisted, false otherwise\"}},\"isPassed(uint32)\":{\"params\":{\"_proposalId\":\"proposalId to check\"},\"returns\":{\"_0\":\"bool true if the proposal has passed, otherwise false\"}},\"isProposer(address)\":{\"details\":\"Checks if an address is authorized to create proposals.\",\"params\":{\"_address\":\"The address to check for proposal creation authorization.\"},\"returns\":{\"_0\":\"bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise.\"}},\"meetsBasis(uint256,uint256)\":{\"params\":{\"_noVotes\":\"number of votes against\",\"_yesVotes\":\"number of votes in favor\"},\"returns\":{\"_0\":\"bool whether the yes votes meets the set basis\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"removeGovernanceToken(address)\":{\"params\":{\"_tokenAddress\":\"the ERC-721 token to remove\"}},\"removeHatFromWhitelist(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to remove from the whitelist\"}},\"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.\"},\"setAzorius(address)\":{\"params\":{\"_azoriusModule\":\"address of the Azorius Safe module\"}},\"setUp(bytes)\":{\"params\":{\"initializeParams\":\"encoded initialization parameters: `address _owner`, `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`, `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _basisNumerator`, `address _hatsContract`, `uint256[] _initialWhitelistedHats`\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"updateBasisNumerator(uint256)\":{\"params\":{\"_basisNumerator\":\"numerator to use\"}},\"updateProposerThreshold(uint256)\":{\"params\":{\"_proposerThreshold\":\"required voting weight\"}},\"updateQuorumThreshold(uint256)\":{\"params\":{\"_quorumThreshold\":\"total voting weight required to achieve quorum\"}},\"updateVotingPeriod(uint32)\":{\"params\":{\"_votingPeriod\":\"voting time period (in blocks)\"}},\"vote(uint32,uint8,address[],uint256[])\":{\"params\":{\"_proposalId\":\"id of the Proposal to vote on\",\"_tokenAddresses\":\"list of ERC-721 addresses that correspond to ids in _tokenIds\",\"_tokenIds\":\"list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\",\"_voteType\":\"Proposal support as defined in VoteType (NO, YES, ABSTAIN)\"}},\"votingEndBlock(uint32)\":{\"params\":{\"_proposalId\":\"proposalId to check\"},\"returns\":{\"_0\":\"uint32 block number when voting ends on the Proposal\"}},\"whitelistHat(uint256)\":{\"params\":{\"_hatId\":\"The ID of the Hat to whitelist\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"BASIS_DENOMINATOR()\":{\"notice\":\"The denominator to use when calculating basis (1,000,000). \"},\"addGovernanceToken(address,uint256)\":{\"notice\":\"Adds a new ERC-721 token as a governance token, along with its associated weight.\"},\"basisNumerator()\":{\"notice\":\"The numerator to use when calculating basis (adjustable). \"},\"getAllTokenAddresses()\":{\"notice\":\"Returns whole list of governance tokens addresses\"},\"getProposalVotes(uint32)\":{\"notice\":\"Returns the current state of the specified Proposal.\"},\"getTokenWeight(address)\":{\"notice\":\"Returns the current token weight for the given ERC-721 token address.\"},\"getWhitelistedHatsCount()\":{\"notice\":\"Returns the number of whitelisted hats.\"},\"hasVoted(uint32,address,uint256)\":{\"notice\":\"Returns whether an NFT id has already voted.\"},\"initializeProposal(bytes)\":{\"notice\":\"Called by the [Azorius](../Azorius.md) module. This notifies this [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created.\"},\"isHatWhitelisted(uint256)\":{\"notice\":\"Checks if a hat is whitelisted.\"},\"isPassed(uint32)\":{\"notice\":\"Returns whether a Proposal has been passed.\"},\"isProposer(address)\":{\"notice\":\"This function overrides the isProposer function from the parent contract. It iterates through all whitelisted Hat IDs and checks if the given address is wearing any of them using the Hats Protocol.\"},\"meetsBasis(uint256,uint256)\":{\"notice\":\"Calculates whether a vote meets its basis.\"},\"proposalVotes(uint256)\":{\"notice\":\"`proposalId` to `ProposalVotes`, the voting state of a Proposal. \"},\"proposerThreshold()\":{\"notice\":\"The minimum number of voting power required to create a new proposal.\"},\"quorumThreshold()\":{\"notice\":\"The total number of votes required to achieve quorum. \\\"Quorum threshold\\\" is used instead of a quorum percent because IERC721 has no totalSupply function, so the contract cannot determine this.\"},\"removeGovernanceToken(address)\":{\"notice\":\"Removes the given ERC-721 token address from the list of governance tokens.\"},\"removeHatFromWhitelist(uint256)\":{\"notice\":\"Removes a Hat from the whitelist for proposal creation.\"},\"setAzorius(address)\":{\"notice\":\"Sets the address of the [Azorius](../Azorius.md) contract this [BaseStrategy](../BaseStrategy.md) is being used on.\"},\"setUp(bytes)\":{\"notice\":\"Sets up the contract with its initial parameters.\"},\"tokenAddresses(uint256)\":{\"notice\":\"The list of ERC-721 tokens that can vote. \"},\"tokenWeights(address)\":{\"notice\":\"ERC-721 address to its voting weight per NFT id. \"},\"updateBasisNumerator(uint256)\":{\"notice\":\"Updates the `basisNumerator` for future Proposals.\"},\"updateProposerThreshold(uint256)\":{\"notice\":\"Updates the voting weight required to submit new Proposals.\"},\"updateQuorumThreshold(uint256)\":{\"notice\":\"Updates the quorum required for future Proposals.\"},\"updateVotingPeriod(uint32)\":{\"notice\":\"Updates the voting time period for new Proposals.\"},\"vote(uint32,uint8,address[],uint256[])\":{\"notice\":\"Submits a vote on an existing Proposal.\"},\"votingEndBlock(uint32)\":{\"notice\":\"Returns the block number voting ends on a given Proposal.\"},\"votingPeriod()\":{\"notice\":\"Number of blocks a new Proposal can be voted on. \"},\"whitelistHat(uint256)\":{\"notice\":\"Adds a Hat to the whitelist for proposal creation.\"},\"whitelistedHatIds(uint256)\":{\"notice\":\"Array to store whitelisted Hat IDs. \"}},\"notice\":\"An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that enables linear (i.e. 1 to 1) ERC721 based token voting, with proposal creation restricted to users wearing whitelisted Hats.\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol\":\"LinearERC721VotingWithHatsProposalCreation\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity >=0.7.0 <0.9.0;\\n\\n/// @title Enum - Collection of enums\\n/// @author Richard Meissner - \\ncontract Enum {\\n enum Operation {Call, DelegateCall}\\n}\\n\",\"keccak256\":\"0x473e45b1a5cc47be494b0e123c9127f0c11c1e0992a321ae5a644c0bfdb2c14f\",\"license\":\"LGPL-3.0-only\"},\"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\n\\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\\npragma solidity >=0.7.0 <0.9.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\nabstract contract FactoryFriendly is OwnableUpgradeable {\\n function setUp(bytes memory initializeParams) public virtual;\\n}\\n\",\"keccak256\":\"0x96e61585b7340a901a54eb4c157ce28b630bff3d9d4597dfaac692128ea458c4\",\"license\":\"LGPL-3.0-only\"},\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev 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 account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\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 OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\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() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"contracts/azorius/BaseStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport { IAzorius } from \\\"./interfaces/IAzorius.sol\\\";\\nimport { IBaseStrategy } from \\\"./interfaces/IBaseStrategy.sol\\\";\\nimport { FactoryFriendly } from \\\"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\\\";\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * The base abstract contract for all voting strategies in Azorius.\\n */\\nabstract contract BaseStrategy is OwnableUpgradeable, FactoryFriendly, IBaseStrategy {\\n\\n event AzoriusSet(address indexed azoriusModule);\\n event StrategySetUp(address indexed azoriusModule, address indexed owner);\\n\\n error OnlyAzorius();\\n\\n IAzorius public azoriusModule;\\n\\n /**\\n * Ensures that only the [Azorius](./Azorius.md) contract that pertains to this \\n * [BaseStrategy](./BaseStrategy.md) can call functions on it.\\n */\\n modifier onlyAzorius() {\\n if (msg.sender != address(azoriusModule)) revert OnlyAzorius();\\n _;\\n }\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /** @inheritdoc IBaseStrategy*/\\n function setAzorius(address _azoriusModule) external onlyOwner {\\n azoriusModule = IAzorius(_azoriusModule);\\n emit AzoriusSet(_azoriusModule);\\n }\\n\\n /** @inheritdoc IBaseStrategy*/\\n function initializeProposal(bytes memory _data) external virtual;\\n\\n /** @inheritdoc IBaseStrategy*/\\n function isPassed(uint32 _proposalId) external view virtual returns (bool);\\n\\n /** @inheritdoc IBaseStrategy*/\\n function isProposer(address _address) external view virtual returns (bool);\\n\\n /** @inheritdoc IBaseStrategy*/\\n function votingEndBlock(uint32 _proposalId) external view virtual returns (uint32);\\n\\n /**\\n * Sets the address of the [Azorius](Azorius.md) module contract.\\n *\\n * @param _azoriusModule address of the Azorius module\\n */\\n function _setAzorius(address _azoriusModule) internal {\\n azoriusModule = IAzorius(_azoriusModule);\\n emit AzoriusSet(_azoriusModule);\\n }\\n}\\n\",\"keccak256\":\"0xd04aeec28b5a7c7bad44f2c9dfe7641240e319b8d76d05f940453a258411c567\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/BaseVotingBasisPercent.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport { OwnableUpgradeable } from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\n\\n/**\\n * An Azorius extension contract that enables percent based voting basis calculations.\\n *\\n * Intended to be implemented by BaseStrategy implementations, this allows for voting strategies\\n * to dictate any basis strategy for passing a Proposal between >50% (simple majority) to 100%.\\n *\\n * See https://en.wikipedia.org/wiki/Voting#Voting_basis.\\n * See https://en.wikipedia.org/wiki/Supermajority.\\n */\\nabstract contract BaseVotingBasisPercent is OwnableUpgradeable {\\n \\n /** The numerator to use when calculating basis (adjustable). */\\n uint256 public basisNumerator;\\n\\n /** The denominator to use when calculating basis (1,000,000). */\\n uint256 public constant BASIS_DENOMINATOR = 1_000_000;\\n\\n error InvalidBasisNumerator();\\n\\n event BasisNumeratorUpdated(uint256 basisNumerator);\\n\\n /**\\n * Updates the `basisNumerator` for future Proposals.\\n *\\n * @param _basisNumerator numerator to use\\n */\\n function updateBasisNumerator(uint256 _basisNumerator) public virtual onlyOwner {\\n _updateBasisNumerator(_basisNumerator);\\n }\\n\\n /** Internal implementation of `updateBasisNumerator`. */\\n function _updateBasisNumerator(uint256 _basisNumerator) internal virtual {\\n if (_basisNumerator > BASIS_DENOMINATOR || _basisNumerator < BASIS_DENOMINATOR / 2)\\n revert InvalidBasisNumerator();\\n\\n basisNumerator = _basisNumerator;\\n\\n emit BasisNumeratorUpdated(_basisNumerator);\\n }\\n\\n /**\\n * Calculates whether a vote meets its basis.\\n *\\n * @param _yesVotes number of votes in favor\\n * @param _noVotes number of votes against\\n * @return bool whether the yes votes meets the set basis\\n */\\n function meetsBasis(uint256 _yesVotes, uint256 _noVotes) public view returns (bool) {\\n return _yesVotes > (_yesVotes + _noVotes) * basisNumerator / BASIS_DENOMINATOR;\\n }\\n}\\n\",\"keccak256\":\"0x568d4c7f3e5de10272ec675cd745a53b414ca2e3388bfeff19d8addf9e324c7e\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/HatsProposalCreationWhitelist.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\nimport {OwnableUpgradeable} from \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/full/IHats.sol\\\";\\n\\nabstract contract HatsProposalCreationWhitelist is OwnableUpgradeable {\\n event HatWhitelisted(uint256 hatId);\\n event HatRemovedFromWhitelist(uint256 hatId);\\n\\n IHats public hatsContract;\\n\\n /** Array to store whitelisted Hat IDs. */\\n uint256[] public whitelistedHatIds;\\n\\n error InvalidHatsContract();\\n error NoHatsWhitelisted();\\n error HatAlreadyWhitelisted();\\n error HatNotWhitelisted();\\n\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters:\\n * `address _hatsContract`, `uint256[] _initialWhitelistedHats`\\n */\\n function setUp(bytes memory initializeParams) public virtual {\\n (address _hatsContract, uint256[] memory _initialWhitelistedHats) = abi\\n .decode(initializeParams, (address, uint256[]));\\n\\n if (_hatsContract == address(0)) revert InvalidHatsContract();\\n hatsContract = IHats(_hatsContract);\\n\\n if (_initialWhitelistedHats.length == 0) revert NoHatsWhitelisted();\\n for (uint256 i = 0; i < _initialWhitelistedHats.length; i++) {\\n _whitelistHat(_initialWhitelistedHats[i]);\\n }\\n }\\n\\n /**\\n * Adds a Hat to the whitelist for proposal creation.\\n * @param _hatId The ID of the Hat to whitelist\\n */\\n function whitelistHat(uint256 _hatId) external onlyOwner {\\n _whitelistHat(_hatId);\\n }\\n\\n /**\\n * Internal function to add a Hat to the whitelist.\\n * @param _hatId The ID of the Hat to whitelist\\n */\\n function _whitelistHat(uint256 _hatId) internal {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) revert HatAlreadyWhitelisted();\\n }\\n whitelistedHatIds.push(_hatId);\\n emit HatWhitelisted(_hatId);\\n }\\n\\n /**\\n * Removes a Hat from the whitelist for proposal creation.\\n * @param _hatId The ID of the Hat to remove from the whitelist\\n */\\n function removeHatFromWhitelist(uint256 _hatId) external onlyOwner {\\n bool found = false;\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) {\\n whitelistedHatIds[i] = whitelistedHatIds[\\n whitelistedHatIds.length - 1\\n ];\\n whitelistedHatIds.pop();\\n found = true;\\n break;\\n }\\n }\\n if (!found) revert HatNotWhitelisted();\\n\\n emit HatRemovedFromWhitelist(_hatId);\\n }\\n\\n /**\\n * @dev Checks if an address is authorized to create proposals.\\n * @param _address The address to check for proposal creation authorization.\\n * @return bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise.\\n * @notice This function overrides the isProposer function from the parent contract.\\n * It iterates through all whitelisted Hat IDs and checks if the given address\\n * is wearing any of them using the Hats Protocol.\\n */\\n function isProposer(address _address) public view virtual returns (bool) {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (hatsContract.isWearerOfHat(_address, whitelistedHatIds[i])) {\\n return true;\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * Returns the number of whitelisted hats.\\n * @return The number of whitelisted hats\\n */\\n function getWhitelistedHatsCount() public view returns (uint256) {\\n return whitelistedHatIds.length;\\n }\\n\\n /**\\n * Checks if a hat is whitelisted.\\n * @param _hatId The ID of the Hat to check\\n * @return True if the hat is whitelisted, false otherwise\\n */\\n function isHatWhitelisted(uint256 _hatId) public view returns (bool) {\\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\\n if (whitelistedHatIds[i] == _hatId) {\\n return true;\\n }\\n }\\n return false;\\n }\\n}\\n\",\"keccak256\":\"0xa5696079ca64c569d3a648538649fcfa335609b65c328013bd5ff2aa51acc560\",\"license\":\"MIT\"},\"contracts/azorius/LinearERC721VotingExtensible.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\nimport {IERC721VotingStrategy} from \\\"./interfaces/IERC721VotingStrategy.sol\\\";\\nimport {IERC721} from \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport {BaseVotingBasisPercent} from \\\"./BaseVotingBasisPercent.sol\\\";\\nimport {IAzorius} from \\\"./interfaces/IAzorius.sol\\\";\\nimport {BaseStrategy} from \\\"./BaseStrategy.sol\\\";\\n\\n/**\\n * An Azorius strategy that allows multiple ERC721 tokens to be registered as governance tokens,\\n * each with their own voting weight.\\n *\\n * This is slightly different from ERC-20 voting, since there is no way to snapshot ERC721 holdings.\\n * Each ERC721 id can vote once, reguardless of what address held it when a proposal was created.\\n *\\n * Also, this uses \\\"quorumThreshold\\\" rather than LinearERC20Voting's quorumPercent, because the\\n * total supply of NFTs is not knowable within the IERC721 interface. This is similar to a multisig\\n * \\\"total signers\\\" required, rather than a percentage of the tokens.\\n *\\n * This contract is an extensible version of LinearERC721Voting, with all functions\\n * marked as `virtual`. This allows other contracts to inherit from it and override\\n * any part of its functionality. The existence of this contract enables the creation\\n * of more specialized voting strategies that build upon the basic linear ERC721 voting\\n * mechanism while allowing for customization of specific aspects as needed.\\n */\\nabstract contract LinearERC721VotingExtensible is\\n BaseStrategy,\\n BaseVotingBasisPercent,\\n IERC721VotingStrategy\\n{\\n /**\\n * The voting options for a Proposal.\\n */\\n enum VoteType {\\n NO, // disapproves of executing the Proposal\\n YES, // approves of executing the Proposal\\n ABSTAIN // neither YES nor NO, i.e. voting \\\"present\\\"\\n }\\n\\n /**\\n * Defines the current state of votes on a particular Proposal.\\n */\\n struct ProposalVotes {\\n uint32 votingStartBlock; // block that voting starts at\\n uint32 votingEndBlock; // block that voting ends\\n uint256 noVotes; // current number of NO votes for the Proposal\\n uint256 yesVotes; // current number of YES votes for the Proposal\\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\\n /**\\n * ERC-721 contract address to individual NFT id to bool\\n * of whether it has voted on this proposal.\\n */\\n mapping(address => mapping(uint256 => bool)) hasVoted;\\n }\\n\\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\\n mapping(uint256 => ProposalVotes) public proposalVotes;\\n\\n /** The list of ERC-721 tokens that can vote. */\\n address[] public tokenAddresses;\\n\\n /** ERC-721 address to its voting weight per NFT id. */\\n mapping(address => uint256) public tokenWeights;\\n\\n /** Number of blocks a new Proposal can be voted on. */\\n uint32 public votingPeriod;\\n\\n /**\\n * The total number of votes required to achieve quorum.\\n * \\\"Quorum threshold\\\" is used instead of a quorum percent because IERC721 has no\\n * totalSupply function, so the contract cannot determine this.\\n */\\n uint256 public quorumThreshold;\\n\\n /**\\n * The minimum number of voting power required to create a new proposal.\\n */\\n uint256 public proposerThreshold;\\n\\n event VotingPeriodUpdated(uint32 votingPeriod);\\n event QuorumThresholdUpdated(uint256 quorumThreshold);\\n event ProposerThresholdUpdated(uint256 proposerThreshold);\\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\\n event Voted(\\n address voter,\\n uint32 proposalId,\\n uint8 voteType,\\n address[] tokenAddresses,\\n uint256[] tokenIds\\n );\\n event GovernanceTokenAdded(address token, uint256 weight);\\n event GovernanceTokenRemoved(address token);\\n\\n error InvalidParams();\\n error InvalidProposal();\\n error VotingEnded();\\n error InvalidVote();\\n error InvalidTokenAddress();\\n error NoVotingWeight();\\n error TokenAlreadySet();\\n error TokenNotSet();\\n error IdAlreadyVoted(uint256 tokenId);\\n error IdNotOwned(uint256 tokenId);\\n\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters: `address _owner`,\\n * `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`,\\n * `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _proposerThreshold`,\\n * `uint256 _basisNumerator`\\n */\\n function setUp(\\n bytes memory initializeParams\\n ) public virtual override initializer {\\n (\\n address _owner,\\n address[] memory _tokens,\\n uint256[] memory _weights,\\n address _azoriusModule,\\n uint32 _votingPeriod,\\n uint256 _quorumThreshold,\\n uint256 _proposerThreshold,\\n uint256 _basisNumerator\\n ) = abi.decode(\\n initializeParams,\\n (\\n address,\\n address[],\\n uint256[],\\n address,\\n uint32,\\n uint256,\\n uint256,\\n uint256\\n )\\n );\\n\\n if (_tokens.length != _weights.length) {\\n revert InvalidParams();\\n }\\n\\n for (uint i = 0; i < _tokens.length; ) {\\n _addGovernanceToken(_tokens[i], _weights[i]);\\n unchecked {\\n ++i;\\n }\\n }\\n\\n __Ownable_init();\\n transferOwnership(_owner);\\n _setAzorius(_azoriusModule);\\n _updateQuorumThreshold(_quorumThreshold);\\n _updateProposerThreshold(_proposerThreshold);\\n _updateBasisNumerator(_basisNumerator);\\n _updateVotingPeriod(_votingPeriod);\\n\\n emit StrategySetUp(_azoriusModule, _owner);\\n }\\n\\n /**\\n * Adds a new ERC-721 token as a governance token, along with its associated weight.\\n *\\n * @param _tokenAddress the address of the ERC-721 token\\n * @param _weight the number of votes each NFT id is worth\\n */\\n function addGovernanceToken(\\n address _tokenAddress,\\n uint256 _weight\\n ) external virtual onlyOwner {\\n _addGovernanceToken(_tokenAddress, _weight);\\n }\\n\\n /**\\n * Updates the voting time period for new Proposals.\\n *\\n * @param _votingPeriod voting time period (in blocks)\\n */\\n function updateVotingPeriod(\\n uint32 _votingPeriod\\n ) external virtual onlyOwner {\\n _updateVotingPeriod(_votingPeriod);\\n }\\n\\n /**\\n * Updates the quorum required for future Proposals.\\n *\\n * @param _quorumThreshold total voting weight required to achieve quorum\\n */\\n function updateQuorumThreshold(\\n uint256 _quorumThreshold\\n ) external virtual onlyOwner {\\n _updateQuorumThreshold(_quorumThreshold);\\n }\\n\\n /**\\n * Updates the voting weight required to submit new Proposals.\\n *\\n * @param _proposerThreshold required voting weight\\n */\\n function updateProposerThreshold(\\n uint256 _proposerThreshold\\n ) external virtual onlyOwner {\\n _updateProposerThreshold(_proposerThreshold);\\n }\\n\\n /**\\n * Returns whole list of governance tokens addresses\\n */\\n function getAllTokenAddresses()\\n external\\n view\\n virtual\\n returns (address[] memory)\\n {\\n return tokenAddresses;\\n }\\n\\n /**\\n * Returns the current state of the specified Proposal.\\n *\\n * @param _proposalId id of the Proposal\\n * @return noVotes current count of \\\"NO\\\" votes\\n * @return yesVotes current count of \\\"YES\\\" votes\\n * @return abstainVotes current count of \\\"ABSTAIN\\\" votes\\n * @return startBlock block number voting starts\\n * @return endBlock block number voting ends\\n */\\n function getProposalVotes(\\n uint32 _proposalId\\n )\\n external\\n view\\n virtual\\n returns (\\n uint256 noVotes,\\n uint256 yesVotes,\\n uint256 abstainVotes,\\n uint32 startBlock,\\n uint32 endBlock\\n )\\n {\\n noVotes = proposalVotes[_proposalId].noVotes;\\n yesVotes = proposalVotes[_proposalId].yesVotes;\\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\\n startBlock = proposalVotes[_proposalId].votingStartBlock;\\n endBlock = proposalVotes[_proposalId].votingEndBlock;\\n }\\n\\n /**\\n * Submits a vote on an existing Proposal.\\n *\\n * @param _proposalId id of the Proposal to vote on\\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\\n */\\n function vote(\\n uint32 _proposalId,\\n uint8 _voteType,\\n address[] memory _tokenAddresses,\\n uint256[] memory _tokenIds\\n ) external virtual {\\n if (_tokenAddresses.length != _tokenIds.length) revert InvalidParams();\\n _vote(_proposalId, msg.sender, _voteType, _tokenAddresses, _tokenIds);\\n }\\n\\n /** @inheritdoc IERC721VotingStrategy*/\\n function getTokenWeight(\\n address _tokenAddress\\n ) external view virtual override returns (uint256) {\\n return tokenWeights[_tokenAddress];\\n }\\n\\n /**\\n * Returns whether an NFT id has already voted.\\n *\\n * @param _proposalId the id of the Proposal\\n * @param _tokenAddress the ERC-721 contract address\\n * @param _tokenId the unique id of the NFT\\n */\\n function hasVoted(\\n uint32 _proposalId,\\n address _tokenAddress,\\n uint256 _tokenId\\n ) external view virtual returns (bool) {\\n return proposalVotes[_proposalId].hasVoted[_tokenAddress][_tokenId];\\n }\\n\\n /**\\n * Removes the given ERC-721 token address from the list of governance tokens.\\n *\\n * @param _tokenAddress the ERC-721 token to remove\\n */\\n function removeGovernanceToken(\\n address _tokenAddress\\n ) external virtual onlyOwner {\\n if (tokenWeights[_tokenAddress] == 0) revert TokenNotSet();\\n\\n tokenWeights[_tokenAddress] = 0;\\n\\n uint256 length = tokenAddresses.length;\\n for (uint256 i = 0; i < length; ) {\\n if (_tokenAddress == tokenAddresses[i]) {\\n uint256 last = length - 1;\\n tokenAddresses[i] = tokenAddresses[last]; // move the last token into the position to remove\\n delete tokenAddresses[last]; // delete the last token\\n break;\\n }\\n unchecked {\\n ++i;\\n }\\n }\\n\\n emit GovernanceTokenRemoved(_tokenAddress);\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function initializeProposal(\\n bytes memory _data\\n ) public virtual override onlyAzorius {\\n uint32 proposalId = abi.decode(_data, (uint32));\\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\\n\\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\\n\\n emit ProposalInitialized(proposalId, _votingEndBlock);\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function isPassed(\\n uint32 _proposalId\\n ) public view virtual override returns (bool) {\\n return (block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\\n quorumThreshold <=\\n proposalVotes[_proposalId].yesVotes +\\n proposalVotes[_proposalId].abstainVotes && // yes + abstain votes meets the quorum\\n meetsBasis(\\n proposalVotes[_proposalId].yesVotes,\\n proposalVotes[_proposalId].noVotes\\n )); // yes votes meets the basis\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function isProposer(\\n address _address\\n ) public view virtual override returns (bool) {\\n uint256 totalWeight = 0;\\n for (uint i = 0; i < tokenAddresses.length; ) {\\n address tokenAddress = tokenAddresses[i];\\n totalWeight +=\\n IERC721(tokenAddress).balanceOf(_address) *\\n tokenWeights[tokenAddress];\\n unchecked {\\n ++i;\\n }\\n }\\n return totalWeight >= proposerThreshold;\\n }\\n\\n /** @inheritdoc BaseStrategy*/\\n function votingEndBlock(\\n uint32 _proposalId\\n ) public view virtual override returns (uint32) {\\n return proposalVotes[_proposalId].votingEndBlock;\\n }\\n\\n /** Internal implementation of `addGovernanceToken` */\\n function _addGovernanceToken(\\n address _tokenAddress,\\n uint256 _weight\\n ) internal virtual {\\n if (!IERC721(_tokenAddress).supportsInterface(0x80ac58cd))\\n revert InvalidTokenAddress();\\n\\n if (_weight == 0) revert NoVotingWeight();\\n\\n if (tokenWeights[_tokenAddress] > 0) revert TokenAlreadySet();\\n\\n tokenAddresses.push(_tokenAddress);\\n tokenWeights[_tokenAddress] = _weight;\\n\\n emit GovernanceTokenAdded(_tokenAddress, _weight);\\n }\\n\\n /** Internal implementation of `updateVotingPeriod`. */\\n function _updateVotingPeriod(uint32 _votingPeriod) internal virtual {\\n votingPeriod = _votingPeriod;\\n emit VotingPeriodUpdated(_votingPeriod);\\n }\\n\\n /** Internal implementation of `updateQuorumThreshold`. */\\n function _updateQuorumThreshold(uint256 _quorumThreshold) internal virtual {\\n quorumThreshold = _quorumThreshold;\\n emit QuorumThresholdUpdated(quorumThreshold);\\n }\\n\\n /** Internal implementation of `updateProposerThreshold`. */\\n function _updateProposerThreshold(\\n uint256 _proposerThreshold\\n ) internal virtual {\\n proposerThreshold = _proposerThreshold;\\n emit ProposerThresholdUpdated(_proposerThreshold);\\n }\\n\\n /**\\n * Internal function for casting a vote on a Proposal.\\n *\\n * @param _proposalId id of the Proposal\\n * @param _voter address casting the vote\\n * @param _voteType vote support, as defined in VoteType\\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\\n */\\n function _vote(\\n uint32 _proposalId,\\n address _voter,\\n uint8 _voteType,\\n address[] memory _tokenAddresses,\\n uint256[] memory _tokenIds\\n ) internal virtual {\\n uint256 weight;\\n\\n // verifies the voter holds the NFTs and returns the total weight associated with their tokens\\n // the frontend will need to determine whether an address can vote on a proposal, as it is possible\\n // to vote twice if you get more weight later on\\n for (uint256 i = 0; i < _tokenAddresses.length; ) {\\n address tokenAddress = _tokenAddresses[i];\\n uint256 tokenId = _tokenIds[i];\\n\\n if (_voter != IERC721(tokenAddress).ownerOf(tokenId)) {\\n revert IdNotOwned(tokenId);\\n }\\n\\n if (\\n proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] ==\\n true\\n ) {\\n revert IdAlreadyVoted(tokenId);\\n }\\n\\n weight += tokenWeights[tokenAddress];\\n proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] = true;\\n unchecked {\\n ++i;\\n }\\n }\\n\\n if (weight == 0) revert NoVotingWeight();\\n\\n ProposalVotes storage proposal = proposalVotes[_proposalId];\\n\\n if (proposal.votingEndBlock == 0) revert InvalidProposal();\\n\\n if (block.number > proposal.votingEndBlock) revert VotingEnded();\\n\\n if (_voteType == uint8(VoteType.NO)) {\\n proposal.noVotes += weight;\\n } else if (_voteType == uint8(VoteType.YES)) {\\n proposal.yesVotes += weight;\\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\\n proposal.abstainVotes += weight;\\n } else {\\n revert InvalidVote();\\n }\\n\\n emit Voted(_voter, _proposalId, _voteType, _tokenAddresses, _tokenIds);\\n }\\n}\\n\",\"keccak256\":\"0xee30735f644b248e168075aa46373e571f76590fb73f9c79a396511bc1e2a681\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\nimport {LinearERC721VotingExtensible} from \\\"./LinearERC721VotingExtensible.sol\\\";\\nimport {HatsProposalCreationWhitelist} from \\\"./HatsProposalCreationWhitelist.sol\\\";\\nimport {IHats} from \\\"../interfaces/hats/IHats.sol\\\";\\n\\n/**\\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\\n * enables linear (i.e. 1 to 1) ERC721 based token voting, with proposal creation\\n * restricted to users wearing whitelisted Hats.\\n */\\ncontract LinearERC721VotingWithHatsProposalCreation is\\n HatsProposalCreationWhitelist,\\n LinearERC721VotingExtensible\\n{\\n /**\\n * Sets up the contract with its initial parameters.\\n *\\n * @param initializeParams encoded initialization parameters: `address _owner`,\\n * `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`,\\n * `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _basisNumerator`,\\n * `address _hatsContract`, `uint256[] _initialWhitelistedHats`\\n */\\n function setUp(\\n bytes memory initializeParams\\n )\\n public\\n override(HatsProposalCreationWhitelist, LinearERC721VotingExtensible)\\n {\\n (\\n address _owner,\\n address[] memory _tokens,\\n uint256[] memory _weights,\\n address _azoriusModule,\\n uint32 _votingPeriod,\\n uint256 _quorumThreshold,\\n uint256 _basisNumerator,\\n address _hatsContract,\\n uint256[] memory _initialWhitelistedHats\\n ) = abi.decode(\\n initializeParams,\\n (\\n address,\\n address[],\\n uint256[],\\n address,\\n uint32,\\n uint256,\\n uint256,\\n address,\\n uint256[]\\n )\\n );\\n\\n LinearERC721VotingExtensible.setUp(\\n abi.encode(\\n _owner,\\n _tokens,\\n _weights,\\n _azoriusModule,\\n _votingPeriod,\\n _quorumThreshold,\\n 0, // _proposerThreshold is zero because we only care about the hat check\\n _basisNumerator\\n )\\n );\\n\\n HatsProposalCreationWhitelist.setUp(\\n abi.encode(_hatsContract, _initialWhitelistedHats)\\n );\\n }\\n\\n /** @inheritdoc HatsProposalCreationWhitelist*/\\n function isProposer(\\n address _address\\n )\\n public\\n view\\n override(HatsProposalCreationWhitelist, LinearERC721VotingExtensible)\\n returns (bool)\\n {\\n return HatsProposalCreationWhitelist.isProposer(_address);\\n }\\n}\\n\",\"keccak256\":\"0x977781be8c49e6332dd890fcd5b5fe69d9c25eaf0c447aeb74dec72e3e13acb0\",\"license\":\"MIT\"},\"contracts/azorius/interfaces/IAzorius.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\nimport { Enum } from \\\"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\\\";\\n\\n/**\\n * The base interface for the Azorius governance Safe module.\\n * Azorius conforms to the Zodiac pattern for Safe modules: https://github.com/gnosis/zodiac\\n *\\n * Azorius manages the state of Proposals submitted to a DAO, along with the associated strategies\\n * ([BaseStrategy](../BaseStrategy.md)) for voting that are enabled on the DAO.\\n *\\n * Any given DAO can support multiple voting BaseStrategies, and these strategies are intended to be\\n * as customizable as possible.\\n *\\n * Proposals begin in the `ACTIVE` state and will ultimately end in either\\n * the `EXECUTED`, `EXPIRED`, or `FAILED` state.\\n *\\n * `ACTIVE` - a new proposal begins in this state, and stays in this state\\n * for the duration of its voting period.\\n *\\n * `TIMELOCKED` - A proposal that passes enters the `TIMELOCKED` state, during which\\n * it cannot yet be executed. This is to allow time for token holders\\n * to potentially exit their position, as well as parent DAOs time to\\n * initiate a freeze, if they choose to do so. A proposal stays timelocked\\n * for the duration of its `timelockPeriod`.\\n *\\n * `EXECUTABLE` - Following the `TIMELOCKED` state, a passed proposal becomes `EXECUTABLE`,\\n * and can then finally be executed on chain by anyone.\\n *\\n * `EXECUTED` - the final state for a passed proposal. The proposal has been executed\\n * on the blockchain.\\n *\\n * `EXPIRED` - a passed proposal which is not executed before its `executionPeriod` has\\n * elapsed will be `EXPIRED`, and can no longer be executed.\\n *\\n * `FAILED` - a failed proposal (as defined by its [BaseStrategy](../BaseStrategy.md) \\n * `isPassed` function). For a basic strategy, this would mean it received more \\n * NO votes than YES or did not achieve quorum. \\n */\\ninterface IAzorius {\\n\\n /** Represents a transaction to perform on the blockchain. */\\n struct Transaction {\\n address to; // destination address of the transaction\\n uint256 value; // amount of ETH to transfer with the transaction\\n bytes data; // encoded function call data of the transaction\\n Enum.Operation operation; // Operation type, Call or DelegateCall\\n }\\n\\n /** Holds details pertaining to a single proposal. */\\n struct Proposal {\\n uint32 executionCounter; // count of transactions that have been executed within the proposal\\n uint32 timelockPeriod; // time (in blocks) this proposal will be timelocked for if it passes\\n uint32 executionPeriod; // time (in blocks) this proposal has to be executed after timelock ends before it is expired\\n address strategy; // BaseStrategy contract this proposal was created on\\n bytes32[] txHashes; // hashes of the transactions that are being proposed\\n }\\n\\n /** The list of states in which a Proposal can be in at any given time. */\\n enum ProposalState {\\n ACTIVE,\\n TIMELOCKED,\\n EXECUTABLE,\\n EXECUTED,\\n EXPIRED,\\n FAILED\\n }\\n\\n /**\\n * Enables a [BaseStrategy](../BaseStrategy.md) implementation for newly created Proposals.\\n *\\n * Multiple strategies can be enabled, and new Proposals will be able to be\\n * created using any of the currently enabled strategies.\\n *\\n * @param _strategy contract address of the BaseStrategy to be enabled\\n */\\n function enableStrategy(address _strategy) external;\\n\\n /**\\n * Disables a previously enabled [BaseStrategy](../BaseStrategy.md) implementation for new proposals.\\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\\n *\\n * @param _prevStrategy BaseStrategy address that pointed in the linked list to the strategy to be removed\\n * @param _strategy address of the BaseStrategy to be removed\\n */\\n function disableStrategy(address _prevStrategy, address _strategy) external;\\n\\n /**\\n * Updates the `timelockPeriod` for newly created Proposals.\\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\\n *\\n * @param _timelockPeriod timelockPeriod (in blocks) to be used for new Proposals\\n */\\n function updateTimelockPeriod(uint32 _timelockPeriod) external;\\n\\n /**\\n * Updates the execution period for future Proposals.\\n *\\n * @param _executionPeriod new execution period (in blocks)\\n */\\n function updateExecutionPeriod(uint32 _executionPeriod) external;\\n\\n /**\\n * Submits a new Proposal, using one of the enabled [BaseStrategies](../BaseStrategy.md).\\n * New Proposals begin immediately in the `ACTIVE` state.\\n *\\n * @param _strategy address of the BaseStrategy implementation which the Proposal will use\\n * @param _data arbitrary data passed to the BaseStrategy implementation. This may not be used by all strategies, \\n * but is included in case future strategy contracts have a need for it\\n * @param _transactions array of transactions to propose\\n * @param _metadata additional data such as a title/description to submit with the proposal\\n */\\n function submitProposal(\\n address _strategy,\\n bytes memory _data,\\n Transaction[] calldata _transactions,\\n string calldata _metadata\\n ) external;\\n\\n /**\\n * Executes all transactions within a Proposal.\\n * This will only be able to be called if the Proposal passed.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @param _targets target contracts for each transaction\\n * @param _values ETH values to be sent with each transaction\\n * @param _data transaction data to be executed\\n * @param _operations Calls or Delegatecalls\\n */\\n function executeProposal(\\n uint32 _proposalId,\\n address[] memory _targets,\\n uint256[] memory _values,\\n bytes[] memory _data,\\n Enum.Operation[] memory _operations\\n ) external;\\n\\n /**\\n * Returns whether a [BaseStrategy](../BaseStrategy.md) implementation is enabled.\\n *\\n * @param _strategy contract address of the BaseStrategy to check\\n * @return bool True if the strategy is enabled, otherwise False\\n */\\n function isStrategyEnabled(address _strategy) external view returns (bool);\\n\\n /**\\n * Returns an array of enabled [BaseStrategy](../BaseStrategy.md) contract addresses.\\n * Because the list of BaseStrategies is technically unbounded, this\\n * requires the address of the first strategy you would like, along\\n * with the total count of strategies to return, rather than\\n * returning the whole list at once.\\n *\\n * @param _startAddress contract address of the BaseStrategy to start with\\n * @param _count maximum number of BaseStrategies that should be returned\\n * @return _strategies array of BaseStrategies\\n * @return _next next BaseStrategy contract address in the linked list\\n */\\n function getStrategies(\\n address _startAddress,\\n uint256 _count\\n ) external view returns (address[] memory _strategies, address _next);\\n\\n /**\\n * Gets the state of a Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @return ProposalState uint256 ProposalState enum value representing the\\n * current state of the proposal\\n */\\n function proposalState(uint32 _proposalId) external view returns (ProposalState);\\n\\n /**\\n * Generates the data for the module transaction hash (required for signing).\\n *\\n * @param _to target address of the transaction\\n * @param _value ETH value to send with the transaction\\n * @param _data encoded function call data of the transaction\\n * @param _operation Enum.Operation to use for the transaction\\n * @param _nonce Safe nonce of the transaction\\n * @return bytes hashed transaction data\\n */\\n function generateTxHashData(\\n address _to,\\n uint256 _value,\\n bytes memory _data,\\n Enum.Operation _operation,\\n uint256 _nonce\\n ) external view returns (bytes memory);\\n\\n /**\\n * Returns the `keccak256` hash of the specified transaction.\\n *\\n * @param _to target address of the transaction\\n * @param _value ETH value to send with the transaction\\n * @param _data encoded function call data of the transaction\\n * @param _operation Enum.Operation to use for the transaction\\n * @return bytes32 transaction hash\\n */\\n function getTxHash(\\n address _to,\\n uint256 _value,\\n bytes memory _data,\\n Enum.Operation _operation\\n ) external view returns (bytes32);\\n\\n /**\\n * Returns the hash of a transaction in a Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @param _txIndex index of the transaction within the Proposal\\n * @return bytes32 hash of the specified transaction\\n */\\n function getProposalTxHash(uint32 _proposalId, uint32 _txIndex) external view returns (bytes32);\\n\\n /**\\n * Returns the transaction hashes associated with a given `proposalId`.\\n *\\n * @param _proposalId identifier of the Proposal to get transaction hashes for\\n * @return bytes32[] array of transaction hashes\\n */\\n function getProposalTxHashes(uint32 _proposalId) external view returns (bytes32[] memory);\\n\\n /**\\n * Returns details about the specified Proposal.\\n *\\n * @param _proposalId identifier of the Proposal\\n * @return _strategy address of the BaseStrategy contract the Proposal is on\\n * @return _txHashes hashes of the transactions the Proposal contains\\n * @return _timelockPeriod time (in blocks) the Proposal is timelocked for\\n * @return _executionPeriod time (in blocks) the Proposal must be executed within, after timelock ends\\n * @return _executionCounter counter of how many of the Proposals transactions have been executed\\n */\\n function getProposal(uint32 _proposalId) external view\\n returns (\\n address _strategy,\\n bytes32[] memory _txHashes,\\n uint32 _timelockPeriod,\\n uint32 _executionPeriod,\\n uint32 _executionCounter\\n );\\n}\\n\",\"keccak256\":\"0x1a656aacd0b0f11dec2b92d70153dc3a1b7019e9f76dd43f7c91a21fb8cfef3d\",\"license\":\"MIT\"},\"contracts/azorius/interfaces/IBaseStrategy.sol\":{\"content\":\"// SPDX-License-Identifier: LGPL-3.0-only\\npragma solidity =0.8.19;\\n\\n/**\\n * The specification for a voting strategy in Azorius.\\n *\\n * Each IBaseStrategy implementation need only implement the given functions here,\\n * which allows for highly composable but simple or complex voting strategies.\\n *\\n * It should be noted that while many voting strategies make use of parameters such as\\n * voting period or quorum, that is a detail of the individual strategy itself, and not\\n * a requirement for the Azorius protocol.\\n */\\ninterface IBaseStrategy {\\n\\n /**\\n * Sets the address of the [Azorius](../Azorius.md) contract this \\n * [BaseStrategy](../BaseStrategy.md) is being used on.\\n *\\n * @param _azoriusModule address of the Azorius Safe module\\n */\\n function setAzorius(address _azoriusModule) external;\\n\\n /**\\n * Called by the [Azorius](../Azorius.md) module. This notifies this \\n * [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created.\\n *\\n * @param _data arbitrary data to pass to this BaseStrategy\\n */\\n function initializeProposal(bytes memory _data) external;\\n\\n /**\\n * Returns whether a Proposal has been passed.\\n *\\n * @param _proposalId proposalId to check\\n * @return bool true if the proposal has passed, otherwise false\\n */\\n function isPassed(uint32 _proposalId) external view returns (bool);\\n\\n /**\\n * Returns whether the specified address can submit a Proposal with\\n * this [BaseStrategy](../BaseStrategy.md).\\n *\\n * This allows a BaseStrategy to place any limits it would like on\\n * who can create new Proposals, such as requiring a minimum token\\n * delegation.\\n *\\n * @param _address address to check\\n * @return bool true if the address can submit a Proposal, otherwise false\\n */\\n function isProposer(address _address) external view returns (bool);\\n\\n /**\\n * Returns the block number voting ends on a given Proposal.\\n *\\n * @param _proposalId proposalId to check\\n * @return uint32 block number when voting ends on the Proposal\\n */\\n function votingEndBlock(uint32 _proposalId) external view returns (uint32);\\n}\\n\",\"keccak256\":\"0x5ad8cdea65caa49f4116c67ebcbc12094676ac64d70c35643a4cc517c8b220fe\",\"license\":\"LGPL-3.0-only\"},\"contracts/azorius/interfaces/IERC721VotingStrategy.sol\":{\"content\":\"//SPDX-License-Identifier: MIT\\npragma solidity =0.8.19;\\n\\n/**\\n * Interface of functions required for ERC-721 freeze voting associated with an ERC-721\\n * voting strategy.\\n */\\ninterface IERC721VotingStrategy {\\n\\n /**\\n * Returns the current token weight for the given ERC-721 token address.\\n *\\n * @param _tokenAddress the ERC-721 token address\\n */\\n function getTokenWeight(address _tokenAddress) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xa51db3de9ceb151077007952031ac96263b8138c8ae74758f98a4d5bd71fa86c\",\"license\":\"MIT\"},\"contracts/interfaces/hats/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHats {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n}\\n\",\"keccak256\":\"0x8e35022f5c0fcf0059033abec78ec890f0cf3bbac09d6d24051cff9679239511\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/HatsErrors.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsErrors {\\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\\n error NotAdmin(address user, uint256 hatId);\\n\\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\\n error NotHatWearer();\\n\\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\\n error NotAdminOrWearer();\\n\\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\\n error AllHatsWorn(uint256 hatId);\\n\\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\\n error MaxLevelsReached();\\n\\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\\n error InvalidHatId();\\n\\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\\n error AlreadyWearingHat(address wearer, uint256 hatId);\\n\\n /// @notice Emitted when attempting to mint a non-existant hat\\n error HatDoesNotExist(uint256 hatId);\\n\\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\\n error HatNotActive();\\n\\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\\n error NotEligible();\\n\\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\\n error NotHatsToggle();\\n\\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\\n error NotHatsEligibility();\\n\\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\\n error BatchArrayLengthMismatch();\\n\\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\\n error Immutable();\\n\\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\\n error NewMaxSupplyTooLow();\\n\\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\\n error CircularLinkage();\\n\\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\\n error CrossTreeLinkage();\\n\\n /// @notice Emitted when attempting to link a tophat without a request\\n error LinkageNotRequested();\\n\\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\\n /// @dev This ensures that unlinking never results in a bricked tophat\\n error InvalidUnlink();\\n\\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\\n error ZeroAddress();\\n\\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\\n error StringTooLong();\\n}\\n\",\"keccak256\":\"0x81b0056b7bed86eabc07c0e4a9655c586ddb8e6c128320593669b76efd5a08de\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/HatsEvents.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface HatsEvents {\\n /// @notice Emitted when a new hat is created\\n /// @param id The id for the new hat\\n /// @param details A description of the Hat\\n /// @param maxSupply The total instances of the Hat that can be worn at once\\n /// @param eligibility The address that can report on the Hat wearer's status\\n /// @param toggle The address that can deactivate the Hat\\n /// @param mutable_ Whether the hat's properties are changeable after creation\\n /// @param imageURI The image uri for this hat and the fallback for its\\n event HatCreated(\\n uint256 id,\\n string details,\\n uint32 maxSupply,\\n address eligibility,\\n address toggle,\\n bool mutable_,\\n string imageURI\\n );\\n\\n /// @notice Emitted when a hat wearer's standing is updated\\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\\n /// @param hatId The id of the wearer's hat\\n /// @param wearer The wearer's address\\n /// @param wearerStanding Whether the wearer is in good standing for the hat\\n event WearerStandingChanged(\\n uint256 hatId,\\n address wearer,\\n bool wearerStanding\\n );\\n\\n /// @notice Emitted when a hat's status is updated\\n /// @param hatId The id of the hat\\n /// @param newStatus Whether the hat is active\\n event HatStatusChanged(uint256 hatId, bool newStatus);\\n\\n /// @notice Emitted when a hat's details are updated\\n /// @param hatId The id of the hat\\n /// @param newDetails The updated details\\n event HatDetailsChanged(uint256 hatId, string newDetails);\\n\\n /// @notice Emitted when a hat's eligibility module is updated\\n /// @param hatId The id of the hat\\n /// @param newEligibility The updated eligibiliy module\\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\\n\\n /// @notice Emitted when a hat's toggle module is updated\\n /// @param hatId The id of the hat\\n /// @param newToggle The updated toggle module\\n event HatToggleChanged(uint256 hatId, address newToggle);\\n\\n /// @notice Emitted when a hat's mutability is updated\\n /// @param hatId The id of the hat\\n event HatMutabilityChanged(uint256 hatId);\\n\\n /// @notice Emitted when a hat's maximum supply is updated\\n /// @param hatId The id of the hat\\n /// @param newMaxSupply The updated max supply\\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\\n\\n /// @notice Emitted when a hat's image URI is updated\\n /// @param hatId The id of the hat\\n /// @param newImageURI The updated image URI\\n event HatImageURIChanged(uint256 hatId, string newImageURI);\\n\\n /// @notice Emitted when a tophat linkage is requested by its admin\\n /// @param domain The domain of the tree tophat to link\\n /// @param newAdmin The tophat's would-be admin in the parent tree\\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\\n\\n /// @notice Emitted when a tophat is linked to a another tree\\n /// @param domain The domain of the newly-linked tophat\\n /// @param newAdmin The tophat's new admin in the parent tree\\n event TopHatLinked(uint32 domain, uint256 newAdmin);\\n}\\n\",\"keccak256\":\"0x53413397d15e1636c3cd7bd667656b79bc2886785403b824bcd4ed122667f2c6\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/IHats.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\nimport \\\"./IHatsIdUtilities.sol\\\";\\nimport \\\"./HatsErrors.sol\\\";\\nimport \\\"./HatsEvents.sol\\\";\\n\\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\\n function mintTopHat(\\n address _target,\\n string memory _details,\\n string memory _imageURI\\n ) external returns (uint256 topHatId);\\n\\n function createHat(\\n uint256 _admin,\\n string calldata _details,\\n uint32 _maxSupply,\\n address _eligibility,\\n address _toggle,\\n bool _mutable,\\n string calldata _imageURI\\n ) external returns (uint256 newHatId);\\n\\n function batchCreateHats(\\n uint256[] calldata _admins,\\n string[] calldata _details,\\n uint32[] calldata _maxSupplies,\\n address[] memory _eligibilityModules,\\n address[] memory _toggleModules,\\n bool[] calldata _mutables,\\n string[] calldata _imageURIs\\n ) external returns (bool success);\\n\\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\\n\\n function mintHat(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool success);\\n\\n function batchMintHats(\\n uint256[] calldata _hatIds,\\n address[] calldata _wearers\\n ) external returns (bool success);\\n\\n function setHatStatus(\\n uint256 _hatId,\\n bool _newStatus\\n ) external returns (bool toggled);\\n\\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\\n\\n function setHatWearerStatus(\\n uint256 _hatId,\\n address _wearer,\\n bool _eligible,\\n bool _standing\\n ) external returns (bool updated);\\n\\n function checkHatWearerStatus(\\n uint256 _hatId,\\n address _wearer\\n ) external returns (bool updated);\\n\\n function renounceHat(uint256 _hatId) external;\\n\\n function transferHat(uint256 _hatId, address _from, address _to) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n HATS ADMIN FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function makeHatImmutable(uint256 _hatId) external;\\n\\n function changeHatDetails(\\n uint256 _hatId,\\n string memory _newDetails\\n ) external;\\n\\n function changeHatEligibility(\\n uint256 _hatId,\\n address _newEligibility\\n ) external;\\n\\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\\n\\n function changeHatImageURI(\\n uint256 _hatId,\\n string memory _newImageURI\\n ) external;\\n\\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\\n\\n function requestLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat\\n ) external;\\n\\n function approveLinkTopHatToTree(\\n uint32 _topHatId,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\\n\\n function relinkTopHatWithinTree(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat,\\n address _eligibility,\\n address _toggle,\\n string calldata _details,\\n string calldata _imageURI\\n ) external;\\n\\n /*//////////////////////////////////////////////////////////////\\n VIEW FUNCTIONS\\n //////////////////////////////////////////////////////////////*/\\n\\n function viewHat(\\n uint256 _hatId\\n )\\n external\\n view\\n returns (\\n string memory details,\\n uint32 maxSupply,\\n uint32 supply,\\n address eligibility,\\n address toggle,\\n string memory imageURI,\\n uint16 lastHatId,\\n bool mutable_,\\n bool active\\n );\\n\\n function isWearerOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isWearer);\\n\\n function isAdminOfHat(\\n address _user,\\n uint256 _hatId\\n ) external view returns (bool isAdmin);\\n\\n function isInGoodStanding(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool standing);\\n\\n function isEligible(\\n address _wearer,\\n uint256 _hatId\\n ) external view returns (bool eligible);\\n\\n function getHatEligibilityModule(\\n uint256 _hatId\\n ) external view returns (address eligibility);\\n\\n function getHatToggleModule(\\n uint256 _hatId\\n ) external view returns (address toggle);\\n\\n function getHatMaxSupply(\\n uint256 _hatId\\n ) external view returns (uint32 maxSupply);\\n\\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\\n\\n function getImageURIForHat(\\n uint256 _hatId\\n ) external view returns (string memory _uri);\\n\\n function balanceOf(\\n address wearer,\\n uint256 hatId\\n ) external view returns (uint256 balance);\\n\\n function balanceOfBatch(\\n address[] calldata _wearers,\\n uint256[] calldata _hatIds\\n ) external view returns (uint256[] memory);\\n\\n function uri(uint256 id) external view returns (string memory _uri);\\n}\\n\",\"keccak256\":\"0x2867004bddc5148fa1937f25c0403e5d9977583aaf50fdbdb74bd463f64f21c8\",\"license\":\"AGPL-3.0\"},\"contracts/interfaces/hats/full/IHatsIdUtilities.sol\":{\"content\":\"// SPDX-License-Identifier: AGPL-3.0\\n// Copyright (C) 2023 Haberdasher Labs\\n//\\n// This program is free software: you can redistribute it and/or modify\\n// it under the terms of the GNU Affero General Public License as published by\\n// the Free Software Foundation, either version 3 of the License, or\\n// (at your option) any later version.\\n//\\n// This program is distributed in the hope that it will be useful,\\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n// GNU Affero General Public License for more details.\\n//\\n// You should have received a copy of the GNU Affero General Public License\\n// along with this program. If not, see .\\n\\npragma solidity >=0.8.13;\\n\\ninterface IHatsIdUtilities {\\n function buildHatId(\\n uint256 _admin,\\n uint16 _newHat\\n ) external pure returns (uint256 id);\\n\\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\\n\\n function getLocalHatLevel(\\n uint256 _hatId\\n ) external pure returns (uint32 level);\\n\\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\\n\\n function isLocalTopHat(\\n uint256 _hatId\\n ) external pure returns (bool _localTopHat);\\n\\n function isValidHatId(\\n uint256 _hatId\\n ) external view returns (bool validHatId);\\n\\n function getAdminAtLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external view returns (uint256 admin);\\n\\n function getAdminAtLocalLevel(\\n uint256 _hatId,\\n uint32 _level\\n ) external pure returns (uint256 admin);\\n\\n function getTopHatDomain(\\n uint256 _hatId\\n ) external view returns (uint32 domain);\\n\\n function getTippyTopHatDomain(\\n uint32 _topHatDomain\\n ) external view returns (uint32 domain);\\n\\n function noCircularLinkage(\\n uint32 _topHatDomain,\\n uint256 _linkedAdmin\\n ) external view returns (bool notCircular);\\n\\n function sameTippyTopHatDomain(\\n uint32 _topHatDomain,\\n uint256 _newAdminHat\\n ) external view returns (bool sameDomain);\\n}\\n\",\"keccak256\":\"0x007fcc07b20bf84bacad1f9a2ddf4e30e1a8be961e144b7bef8e98a51781aee9\",\"license\":\"AGPL-3.0\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61223980620000ee6000396000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c80637b7a91dd11610125578063b1d1196f116100ad578063d877ee1d1161007c578063d877ee1d14610566578063deb61c151461056f578063e5df8b84146105e8578063e8575a7f146105fb578063f2fde38b1461060e57600080fd5b8063b1d1196f146104ea578063bf7e2c7f146104fd578063c0dce37f14610506578063c909c3b11461051957600080fd5b806397e39fef116100f457806397e39fef1461047e578063a09c4f6814610491578063a4f9edbf146104a4578063a77a81d0146104b7578063ab2f3ad4146104ca57600080fd5b80637b7a91dd146104475780638081be91146104505780638da5cb5b1461045a578063918f84bf1461046b57600080fd5b806350631bfe116101a857806366b629551161017757806366b62955146103e45780636d4ae6801461040f578063709e23f814610424578063715018a61461042c57806374ec29a01461043457600080fd5b806350631bfe1461030957806353a8b3201461032c578063544ffc9c1461033f57806355a9dbd9146103b457600080fd5b8063250aa683116101ef578063250aa6831461029457806333f48a5e146102bd57806337938ab3146102d05780633a622c52146102e35780634e2addad146102f657600080fd5b806302a251a3146102215780631dc489471461024b5780631e2972e814610260578063210a5e8714610281575b600080fd5b606c546102319063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b61025e6102593660046118d7565b610621565b005b61027361026e3660046118d7565b610635565b604051908152602001610242565b61025e61028f3660046118d7565b610656565b6102736102a2366004611905565b6001600160a01b03166000908152606b602052604090205490565b61025e6102cb36600461193b565b610667565b61025e6102de366004611905565b610678565b61025e6102f13660046118d7565b6106ca565b61025e610304366004611a2e565b6107e7565b61031c6103173660046118d7565b61081c565b6040519015158152602001610242565b61031c61033a36600461193b565b610872565b61038461034d3660046118d7565b606960205260009081526040902080546001820154600283015460039093015463ffffffff80841694600160201b90940416929085565b6040805163ffffffff9687168152959094166020860152928401919091526060830152608082015260a001610242565b6102316103c236600461193b565b63ffffffff908116600090815260696020526040902054600160201b90041690565b6067546103f7906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b610417610904565b6040516102429190611b61565b606654610273565b61025e610966565b61031c610442366004611905565b61097a565b610273606d5481565b610273620f424081565b6033546001600160a01b03166103f7565b61031c610479366004611b74565b610985565b6065546103f7906001600160a01b031681565b61025e61049f3660046118d7565b6109b7565b61025e6104b2366004611b96565b6109c8565b61025e6104c5366004611b96565b610a69565b6102736104d8366004611905565b606b6020526000908152604090205481565b61025e6104f8366004611c2b565b610b48565b61027360685481565b61025e610514366004611905565b610b5e565b61031c610527366004611c57565b63ffffffff831660009081526069602090815260408083206001600160a01b0386168452600401825280832084845290915290205460ff169392505050565b610273606e5481565b6105b761057d36600461193b565b63ffffffff908116600090815260696020526040902060018101546002820154600383015492549194909382811692600160201b90041690565b6040805195865260208601949094529284019190915263ffffffff908116606084015216608082015260a001610242565b6103f76105f63660046118d7565b610ce8565b61025e6106093660046118d7565b610d12565b61025e61061c366004611905565b610d23565b610629610d9e565b61063281610df8565b50565b6066818154811061064557600080fd5b600091825260209091200154905081565b61065e610d9e565b61063281610e34565b61066f610d9e565b61063281610e69565b610680610d9e565b606780546001600160a01b0319166001600160a01b0383169081179091556040517fac8d831a6ed53a98387842e08d9e0893c1d478f4a3710b254e22bd58c06b269090600090a250565b6106d2610d9e565b6000805b6066548110156107905782606682815481106106f4576106f4611c98565b90600052602060002001540361077e576066805461071490600190611cc4565b8154811061072457610724611c98565b90600052602060002001546066828154811061074257610742611c98565b600091825260209091200155606680548061075f5761075f611cd7565b6001900381819060005260206000200160009055905560019150610790565b8061078881611ced565b9150506106d6565b50806107af57604051634b8d041f60e01b815260040160405180910390fd5b6040518281527f50544666722f5a4554f2716b5efb2ce814101451643c8856221fef06b5e9803b906020015b60405180910390a15050565b805182511461080957604051635435b28960e11b815260040160405180910390fd5b6108168433858585610eb1565b50505050565b6000805b60665481101561086957826066828154811061083e5761083e611c98565b9060005260206000200154036108575750600192915050565b8061086181611ced565b915050610820565b50600092915050565b63ffffffff8082166000908152606960205260408120549091600160201b90910416431180156108cd575063ffffffff8216600090815260696020526040902060038101546002909101546108c79190611d06565b606d5411155b80156108fe575063ffffffff8216600090815260696020526040902060028101546001909101546108fe9190610985565b92915050565b6060606a80548060200260200160405190810160405280929190818152602001828054801561095c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161093e575b5050505050905090565b61096e610d9e565b61097860006111c8565b565b60006108fe8261121a565b6000620f4240606854838561099a9190611d06565b6109a49190611d19565b6109ae9190611d30565b90921192915050565b6109bf610d9e565b610632816112ec565b6000806000806000806000806000898060200190518101906109ea9190611e2c565b985098509850985098509850985098509850610a3389898989898960008a604051602001610a1f989796959493929190611f3b565b6040516020818303038152906040526113ae565b610a5d8282604051602001610a49929190611fa9565b6040516020818303038152906040526115d9565b50505050505050505050565b6067546001600160a01b03163314610a94576040516358c30ce160e01b815260040160405180910390fd5b600081806020019051810190610aaa9190611fd5565b606c54909150600090610ac39063ffffffff1643611ff2565b63ffffffff838116600081815260696020908152604091829020805467ffffffffffffffff1916600160201b87871690810263ffffffff1916919091174390961695909517905581519283528201929092529192507f80d0ad93bba25e53bf67fa9f2d13df59f04795ec2f91b9b3c1f607666daf9d64910160405180910390a1505050565b610b50610d9e565b610b5a8282611699565b5050565b610b66610d9e565b6001600160a01b0381166000908152606b60205260408120549003610b9e57604051634b62f01360e01b815260040160405180910390fd5b6001600160a01b0381166000908152606b60205260408120819055606a54905b81811015610cae57606a8181548110610bd957610bd9611c98565b6000918252602090912001546001600160a01b0390811690841603610ca6576000610c05600184611cc4565b9050606a8181548110610c1a57610c1a611c98565b600091825260209091200154606a80546001600160a01b039092169184908110610c4657610c46611c98565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606a8181548110610c8757610c87611c98565b600091825260209091200180546001600160a01b031916905550610cae565b600101610bbe565b506040516001600160a01b03831681527f14236c39816f331325d02993fa15113b739aff01c21ab8f38cc5253205299fb1906020016107db565b606a8181548110610cf857600080fd5b6000918252602090912001546001600160a01b0316905081565b610d1a610d9e565b6106328161180d565b610d2b610d9e565b6001600160a01b038116610d955760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610632816111c8565b6033546001600160a01b031633146109785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d8c565b606e8190556040518181527f48f79e03d92b3595f74bc3c64746cf148e464673dd036633d34f8afb029482c9906020015b60405180910390a150565b606d8190556040518181527fbc589fccf641d342b7853c2c6faca39631d4d19efbe77e71e5611e31678c220e90602001610e29565b606c805463ffffffff191663ffffffff83169081179091556040519081527f70770ce479f70673c3ed8fff63cfb758a6ffdddc30cab7c63d54c8d825e3948890602001610e29565b6000805b835181101561106d576000848281518110610ed257610ed2611c98565b602002602001015190506000848381518110610ef057610ef0611c98565b60200260200101519050816001600160a01b0316636352211e826040518263ffffffff1660e01b8152600401610f2891815260200190565b602060405180830381865afa158015610f45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f699190612016565b6001600160a01b0316886001600160a01b031614610f9d57604051639b936ae960e01b815260048101829052602401610d8c565b63ffffffff891660009081526069602090815260408083206001600160a01b0386168452600401825280832084845290915290205460ff161515600103610ffa57604051639602f71160e01b815260048101829052602401610d8c565b6001600160a01b0382166000908152606b602052604090205461101d9085611d06565b63ffffffff8a1660009081526069602090815260408083206001600160a01b0390961683526004909501815284822093825292909252919020805460ff1916600190811790915590925001610eb5565b508060000361108f5760405163923d21f560e01b815260040160405180910390fd5b63ffffffff808716600090815260696020526040812080549092600160201b9091041690036110d157604051631dc0650160e31b815260040160405180910390fd5b8054600160201b900463ffffffff1643111561110057604051637a19ed0560e01b815260040160405180910390fd5b60ff8516611127578181600101600082825461111c9190611d06565b909155506111809050565b60001960ff861601611147578181600201600082825461111c9190611d06565b60011960ff861601611167578181600301600082825461111c9190611d06565b604051636aee863360e11b815260040160405180910390fd5b7f08b8dec2438455807ba4dae88b27939d599858b97389310c0af8f42acd58d62086888787876040516111b7959493929190612033565b60405180910390a150505050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b60665481101561086957606554606680546001600160a01b0390921691634352409a9186918590811061125357611253611c98565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cc919061208a565b156112da5750600192915050565b806112e481611ced565b91505061121e565b60005b60665481101561134857816066828154811061130d5761130d611c98565b9060005260206000200154036113365760405163634a456360e01b815260040160405180910390fd5b8061134081611ced565b9150506112ef565b50606680546001810182556000919091527f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354018190556040518181527f30590a8684cec4e5a2b48765f391c996b9a004652478a8f41dc46658ccb699ed90602001610e29565b600054610100900460ff16158080156113ce5750600054600160ff909116105b806113e85750303b1580156113e8575060005460ff166001145b61144b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d8c565b6000805460ff19166001179055801561146e576000805461ff0019166101001790555b6000806000806000806000808980602001905181019061148e91906120ac565b9750975097509750975097509750975085518751146114c057604051635435b28960e11b815260040160405180910390fd5b60005b8751811015611510576115088882815181106114e1576114e1611c98565b60200260200101518883815181106114fb576114fb611c98565b6020026020010151611699565b6001016114c3565b5061151961187d565b61152288610d23565b61152b85610680565b61153483610e34565b61153d82610df8565b6115468161180d565b61154f84610e69565b876001600160a01b0316856001600160a01b03167fca32f512f02914f6bc16a49e786443029061b9adc5a987fd2f6efa56c0116a1660405160405180910390a350505050505050508015610b5a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016107db565b600080828060200190518101906115f09190612167565b90925090506001600160a01b03821661161c576040516350e80d4360e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b038416179055805160000361165957604051632a2b50e760e01b815260040160405180910390fd5b60005b81518110156108165761168782828151811061167a5761167a611c98565b60200260200101516112ec565b8061169181611ced565b91505061165c565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156116e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611708919061208a565b61172557604051630f58058360e11b815260040160405180910390fd5b806000036117465760405163923d21f560e01b815260040160405180910390fd5b6001600160a01b0382166000908152606b60205260409020541561177d576040516371168e4f60e11b815260040160405180910390fd5b606a8054600181019091557f116fea137db6e131133e7f2bab296045d8f41cc5607279db17b218cab0929a510180546001600160a01b0319166001600160a01b0384169081179091556000818152606b6020908152604091829020849055815192835282018390527fbf2b7f9fc6e849fdef9ff7366d8b63b608bc69ca778200c53d77372d953dc6b691016107db565b620f424081118061182a57506118276002620f4240611d30565b81105b15611848576040516302396b6b60e61b815260040160405180910390fd5b60688190556040518181527f406c076eac4d3dde1c5d55793e80239daa8c60ee971390ce3d9f90ca4206295390602001610e29565b600054610100900460ff166118a45760405162461bcd60e51b8152600401610d8c906121b8565b610978600054610100900460ff166118ce5760405162461bcd60e51b8152600401610d8c906121b8565b610978336111c8565b6000602082840312156118e957600080fd5b5035919050565b6001600160a01b038116811461063257600080fd5b60006020828403121561191757600080fd5b8135611922816118f0565b9392505050565b63ffffffff8116811461063257600080fd5b60006020828403121561194d57600080fd5b813561192281611929565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561199757611997611958565b604052919050565b600067ffffffffffffffff8211156119b9576119b9611958565b5060051b60200190565b600082601f8301126119d457600080fd5b813560206119e96119e48361199f565b61196e565b82815260059290921b84018101918181019086841115611a0857600080fd5b8286015b84811015611a235780358352918301918301611a0c565b509695505050505050565b60008060008060808587031215611a4457600080fd5b8435611a4f81611929565b935060208581013560ff81168114611a6657600080fd5b9350604086013567ffffffffffffffff80821115611a8357600080fd5b818801915088601f830112611a9757600080fd5b8135611aa56119e48261199f565b81815260059190911b8301840190848101908b831115611ac457600080fd5b938501935b82851015611aeb578435611adc816118f0565b82529385019390850190611ac9565b965050506060880135925080831115611b0357600080fd5b5050611b11878288016119c3565b91505092959194509250565b600081518084526020808501945080840160005b83811015611b565781516001600160a01b031687529582019590820190600101611b31565b509495945050505050565b6020815260006119226020830184611b1d565b60008060408385031215611b8757600080fd5b50508035926020909101359150565b60006020808385031215611ba957600080fd5b823567ffffffffffffffff80821115611bc157600080fd5b818501915085601f830112611bd557600080fd5b813581811115611be757611be7611958565b611bf9601f8201601f1916850161196e565b91508082528684828501011115611c0f57600080fd5b8084840185840137600090820190930192909252509392505050565b60008060408385031215611c3e57600080fd5b8235611c49816118f0565b946020939093013593505050565b600080600060608486031215611c6c57600080fd5b8335611c7781611929565b92506020840135611c87816118f0565b929592945050506040919091013590565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156108fe576108fe611cae565b634e487b7160e01b600052603160045260246000fd5b600060018201611cff57611cff611cae565b5060010190565b808201808211156108fe576108fe611cae565b80820281158282048414176108fe576108fe611cae565b600082611d4d57634e487b7160e01b600052601260045260246000fd5b500490565b8051611d5d816118f0565b919050565b600082601f830112611d7357600080fd5b81516020611d836119e48361199f565b82815260059290921b84018101918181019086841115611da257600080fd5b8286015b84811015611a23578051611db9816118f0565b8352918301918301611da6565b600082601f830112611dd757600080fd5b81516020611de76119e48361199f565b82815260059290921b84018101918181019086841115611e0657600080fd5b8286015b84811015611a235780518352918301918301611e0a565b8051611d5d81611929565b60008060008060008060008060006101208a8c031215611e4b57600080fd5b611e548a611d52565b985060208a015167ffffffffffffffff80821115611e7157600080fd5b611e7d8d838e01611d62565b995060408c0151915080821115611e9357600080fd5b611e9f8d838e01611dc6565b9850611ead60608d01611d52565b9750611ebb60808d01611e21565b965060a08c0151955060c08c01519450611ed760e08d01611d52565b93506101008c0151915080821115611eee57600080fd5b50611efb8c828d01611dc6565b9150509295985092959850929598565b600081518084526020808501945080840160005b83811015611b5657815187529582019590820190600101611f1f565b6001600160a01b03898116825261010060208301819052600091611f618483018c611b1d565b91508382036040850152611f75828b611f0b565b98166060840152505063ffffffff94909416608085015260a084019290925260ff1660c083015260e0909101529392505050565b6001600160a01b0383168152604060208201819052600090611fcd90830184611f0b565b949350505050565b600060208284031215611fe757600080fd5b815161192281611929565b63ffffffff81811683821601908082111561200f5761200f611cae565b5092915050565b60006020828403121561202857600080fd5b8151611922816118f0565b6001600160a01b038616815263ffffffff8516602082015260ff8416604082015260a06060820181905260009061206c90830185611b1d565b828103608084015261207e8185611f0b565b98975050505050505050565b60006020828403121561209c57600080fd5b8151801515811461192257600080fd5b600080600080600080600080610100898b0312156120c957600080fd5b88516120d4816118f0565b60208a015190985067ffffffffffffffff808211156120f257600080fd5b6120fe8c838d01611d62565b985060408b015191508082111561211457600080fd5b506121218b828c01611dc6565b9650506060890151612132816118f0565b60808a015190955061214381611929565b60a08a015160c08b015160e0909b0151999c989b5096999598909790945092505050565b6000806040838503121561217a57600080fd5b8251612185816118f0565b602084015190925067ffffffffffffffff8111156121a257600080fd5b6121ae85828601611dc6565b9150509250929050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220bb754b0bc3ef0d5463f585b4dc19fd29e3f578723e930e7b4c5479339b4b953d64736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061021c5760003560e01c80637b7a91dd11610125578063b1d1196f116100ad578063d877ee1d1161007c578063d877ee1d14610566578063deb61c151461056f578063e5df8b84146105e8578063e8575a7f146105fb578063f2fde38b1461060e57600080fd5b8063b1d1196f146104ea578063bf7e2c7f146104fd578063c0dce37f14610506578063c909c3b11461051957600080fd5b806397e39fef116100f457806397e39fef1461047e578063a09c4f6814610491578063a4f9edbf146104a4578063a77a81d0146104b7578063ab2f3ad4146104ca57600080fd5b80637b7a91dd146104475780638081be91146104505780638da5cb5b1461045a578063918f84bf1461046b57600080fd5b806350631bfe116101a857806366b629551161017757806366b62955146103e45780636d4ae6801461040f578063709e23f814610424578063715018a61461042c57806374ec29a01461043457600080fd5b806350631bfe1461030957806353a8b3201461032c578063544ffc9c1461033f57806355a9dbd9146103b457600080fd5b8063250aa683116101ef578063250aa6831461029457806333f48a5e146102bd57806337938ab3146102d05780633a622c52146102e35780634e2addad146102f657600080fd5b806302a251a3146102215780631dc489471461024b5780631e2972e814610260578063210a5e8714610281575b600080fd5b606c546102319063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b61025e6102593660046118d7565b610621565b005b61027361026e3660046118d7565b610635565b604051908152602001610242565b61025e61028f3660046118d7565b610656565b6102736102a2366004611905565b6001600160a01b03166000908152606b602052604090205490565b61025e6102cb36600461193b565b610667565b61025e6102de366004611905565b610678565b61025e6102f13660046118d7565b6106ca565b61025e610304366004611a2e565b6107e7565b61031c6103173660046118d7565b61081c565b6040519015158152602001610242565b61031c61033a36600461193b565b610872565b61038461034d3660046118d7565b606960205260009081526040902080546001820154600283015460039093015463ffffffff80841694600160201b90940416929085565b6040805163ffffffff9687168152959094166020860152928401919091526060830152608082015260a001610242565b6102316103c236600461193b565b63ffffffff908116600090815260696020526040902054600160201b90041690565b6067546103f7906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b610417610904565b6040516102429190611b61565b606654610273565b61025e610966565b61031c610442366004611905565b61097a565b610273606d5481565b610273620f424081565b6033546001600160a01b03166103f7565b61031c610479366004611b74565b610985565b6065546103f7906001600160a01b031681565b61025e61049f3660046118d7565b6109b7565b61025e6104b2366004611b96565b6109c8565b61025e6104c5366004611b96565b610a69565b6102736104d8366004611905565b606b6020526000908152604090205481565b61025e6104f8366004611c2b565b610b48565b61027360685481565b61025e610514366004611905565b610b5e565b61031c610527366004611c57565b63ffffffff831660009081526069602090815260408083206001600160a01b0386168452600401825280832084845290915290205460ff169392505050565b610273606e5481565b6105b761057d36600461193b565b63ffffffff908116600090815260696020526040902060018101546002820154600383015492549194909382811692600160201b90041690565b6040805195865260208601949094529284019190915263ffffffff908116606084015216608082015260a001610242565b6103f76105f63660046118d7565b610ce8565b61025e6106093660046118d7565b610d12565b61025e61061c366004611905565b610d23565b610629610d9e565b61063281610df8565b50565b6066818154811061064557600080fd5b600091825260209091200154905081565b61065e610d9e565b61063281610e34565b61066f610d9e565b61063281610e69565b610680610d9e565b606780546001600160a01b0319166001600160a01b0383169081179091556040517fac8d831a6ed53a98387842e08d9e0893c1d478f4a3710b254e22bd58c06b269090600090a250565b6106d2610d9e565b6000805b6066548110156107905782606682815481106106f4576106f4611c98565b90600052602060002001540361077e576066805461071490600190611cc4565b8154811061072457610724611c98565b90600052602060002001546066828154811061074257610742611c98565b600091825260209091200155606680548061075f5761075f611cd7565b6001900381819060005260206000200160009055905560019150610790565b8061078881611ced565b9150506106d6565b50806107af57604051634b8d041f60e01b815260040160405180910390fd5b6040518281527f50544666722f5a4554f2716b5efb2ce814101451643c8856221fef06b5e9803b906020015b60405180910390a15050565b805182511461080957604051635435b28960e11b815260040160405180910390fd5b6108168433858585610eb1565b50505050565b6000805b60665481101561086957826066828154811061083e5761083e611c98565b9060005260206000200154036108575750600192915050565b8061086181611ced565b915050610820565b50600092915050565b63ffffffff8082166000908152606960205260408120549091600160201b90910416431180156108cd575063ffffffff8216600090815260696020526040902060038101546002909101546108c79190611d06565b606d5411155b80156108fe575063ffffffff8216600090815260696020526040902060028101546001909101546108fe9190610985565b92915050565b6060606a80548060200260200160405190810160405280929190818152602001828054801561095c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161093e575b5050505050905090565b61096e610d9e565b61097860006111c8565b565b60006108fe8261121a565b6000620f4240606854838561099a9190611d06565b6109a49190611d19565b6109ae9190611d30565b90921192915050565b6109bf610d9e565b610632816112ec565b6000806000806000806000806000898060200190518101906109ea9190611e2c565b985098509850985098509850985098509850610a3389898989898960008a604051602001610a1f989796959493929190611f3b565b6040516020818303038152906040526113ae565b610a5d8282604051602001610a49929190611fa9565b6040516020818303038152906040526115d9565b50505050505050505050565b6067546001600160a01b03163314610a94576040516358c30ce160e01b815260040160405180910390fd5b600081806020019051810190610aaa9190611fd5565b606c54909150600090610ac39063ffffffff1643611ff2565b63ffffffff838116600081815260696020908152604091829020805467ffffffffffffffff1916600160201b87871690810263ffffffff1916919091174390961695909517905581519283528201929092529192507f80d0ad93bba25e53bf67fa9f2d13df59f04795ec2f91b9b3c1f607666daf9d64910160405180910390a1505050565b610b50610d9e565b610b5a8282611699565b5050565b610b66610d9e565b6001600160a01b0381166000908152606b60205260408120549003610b9e57604051634b62f01360e01b815260040160405180910390fd5b6001600160a01b0381166000908152606b60205260408120819055606a54905b81811015610cae57606a8181548110610bd957610bd9611c98565b6000918252602090912001546001600160a01b0390811690841603610ca6576000610c05600184611cc4565b9050606a8181548110610c1a57610c1a611c98565b600091825260209091200154606a80546001600160a01b039092169184908110610c4657610c46611c98565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606a8181548110610c8757610c87611c98565b600091825260209091200180546001600160a01b031916905550610cae565b600101610bbe565b506040516001600160a01b03831681527f14236c39816f331325d02993fa15113b739aff01c21ab8f38cc5253205299fb1906020016107db565b606a8181548110610cf857600080fd5b6000918252602090912001546001600160a01b0316905081565b610d1a610d9e565b6106328161180d565b610d2b610d9e565b6001600160a01b038116610d955760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610632816111c8565b6033546001600160a01b031633146109785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d8c565b606e8190556040518181527f48f79e03d92b3595f74bc3c64746cf148e464673dd036633d34f8afb029482c9906020015b60405180910390a150565b606d8190556040518181527fbc589fccf641d342b7853c2c6faca39631d4d19efbe77e71e5611e31678c220e90602001610e29565b606c805463ffffffff191663ffffffff83169081179091556040519081527f70770ce479f70673c3ed8fff63cfb758a6ffdddc30cab7c63d54c8d825e3948890602001610e29565b6000805b835181101561106d576000848281518110610ed257610ed2611c98565b602002602001015190506000848381518110610ef057610ef0611c98565b60200260200101519050816001600160a01b0316636352211e826040518263ffffffff1660e01b8152600401610f2891815260200190565b602060405180830381865afa158015610f45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f699190612016565b6001600160a01b0316886001600160a01b031614610f9d57604051639b936ae960e01b815260048101829052602401610d8c565b63ffffffff891660009081526069602090815260408083206001600160a01b0386168452600401825280832084845290915290205460ff161515600103610ffa57604051639602f71160e01b815260048101829052602401610d8c565b6001600160a01b0382166000908152606b602052604090205461101d9085611d06565b63ffffffff8a1660009081526069602090815260408083206001600160a01b0390961683526004909501815284822093825292909252919020805460ff1916600190811790915590925001610eb5565b508060000361108f5760405163923d21f560e01b815260040160405180910390fd5b63ffffffff808716600090815260696020526040812080549092600160201b9091041690036110d157604051631dc0650160e31b815260040160405180910390fd5b8054600160201b900463ffffffff1643111561110057604051637a19ed0560e01b815260040160405180910390fd5b60ff8516611127578181600101600082825461111c9190611d06565b909155506111809050565b60001960ff861601611147578181600201600082825461111c9190611d06565b60011960ff861601611167578181600301600082825461111c9190611d06565b604051636aee863360e11b815260040160405180910390fd5b7f08b8dec2438455807ba4dae88b27939d599858b97389310c0af8f42acd58d62086888787876040516111b7959493929190612033565b60405180910390a150505050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000805b60665481101561086957606554606680546001600160a01b0390921691634352409a9186918590811061125357611253611c98565b6000918252602090912001546040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156112a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112cc919061208a565b156112da5750600192915050565b806112e481611ced565b91505061121e565b60005b60665481101561134857816066828154811061130d5761130d611c98565b9060005260206000200154036113365760405163634a456360e01b815260040160405180910390fd5b8061134081611ced565b9150506112ef565b50606680546001810182556000919091527f46501879b8ca8525e8c2fd519e2fbfcfa2ebea26501294aa02cbfcfb12e94354018190556040518181527f30590a8684cec4e5a2b48765f391c996b9a004652478a8f41dc46658ccb699ed90602001610e29565b600054610100900460ff16158080156113ce5750600054600160ff909116105b806113e85750303b1580156113e8575060005460ff166001145b61144b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d8c565b6000805460ff19166001179055801561146e576000805461ff0019166101001790555b6000806000806000806000808980602001905181019061148e91906120ac565b9750975097509750975097509750975085518751146114c057604051635435b28960e11b815260040160405180910390fd5b60005b8751811015611510576115088882815181106114e1576114e1611c98565b60200260200101518883815181106114fb576114fb611c98565b6020026020010151611699565b6001016114c3565b5061151961187d565b61152288610d23565b61152b85610680565b61153483610e34565b61153d82610df8565b6115468161180d565b61154f84610e69565b876001600160a01b0316856001600160a01b03167fca32f512f02914f6bc16a49e786443029061b9adc5a987fd2f6efa56c0116a1660405160405180910390a350505050505050508015610b5a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020016107db565b600080828060200190518101906115f09190612167565b90925090506001600160a01b03821661161c576040516350e80d4360e11b815260040160405180910390fd5b606580546001600160a01b0319166001600160a01b038416179055805160000361165957604051632a2b50e760e01b815260040160405180910390fd5b60005b81518110156108165761168782828151811061167a5761167a611c98565b60200260200101516112ec565b8061169181611ced565b91505061165c565b6040516301ffc9a760e01b81526380ac58cd60e01b60048201526001600160a01b038316906301ffc9a790602401602060405180830381865afa1580156116e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611708919061208a565b61172557604051630f58058360e11b815260040160405180910390fd5b806000036117465760405163923d21f560e01b815260040160405180910390fd5b6001600160a01b0382166000908152606b60205260409020541561177d576040516371168e4f60e11b815260040160405180910390fd5b606a8054600181019091557f116fea137db6e131133e7f2bab296045d8f41cc5607279db17b218cab0929a510180546001600160a01b0319166001600160a01b0384169081179091556000818152606b6020908152604091829020849055815192835282018390527fbf2b7f9fc6e849fdef9ff7366d8b63b608bc69ca778200c53d77372d953dc6b691016107db565b620f424081118061182a57506118276002620f4240611d30565b81105b15611848576040516302396b6b60e61b815260040160405180910390fd5b60688190556040518181527f406c076eac4d3dde1c5d55793e80239daa8c60ee971390ce3d9f90ca4206295390602001610e29565b600054610100900460ff166118a45760405162461bcd60e51b8152600401610d8c906121b8565b610978600054610100900460ff166118ce5760405162461bcd60e51b8152600401610d8c906121b8565b610978336111c8565b6000602082840312156118e957600080fd5b5035919050565b6001600160a01b038116811461063257600080fd5b60006020828403121561191757600080fd5b8135611922816118f0565b9392505050565b63ffffffff8116811461063257600080fd5b60006020828403121561194d57600080fd5b813561192281611929565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561199757611997611958565b604052919050565b600067ffffffffffffffff8211156119b9576119b9611958565b5060051b60200190565b600082601f8301126119d457600080fd5b813560206119e96119e48361199f565b61196e565b82815260059290921b84018101918181019086841115611a0857600080fd5b8286015b84811015611a235780358352918301918301611a0c565b509695505050505050565b60008060008060808587031215611a4457600080fd5b8435611a4f81611929565b935060208581013560ff81168114611a6657600080fd5b9350604086013567ffffffffffffffff80821115611a8357600080fd5b818801915088601f830112611a9757600080fd5b8135611aa56119e48261199f565b81815260059190911b8301840190848101908b831115611ac457600080fd5b938501935b82851015611aeb578435611adc816118f0565b82529385019390850190611ac9565b965050506060880135925080831115611b0357600080fd5b5050611b11878288016119c3565b91505092959194509250565b600081518084526020808501945080840160005b83811015611b565781516001600160a01b031687529582019590820190600101611b31565b509495945050505050565b6020815260006119226020830184611b1d565b60008060408385031215611b8757600080fd5b50508035926020909101359150565b60006020808385031215611ba957600080fd5b823567ffffffffffffffff80821115611bc157600080fd5b818501915085601f830112611bd557600080fd5b813581811115611be757611be7611958565b611bf9601f8201601f1916850161196e565b91508082528684828501011115611c0f57600080fd5b8084840185840137600090820190930192909252509392505050565b60008060408385031215611c3e57600080fd5b8235611c49816118f0565b946020939093013593505050565b600080600060608486031215611c6c57600080fd5b8335611c7781611929565b92506020840135611c87816118f0565b929592945050506040919091013590565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156108fe576108fe611cae565b634e487b7160e01b600052603160045260246000fd5b600060018201611cff57611cff611cae565b5060010190565b808201808211156108fe576108fe611cae565b80820281158282048414176108fe576108fe611cae565b600082611d4d57634e487b7160e01b600052601260045260246000fd5b500490565b8051611d5d816118f0565b919050565b600082601f830112611d7357600080fd5b81516020611d836119e48361199f565b82815260059290921b84018101918181019086841115611da257600080fd5b8286015b84811015611a23578051611db9816118f0565b8352918301918301611da6565b600082601f830112611dd757600080fd5b81516020611de76119e48361199f565b82815260059290921b84018101918181019086841115611e0657600080fd5b8286015b84811015611a235780518352918301918301611e0a565b8051611d5d81611929565b60008060008060008060008060006101208a8c031215611e4b57600080fd5b611e548a611d52565b985060208a015167ffffffffffffffff80821115611e7157600080fd5b611e7d8d838e01611d62565b995060408c0151915080821115611e9357600080fd5b611e9f8d838e01611dc6565b9850611ead60608d01611d52565b9750611ebb60808d01611e21565b965060a08c0151955060c08c01519450611ed760e08d01611d52565b93506101008c0151915080821115611eee57600080fd5b50611efb8c828d01611dc6565b9150509295985092959850929598565b600081518084526020808501945080840160005b83811015611b5657815187529582019590820190600101611f1f565b6001600160a01b03898116825261010060208301819052600091611f618483018c611b1d565b91508382036040850152611f75828b611f0b565b98166060840152505063ffffffff94909416608085015260a084019290925260ff1660c083015260e0909101529392505050565b6001600160a01b0383168152604060208201819052600090611fcd90830184611f0b565b949350505050565b600060208284031215611fe757600080fd5b815161192281611929565b63ffffffff81811683821601908082111561200f5761200f611cae565b5092915050565b60006020828403121561202857600080fd5b8151611922816118f0565b6001600160a01b038616815263ffffffff8516602082015260ff8416604082015260a06060820181905260009061206c90830185611b1d565b828103608084015261207e8185611f0b565b98975050505050505050565b60006020828403121561209c57600080fd5b8151801515811461192257600080fd5b600080600080600080600080610100898b0312156120c957600080fd5b88516120d4816118f0565b60208a015190985067ffffffffffffffff808211156120f257600080fd5b6120fe8c838d01611d62565b985060408b015191508082111561211457600080fd5b506121218b828c01611dc6565b9650506060890151612132816118f0565b60808a015190955061214381611929565b60a08a015160c08b015160e0909b0151999c989b5096999598909790945092505050565b6000806040838503121561217a57600080fd5b8251612185816118f0565b602084015190925067ffffffffffffffff8111156121a257600080fd5b6121ae85828601611dc6565b9150509250929050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea2646970667358221220bb754b0bc3ef0d5463f585b4dc19fd29e3f578723e930e7b4c5479339b4b953d64736f6c63430008130033", + "devdoc": { + "events": { + "Initialized(uint8)": { + "details": "Triggered when the contract has been initialized or reinitialized." + } + }, + "kind": "dev", + "methods": { + "addGovernanceToken(address,uint256)": { + "params": { + "_tokenAddress": "the address of the ERC-721 token", + "_weight": "the number of votes each NFT id is worth" + } + }, + "getProposalVotes(uint32)": { + "params": { + "_proposalId": "id of the Proposal" + }, + "returns": { + "abstainVotes": "current count of \"ABSTAIN\" votes", + "endBlock": "block number voting ends", + "noVotes": "current count of \"NO\" votes", + "startBlock": "block number voting starts", + "yesVotes": "current count of \"YES\" votes" + } + }, + "getTokenWeight(address)": { + "params": { + "_tokenAddress": "the ERC-721 token address" + } + }, + "getWhitelistedHatsCount()": { + "returns": { + "_0": "The number of whitelisted hats" + } + }, + "hasVoted(uint32,address,uint256)": { + "params": { + "_proposalId": "the id of the Proposal", + "_tokenAddress": "the ERC-721 contract address", + "_tokenId": "the unique id of the NFT" + } + }, + "initializeProposal(bytes)": { + "params": { + "_data": "arbitrary data to pass to this BaseStrategy" + } + }, + "isHatWhitelisted(uint256)": { + "params": { + "_hatId": "The ID of the Hat to check" + }, + "returns": { + "_0": "True if the hat is whitelisted, false otherwise" + } + }, + "isPassed(uint32)": { + "params": { + "_proposalId": "proposalId to check" + }, + "returns": { + "_0": "bool true if the proposal has passed, otherwise false" + } + }, + "isProposer(address)": { + "details": "Checks if an address is authorized to create proposals.", + "params": { + "_address": "The address to check for proposal creation authorization." + }, + "returns": { + "_0": "bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise." + } + }, + "meetsBasis(uint256,uint256)": { + "params": { + "_noVotes": "number of votes against", + "_yesVotes": "number of votes in favor" + }, + "returns": { + "_0": "bool whether the yes votes meets the set basis" + } + }, + "owner()": { + "details": "Returns the address of the current owner." + }, + "removeGovernanceToken(address)": { + "params": { + "_tokenAddress": "the ERC-721 token to remove" + } + }, + "removeHatFromWhitelist(uint256)": { + "params": { + "_hatId": "The ID of the Hat to remove from the whitelist" + } + }, + "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." + }, + "setAzorius(address)": { + "params": { + "_azoriusModule": "address of the Azorius Safe module" + } + }, + "setUp(bytes)": { + "params": { + "initializeParams": "encoded initialization parameters: `address _owner`, `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`, `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _basisNumerator`, `address _hatsContract`, `uint256[] _initialWhitelistedHats`" + } + }, + "transferOwnership(address)": { + "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." + }, + "updateBasisNumerator(uint256)": { + "params": { + "_basisNumerator": "numerator to use" + } + }, + "updateProposerThreshold(uint256)": { + "params": { + "_proposerThreshold": "required voting weight" + } + }, + "updateQuorumThreshold(uint256)": { + "params": { + "_quorumThreshold": "total voting weight required to achieve quorum" + } + }, + "updateVotingPeriod(uint32)": { + "params": { + "_votingPeriod": "voting time period (in blocks)" + } + }, + "vote(uint32,uint8,address[],uint256[])": { + "params": { + "_proposalId": "id of the Proposal to vote on", + "_tokenAddresses": "list of ERC-721 addresses that correspond to ids in _tokenIds", + "_tokenIds": "list of unique token ids that correspond to their ERC-721 address in _tokenAddresses", + "_voteType": "Proposal support as defined in VoteType (NO, YES, ABSTAIN)" + } + }, + "votingEndBlock(uint32)": { + "params": { + "_proposalId": "proposalId to check" + }, + "returns": { + "_0": "uint32 block number when voting ends on the Proposal" + } + }, + "whitelistHat(uint256)": { + "params": { + "_hatId": "The ID of the Hat to whitelist" + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "BASIS_DENOMINATOR()": { + "notice": "The denominator to use when calculating basis (1,000,000). " + }, + "addGovernanceToken(address,uint256)": { + "notice": "Adds a new ERC-721 token as a governance token, along with its associated weight." + }, + "basisNumerator()": { + "notice": "The numerator to use when calculating basis (adjustable). " + }, + "getAllTokenAddresses()": { + "notice": "Returns whole list of governance tokens addresses" + }, + "getProposalVotes(uint32)": { + "notice": "Returns the current state of the specified Proposal." + }, + "getTokenWeight(address)": { + "notice": "Returns the current token weight for the given ERC-721 token address." + }, + "getWhitelistedHatsCount()": { + "notice": "Returns the number of whitelisted hats." + }, + "hasVoted(uint32,address,uint256)": { + "notice": "Returns whether an NFT id has already voted." + }, + "initializeProposal(bytes)": { + "notice": "Called by the [Azorius](../Azorius.md) module. This notifies this [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created." + }, + "isHatWhitelisted(uint256)": { + "notice": "Checks if a hat is whitelisted." + }, + "isPassed(uint32)": { + "notice": "Returns whether a Proposal has been passed." + }, + "isProposer(address)": { + "notice": "This function overrides the isProposer function from the parent contract. It iterates through all whitelisted Hat IDs and checks if the given address is wearing any of them using the Hats Protocol." + }, + "meetsBasis(uint256,uint256)": { + "notice": "Calculates whether a vote meets its basis." + }, + "proposalVotes(uint256)": { + "notice": "`proposalId` to `ProposalVotes`, the voting state of a Proposal. " + }, + "proposerThreshold()": { + "notice": "The minimum number of voting power required to create a new proposal." + }, + "quorumThreshold()": { + "notice": "The total number of votes required to achieve quorum. \"Quorum threshold\" is used instead of a quorum percent because IERC721 has no totalSupply function, so the contract cannot determine this." + }, + "removeGovernanceToken(address)": { + "notice": "Removes the given ERC-721 token address from the list of governance tokens." + }, + "removeHatFromWhitelist(uint256)": { + "notice": "Removes a Hat from the whitelist for proposal creation." + }, + "setAzorius(address)": { + "notice": "Sets the address of the [Azorius](../Azorius.md) contract this [BaseStrategy](../BaseStrategy.md) is being used on." + }, + "setUp(bytes)": { + "notice": "Sets up the contract with its initial parameters." + }, + "tokenAddresses(uint256)": { + "notice": "The list of ERC-721 tokens that can vote. " + }, + "tokenWeights(address)": { + "notice": "ERC-721 address to its voting weight per NFT id. " + }, + "updateBasisNumerator(uint256)": { + "notice": "Updates the `basisNumerator` for future Proposals." + }, + "updateProposerThreshold(uint256)": { + "notice": "Updates the voting weight required to submit new Proposals." + }, + "updateQuorumThreshold(uint256)": { + "notice": "Updates the quorum required for future Proposals." + }, + "updateVotingPeriod(uint32)": { + "notice": "Updates the voting time period for new Proposals." + }, + "vote(uint32,uint8,address[],uint256[])": { + "notice": "Submits a vote on an existing Proposal." + }, + "votingEndBlock(uint32)": { + "notice": "Returns the block number voting ends on a given Proposal." + }, + "votingPeriod()": { + "notice": "Number of blocks a new Proposal can be voted on. " + }, + "whitelistHat(uint256)": { + "notice": "Adds a Hat to the whitelist for proposal creation." + }, + "whitelistedHatIds(uint256)": { + "notice": "Array to store whitelisted Hat IDs. " + } + }, + "notice": "An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that enables linear (i.e. 1 to 1) ERC721 based token voting, with proposal creation restricted to users wearing whitelisted Hats.", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 3585, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 3588, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6487, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage" + }, + { + "astId": 3379, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address" + }, + { + "astId": 3499, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage" + }, + { + "astId": 16744, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "hatsContract", + "offset": 0, + "slot": "101", + "type": "t_contract(IHats)22245" + }, + { + "astId": 16748, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "whitelistedHatIds", + "offset": 0, + "slot": "102", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 16551, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "azoriusModule", + "offset": 0, + "slot": "103", + "type": "t_contract(IAzorius)21329" + }, + { + "astId": 16651, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "basisNumerator", + "offset": 0, + "slot": "104", + "type": "t_uint256" + }, + { + "astId": 20121, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "proposalVotes", + "offset": 0, + "slot": "105", + "type": "t_mapping(t_uint256,t_struct(ProposalVotes)20115_storage)" + }, + { + "astId": 20125, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "tokenAddresses", + "offset": 0, + "slot": "106", + "type": "t_array(t_address)dyn_storage" + }, + { + "astId": 20130, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "tokenWeights", + "offset": 0, + "slot": "107", + "type": "t_mapping(t_address,t_uint256)" + }, + { + "astId": 20133, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "votingPeriod", + "offset": 0, + "slot": "108", + "type": "t_uint32" + }, + { + "astId": 20136, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "quorumThreshold", + "offset": 0, + "slot": "109", + "type": "t_uint256" + }, + { + "astId": 20139, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "proposerThreshold", + "offset": 0, + "slot": "110", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(IAzorius)21329": { + "encoding": "inplace", + "label": "contract IAzorius", + "numberOfBytes": "20" + }, + "t_contract(IHats)22245": { + "encoding": "inplace", + "label": "contract IHats", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => bool))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bool)" + }, + "t_mapping(t_address,t_uint256)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_struct(ProposalVotes)20115_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct LinearERC721VotingExtensible.ProposalVotes)", + "numberOfBytes": "32", + "value": "t_struct(ProposalVotes)20115_storage" + }, + "t_struct(ProposalVotes)20115_storage": { + "encoding": "inplace", + "label": "struct LinearERC721VotingExtensible.ProposalVotes", + "members": [ + { + "astId": 20099, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "votingStartBlock", + "offset": 0, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 20101, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "votingEndBlock", + "offset": 4, + "slot": "0", + "type": "t_uint32" + }, + { + "astId": 20103, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "noVotes", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 20105, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "yesVotes", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 20107, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "abstainVotes", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 20114, + "contract": "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol:LinearERC721VotingWithHatsProposalCreation", + "label": "hasVoted", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" + } + ], + "numberOfBytes": "160" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/sepolia/solcInputs/8098c390a54ad5a8bcff70bed7c24a3c.json b/deployments/sepolia/solcInputs/8098c390a54ad5a8bcff70bed7c24a3c.json new file mode 100644 index 00000000..3b784b21 --- /dev/null +++ b/deployments/sepolia/solcInputs/8098c390a54ad5a8bcff70bed7c24a3c.json @@ -0,0 +1,395 @@ +{ + "language": "Solidity", + "sources": { + "@gnosis.pm/safe-contracts/contracts/base/Executor.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\n\n/// @title Executor - A contract that can execute transactions\n/// @author Richard Meissner - \ncontract Executor {\n function execute(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 txGas\n ) internal returns (bool success) {\n if (operation == Enum.Operation.DelegateCall) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0)\n }\n } else {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0)\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/FallbackManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract FallbackManager is SelfAuthorized {\n event ChangedFallbackHandler(address handler);\n\n // keccak256(\"fallback_manager.handler.address\")\n bytes32 internal constant FALLBACK_HANDLER_STORAGE_SLOT = 0x6c9a6c4a39284e37ed1cf53d337577d14212a4870fb976a4366c693b939918d5;\n\n function internalSetFallbackHandler(address handler) internal {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, handler)\n }\n }\n\n /// @dev Allows to add a contract to handle fallback calls.\n /// Only fallback calls without value and with data will be forwarded.\n /// This can only be done via a Safe transaction.\n /// @param handler contract to handle fallbacks calls.\n function setFallbackHandler(address handler) public authorized {\n internalSetFallbackHandler(handler);\n emit ChangedFallbackHandler(handler);\n }\n\n // solhint-disable-next-line payable-fallback,no-complex-fallback\n fallback() external {\n bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let handler := sload(slot)\n if iszero(handler) {\n return(0, 0)\n }\n calldatacopy(0, 0, calldatasize())\n // The msg.sender address is shifted to the left by 12 bytes to remove the padding\n // Then the address without padding is stored right after the calldata\n mstore(calldatasize(), shl(96, caller()))\n // Add 20 bytes for the address appended add the end\n let success := call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if iszero(success) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/GuardManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\n\ninterface Guard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n\n/// @title Fallback Manager - A contract that manages fallback calls made to this contract\n/// @author Richard Meissner - \ncontract GuardManager is SelfAuthorized {\n event ChangedGuard(address guard);\n // keccak256(\"guard_manager.guard.address\")\n bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8;\n\n /// @dev Set a guard that checks transactions before execution\n /// @param guard The address of the guard to be used or the 0 address to disable the guard\n function setGuard(address guard) external authorized {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n sstore(slot, guard)\n }\n emit ChangedGuard(guard);\n }\n\n function getGuard() internal view returns (address guard) {\n bytes32 slot = GUARD_STORAGE_SLOT;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n guard := sload(slot)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/ModuleManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/Enum.sol\";\nimport \"../common/SelfAuthorized.sol\";\nimport \"./Executor.sol\";\n\n/// @title Module Manager - A contract that manages modules that can execute transactions via this contract\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract ModuleManager is SelfAuthorized, Executor {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n address internal constant SENTINEL_MODULES = address(0x1);\n\n mapping(address => address) internal modules;\n\n function setupModules(address to, bytes memory data) internal {\n require(modules[SENTINEL_MODULES] == address(0), \"GS100\");\n modules[SENTINEL_MODULES] = SENTINEL_MODULES;\n if (to != address(0))\n // Setup has to complete successfully or transaction fails.\n require(execute(to, 0, data, Enum.Operation.DelegateCall, gasleft()), \"GS000\");\n }\n\n /// @dev Allows to add a module to the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Enables the module `module` for the Safe.\n /// @param module Module to be whitelisted.\n function enableModule(address module) public authorized {\n // Module address cannot be null or sentinel.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n // Module cannot be added twice.\n require(modules[module] == address(0), \"GS102\");\n modules[module] = modules[SENTINEL_MODULES];\n modules[SENTINEL_MODULES] = module;\n emit EnabledModule(module);\n }\n\n /// @dev Allows to remove a module from the whitelist.\n /// This can only be done via a Safe transaction.\n /// @notice Disables the module `module` for the Safe.\n /// @param prevModule Module that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) public authorized {\n // Validate module address and check that it corresponds to module index.\n require(module != address(0) && module != SENTINEL_MODULES, \"GS101\");\n require(modules[prevModule] == module, \"GS103\");\n modules[prevModule] = modules[module];\n modules[module] = address(0);\n emit DisabledModule(module);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public virtual returns (bool success) {\n // Only whitelisted modules are allowed.\n require(msg.sender != SENTINEL_MODULES && modules[msg.sender] != address(0), \"GS104\");\n // Execute transaction without further confirmations.\n success = execute(to, value, data, operation, gasleft());\n if (success) emit ExecutionFromModuleSuccess(msg.sender);\n else emit ExecutionFromModuleFailure(msg.sender);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations and return data\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public returns (bool success, bytes memory returnData) {\n success = execTransactionFromModule(to, value, data, operation);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Load free memory location\n let ptr := mload(0x40)\n // We allocate memory for the return data by setting the free memory location to\n // current free memory location + data size + 32 bytes for data size value\n mstore(0x40, add(ptr, add(returndatasize(), 0x20)))\n // Store the size\n mstore(ptr, returndatasize())\n // Store the data\n returndatacopy(add(ptr, 0x20), 0, returndatasize())\n // Point the return data to the correct memory location\n returnData := ptr\n }\n }\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) public view returns (bool) {\n return SENTINEL_MODULES != module && modules[module] != address(0);\n }\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize) external view returns (address[] memory array, address next) {\n // Init array with max page size\n array = new address[](pageSize);\n\n // Populate return array\n uint256 moduleCount = 0;\n address currentModule = modules[start];\n while (currentModule != address(0x0) && currentModule != SENTINEL_MODULES && moduleCount < pageSize) {\n array[moduleCount] = currentModule;\n currentModule = modules[currentModule];\n moduleCount++;\n }\n next = currentModule;\n // Set correct size of returned array\n // solhint-disable-next-line no-inline-assembly\n assembly {\n mstore(array, moduleCount)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/base/OwnerManager.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"../common/SelfAuthorized.sol\";\n\n/// @title OwnerManager - Manages a set of owners and a threshold to perform actions.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract OwnerManager is SelfAuthorized {\n event AddedOwner(address owner);\n event RemovedOwner(address owner);\n event ChangedThreshold(uint256 threshold);\n\n address internal constant SENTINEL_OWNERS = address(0x1);\n\n mapping(address => address) internal owners;\n uint256 internal ownerCount;\n uint256 internal threshold;\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n function setupOwners(address[] memory _owners, uint256 _threshold) internal {\n // Threshold can only be 0 at initialization.\n // Check ensures that setup function can only be called once.\n require(threshold == 0, \"GS200\");\n // Validate that threshold is smaller than number of added owners.\n require(_threshold <= _owners.length, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n // Initializing Safe owners.\n address currentOwner = SENTINEL_OWNERS;\n for (uint256 i = 0; i < _owners.length; i++) {\n // Owner address cannot be null.\n address owner = _owners[i];\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this) && currentOwner != owner, \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[currentOwner] = owner;\n currentOwner = owner;\n }\n owners[currentOwner] = SENTINEL_OWNERS;\n ownerCount = _owners.length;\n threshold = _threshold;\n }\n\n /// @dev Allows to add a new owner to the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Adds the owner `owner` to the Safe and updates the threshold to `_threshold`.\n /// @param owner New owner address.\n /// @param _threshold New threshold.\n function addOwnerWithThreshold(address owner, uint256 _threshold) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(owner != address(0) && owner != SENTINEL_OWNERS && owner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[owner] == address(0), \"GS204\");\n owners[owner] = owners[SENTINEL_OWNERS];\n owners[SENTINEL_OWNERS] = owner;\n ownerCount++;\n emit AddedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to remove an owner from the Safe and update the threshold at the same time.\n /// This can only be done via a Safe transaction.\n /// @notice Removes the owner `owner` from the Safe and updates the threshold to `_threshold`.\n /// @param prevOwner Owner that pointed to the owner to be removed in the linked list\n /// @param owner Owner address to be removed.\n /// @param _threshold New threshold.\n function removeOwner(\n address prevOwner,\n address owner,\n uint256 _threshold\n ) public authorized {\n // Only allow to remove an owner, if threshold can still be reached.\n require(ownerCount - 1 >= _threshold, \"GS201\");\n // Validate owner address and check that it corresponds to owner index.\n require(owner != address(0) && owner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == owner, \"GS205\");\n owners[prevOwner] = owners[owner];\n owners[owner] = address(0);\n ownerCount--;\n emit RemovedOwner(owner);\n // Change threshold if threshold was changed.\n if (threshold != _threshold) changeThreshold(_threshold);\n }\n\n /// @dev Allows to swap/replace an owner from the Safe with another address.\n /// This can only be done via a Safe transaction.\n /// @notice Replaces the owner `oldOwner` in the Safe with `newOwner`.\n /// @param prevOwner Owner that pointed to the owner to be replaced in the linked list\n /// @param oldOwner Owner address to be replaced.\n /// @param newOwner New owner address.\n function swapOwner(\n address prevOwner,\n address oldOwner,\n address newOwner\n ) public authorized {\n // Owner address cannot be null, the sentinel or the Safe itself.\n require(newOwner != address(0) && newOwner != SENTINEL_OWNERS && newOwner != address(this), \"GS203\");\n // No duplicate owners allowed.\n require(owners[newOwner] == address(0), \"GS204\");\n // Validate oldOwner address and check that it corresponds to owner index.\n require(oldOwner != address(0) && oldOwner != SENTINEL_OWNERS, \"GS203\");\n require(owners[prevOwner] == oldOwner, \"GS205\");\n owners[newOwner] = owners[oldOwner];\n owners[prevOwner] = newOwner;\n owners[oldOwner] = address(0);\n emit RemovedOwner(oldOwner);\n emit AddedOwner(newOwner);\n }\n\n /// @dev Allows to update the number of required confirmations by Safe owners.\n /// This can only be done via a Safe transaction.\n /// @notice Changes the threshold of the Safe to `_threshold`.\n /// @param _threshold New threshold.\n function changeThreshold(uint256 _threshold) public authorized {\n // Validate that threshold is smaller than number of owners.\n require(_threshold <= ownerCount, \"GS201\");\n // There has to be at least one Safe owner.\n require(_threshold >= 1, \"GS202\");\n threshold = _threshold;\n emit ChangedThreshold(threshold);\n }\n\n function getThreshold() public view returns (uint256) {\n return threshold;\n }\n\n function isOwner(address owner) public view returns (bool) {\n return owner != SENTINEL_OWNERS && owners[owner] != address(0);\n }\n\n /// @dev Returns array of owners.\n /// @return Array of Safe owners.\n function getOwners() public view returns (address[] memory) {\n address[] memory array = new address[](ownerCount);\n\n // populate return array\n uint256 index = 0;\n address currentOwner = owners[SENTINEL_OWNERS];\n while (currentOwner != SENTINEL_OWNERS) {\n array[index] = currentOwner;\n currentOwner = owners[currentOwner];\n index++;\n }\n return array;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Enum.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Enum - Collection of enums\n/// @author Richard Meissner - \ncontract Enum {\n enum Operation {Call, DelegateCall}\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/EtherPaymentFallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title EtherPaymentFallback - A contract that has a fallback to accept ether payments\n/// @author Richard Meissner - \ncontract EtherPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts Ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SecuredTokenTransfer.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SecuredTokenTransfer - Secure token transfer\n/// @author Richard Meissner - \ncontract SecuredTokenTransfer {\n /// @dev Transfers a token and returns if it was a success\n /// @param token Token that should be transferred\n /// @param receiver Receiver to whom the token should be transferred\n /// @param amount The amount of tokens that should be transferred\n function transferToken(\n address token,\n address receiver,\n uint256 amount\n ) internal returns (bool transferred) {\n // 0xa9059cbb - keccack(\"transfer(address,uint256)\")\n bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // We write the return value to scratch space.\n // See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory\n let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)\n switch returndatasize()\n case 0 {\n transferred := success\n }\n case 0x20 {\n transferred := iszero(or(iszero(success), iszero(mload(0))))\n }\n default {\n transferred := 0\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SelfAuthorized.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SelfAuthorized - authorizes current contract to perform actions\n/// @author Richard Meissner - \ncontract SelfAuthorized {\n function requireSelfCall() private view {\n require(msg.sender == address(this), \"GS031\");\n }\n\n modifier authorized() {\n // This is a function call as it minimized the bytecode size\n requireSelfCall();\n _;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/SignatureDecoder.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title SignatureDecoder - Decodes signatures that a encoded as bytes\n/// @author Richard Meissner - \ncontract SignatureDecoder {\n /// @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s`.\n /// @notice Make sure to peform a bounds check for @param pos, to avoid out of bounds access on @param signatures\n /// @param pos which signature to read. A prior bounds check of this parameter should be performed, to avoid out of bounds access\n /// @param signatures concatenated rsv signatures\n function signatureSplit(bytes memory signatures, uint256 pos)\n internal\n pure\n returns (\n uint8 v,\n bytes32 r,\n bytes32 s\n )\n {\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let signaturePos := mul(0x41, pos)\n r := mload(add(signatures, add(signaturePos, 0x20)))\n s := mload(add(signatures, add(signaturePos, 0x40)))\n // Here we are loading the last 32 bytes, including 31 bytes\n // of 's'. There is no 'mload8' to do this.\n //\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n v := and(mload(add(signatures, add(signaturePos, 0x41))), 0xff)\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/Singleton.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Singleton - Base for singleton contracts (should always be first super contract)\n/// This contract is tightly coupled to our proxy contract (see `proxies/GnosisSafeProxy.sol`)\n/// @author Richard Meissner - \ncontract Singleton {\n // singleton always needs to be first declared variable, to ensure that it is at the same location as in the Proxy contract.\n // It should also always be ensured that the address is stored alone (uses a full word)\n address private singleton;\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/common/StorageAccessible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title StorageAccessible - generic base contract that allows callers to access all internal storage.\n/// @notice See https://github.com/gnosis/util-contracts/blob/bb5fe5fb5df6d8400998094fb1b32a178a47c3a1/contracts/StorageAccessible.sol\ncontract StorageAccessible {\n /**\n * @dev Reads `length` bytes of storage in the currents contract\n * @param offset - the offset in the current contract's storage in words to start reading from\n * @param length - the number of words (32 bytes) of data to read\n * @return the bytes that were read.\n */\n function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {\n bytes memory result = new bytes(length * 32);\n for (uint256 index = 0; index < length; index++) {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let word := sload(add(offset, index))\n mstore(add(add(result, 0x20), mul(index, 0x20)), word)\n }\n }\n return result;\n }\n\n /**\n * @dev Performs a delegetecall on a targetContract in the context of self.\n * Internally reverts execution to avoid side effects (making it static).\n *\n * This method reverts with data equal to `abi.encode(bool(success), bytes(response))`.\n * Specifically, the `returndata` after a call to this method will be:\n * `success:bool || response.length:uint256 || response:bytes`.\n *\n * @param targetContract Address of the contract containing the code to execute.\n * @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).\n */\n function simulateAndRevert(address targetContract, bytes memory calldataPayload) external {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let success := delegatecall(gas(), targetContract, add(calldataPayload, 0x20), mload(calldataPayload), 0, 0)\n\n mstore(0x00, success)\n mstore(0x20, returndatasize())\n returndatacopy(0x40, 0, returndatasize())\n revert(0, add(returndatasize(), 0x40))\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/external/GnosisSafeMath.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title GnosisSafeMath\n * @dev Math operations with safety checks that revert on error\n * Renamed from SafeMath to GnosisSafeMath to avoid conflicts\n * TODO: remove once open zeppelin update to solc 0.5.0\n */\nlibrary GnosisSafeMath {\n /**\n * @dev Multiplies two numbers, reverts on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522\n if (a == 0) {\n return 0;\n }\n\n uint256 c = a * b;\n require(c / a == b);\n\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n require(b <= a);\n uint256 c = a - b;\n\n return c;\n }\n\n /**\n * @dev Adds two numbers, reverts on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n require(c >= a);\n\n return c;\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafe.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./base/ModuleManager.sol\";\nimport \"./base/OwnerManager.sol\";\nimport \"./base/FallbackManager.sol\";\nimport \"./base/GuardManager.sol\";\nimport \"./common/EtherPaymentFallback.sol\";\nimport \"./common/Singleton.sol\";\nimport \"./common/SignatureDecoder.sol\";\nimport \"./common/SecuredTokenTransfer.sol\";\nimport \"./common/StorageAccessible.sol\";\nimport \"./interfaces/ISignatureValidator.sol\";\nimport \"./external/GnosisSafeMath.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafe is\n EtherPaymentFallback,\n Singleton,\n ModuleManager,\n OwnerManager,\n SignatureDecoder,\n SecuredTokenTransfer,\n ISignatureValidatorConstants,\n FallbackManager,\n StorageAccessible,\n GuardManager\n{\n using GnosisSafeMath for uint256;\n\n string public constant VERSION = \"1.3.0\";\n\n // keccak256(\n // \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n // );\n bytes32 private constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n // keccak256(\n // \"SafeTx(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,uint256 nonce)\"\n // );\n bytes32 private constant SAFE_TX_TYPEHASH = 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8;\n\n event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler);\n event ApproveHash(bytes32 indexed approvedHash, address indexed owner);\n event SignMsg(bytes32 indexed msgHash);\n event ExecutionFailure(bytes32 txHash, uint256 payment);\n event ExecutionSuccess(bytes32 txHash, uint256 payment);\n\n uint256 public nonce;\n bytes32 private _deprecatedDomainSeparator;\n // Mapping to keep track of all message hashes that have been approve by ALL REQUIRED owners\n mapping(bytes32 => uint256) public signedMessages;\n // Mapping to keep track of all hashes (message or transaction) that have been approve by ANY owners\n mapping(address => mapping(bytes32 => uint256)) public approvedHashes;\n\n // This constructor ensures that this contract can only be used as a master copy for Proxy contracts\n constructor() {\n // By setting the threshold it is not possible to call setup anymore,\n // so we create a Safe with 0 owners and threshold 1.\n // This is an unusable Safe, perfect for the singleton\n threshold = 1;\n }\n\n /// @dev Setup function sets initial storage of contract.\n /// @param _owners List of Safe owners.\n /// @param _threshold Number of required confirmations for a Safe transaction.\n /// @param to Contract address for optional delegate call.\n /// @param data Data payload for optional delegate call.\n /// @param fallbackHandler Handler for fallback calls to this contract\n /// @param paymentToken Token that should be used for the payment (0 is ETH)\n /// @param payment Value that should be paid\n /// @param paymentReceiver Adddress that should receive the payment (or 0 if tx.origin)\n function setup(\n address[] calldata _owners,\n uint256 _threshold,\n address to,\n bytes calldata data,\n address fallbackHandler,\n address paymentToken,\n uint256 payment,\n address payable paymentReceiver\n ) external {\n // setupOwners checks if the Threshold is already set, therefore preventing that this method is called twice\n setupOwners(_owners, _threshold);\n if (fallbackHandler != address(0)) internalSetFallbackHandler(fallbackHandler);\n // As setupOwners can only be called if the contract has not been initialized we don't need a check for setupModules\n setupModules(to, data);\n\n if (payment > 0) {\n // To avoid running into issues with EIP-170 we reuse the handlePayment function (to avoid adjusting code of that has been verified we do not adjust the method itself)\n // baseGas = 0, gasPrice = 1 and gas = payment => amount = (payment + 0) * 1 = payment\n handlePayment(payment, 0, 1, paymentToken, paymentReceiver);\n }\n emit SafeSetup(msg.sender, _owners, _threshold, to, fallbackHandler);\n }\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable virtual returns (bool success) {\n bytes32 txHash;\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n bytes memory txHashData =\n encodeTransactionData(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n nonce\n );\n // Increase nonce and execute transaction.\n nonce++;\n txHash = keccak256(txHashData);\n checkSignatures(txHash, txHashData, signatures);\n }\n address guard = getGuard();\n {\n if (guard != address(0)) {\n Guard(guard).checkTransaction(\n // Transaction info\n to,\n value,\n data,\n operation,\n safeTxGas,\n // Payment info\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n // Signature info\n signatures,\n msg.sender\n );\n }\n }\n // We require some gas to emit the events (at least 2500) after the execution and some to perform code until the execution (500)\n // We also include the 1/64 in the check that is not send along with a call to counteract potential shortings because of EIP-150\n require(gasleft() >= ((safeTxGas * 64) / 63).max(safeTxGas + 2500) + 500, \"GS010\");\n // Use scope here to limit variable lifetime and prevent `stack too deep` errors\n {\n uint256 gasUsed = gasleft();\n // If the gasPrice is 0 we assume that nearly all available gas can be used (it is always more than safeTxGas)\n // We only substract 2500 (compared to the 3000 before) to ensure that the amount passed is still higher than safeTxGas\n success = execute(to, value, data, operation, gasPrice == 0 ? (gasleft() - 2500) : safeTxGas);\n gasUsed = gasUsed.sub(gasleft());\n // If no safeTxGas and no gasPrice was set (e.g. both are 0), then the internal tx is required to be successful\n // This makes it possible to use `estimateGas` without issues, as it searches for the minimum gas where the tx doesn't revert\n require(success || safeTxGas != 0 || gasPrice != 0, \"GS013\");\n // We transfer the calculated tx costs to the tx.origin to avoid sending it to intermediate contracts that have made calls\n uint256 payment = 0;\n if (gasPrice > 0) {\n payment = handlePayment(gasUsed, baseGas, gasPrice, gasToken, refundReceiver);\n }\n if (success) emit ExecutionSuccess(txHash, payment);\n else emit ExecutionFailure(txHash, payment);\n }\n {\n if (guard != address(0)) {\n Guard(guard).checkAfterExecution(txHash, success);\n }\n }\n }\n\n function handlePayment(\n uint256 gasUsed,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver\n ) private returns (uint256 payment) {\n // solhint-disable-next-line avoid-tx-origin\n address payable receiver = refundReceiver == address(0) ? payable(tx.origin) : refundReceiver;\n if (gasToken == address(0)) {\n // For ETH we will only adjust the gas price to not be higher than the actual used gas price\n payment = gasUsed.add(baseGas).mul(gasPrice < tx.gasprice ? gasPrice : tx.gasprice);\n require(receiver.send(payment), \"GS011\");\n } else {\n payment = gasUsed.add(baseGas).mul(gasPrice);\n require(transferToken(gasToken, receiver, payment), \"GS012\");\n }\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures\n ) public view {\n // Load threshold to avoid multiple storage loads\n uint256 _threshold = threshold;\n // Check that a threshold is set\n require(_threshold > 0, \"GS001\");\n checkNSignatures(dataHash, data, signatures, _threshold);\n }\n\n /**\n * @dev Checks whether the signature provided is valid for the provided data, hash. Will revert otherwise.\n * @param dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param data That should be signed (this is passed to an external validator contract)\n * @param signatures Signature data that should be verified. Can be ECDSA signature, contract signature (EIP-1271) or approved hash.\n * @param requiredSignatures Amount of required valid signatures.\n */\n function checkNSignatures(\n bytes32 dataHash,\n bytes memory data,\n bytes memory signatures,\n uint256 requiredSignatures\n ) public view {\n // Check that the provided signature data is not too short\n require(signatures.length >= requiredSignatures.mul(65), \"GS020\");\n // There cannot be an owner with address 0.\n address lastOwner = address(0);\n address currentOwner;\n uint8 v;\n bytes32 r;\n bytes32 s;\n uint256 i;\n for (i = 0; i < requiredSignatures; i++) {\n (v, r, s) = signatureSplit(signatures, i);\n if (v == 0) {\n // If v is 0 then it is a contract signature\n // When handling contract signatures the address of the contract is encoded into r\n currentOwner = address(uint160(uint256(r)));\n\n // Check that signature data pointer (s) is not pointing inside the static part of the signatures bytes\n // This check is not completely accurate, since it is possible that more signatures than the threshold are send.\n // Here we only check that the pointer is not pointing inside the part that is being processed\n require(uint256(s) >= requiredSignatures.mul(65), \"GS021\");\n\n // Check that signature data pointer (s) is in bounds (points to the length of data -> 32 bytes)\n require(uint256(s).add(32) <= signatures.length, \"GS022\");\n\n // Check if the contract signature is in bounds: start of data is s + 32 and end is start + signature length\n uint256 contractSignatureLen;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n contractSignatureLen := mload(add(add(signatures, s), 0x20))\n }\n require(uint256(s).add(32).add(contractSignatureLen) <= signatures.length, \"GS023\");\n\n // Check signature\n bytes memory contractSignature;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // The signature data for contract signatures is appended to the concatenated signatures and the offset is stored in s\n contractSignature := add(add(signatures, s), 0x20)\n }\n require(ISignatureValidator(currentOwner).isValidSignature(data, contractSignature) == EIP1271_MAGIC_VALUE, \"GS024\");\n } else if (v == 1) {\n // If v is 1 then it is an approved hash\n // When handling approved hashes the address of the approver is encoded into r\n currentOwner = address(uint160(uint256(r)));\n // Hashes are automatically approved by the sender of the message or when they have been pre-approved via a separate transaction\n require(msg.sender == currentOwner || approvedHashes[currentOwner][dataHash] != 0, \"GS025\");\n } else if (v > 30) {\n // If v > 30 then default va (27,28) has been adjusted for eth_sign flow\n // To support eth_sign and similar we adjust v and hash the messageHash with the Ethereum message prefix before applying ecrecover\n currentOwner = ecrecover(keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", dataHash)), v - 4, r, s);\n } else {\n // Default is the ecrecover flow with the provided data hash\n // Use ecrecover with the messageHash for EOA signatures\n currentOwner = ecrecover(dataHash, v, r, s);\n }\n require(currentOwner > lastOwner && owners[currentOwner] != address(0) && currentOwner != SENTINEL_OWNERS, \"GS026\");\n lastOwner = currentOwner;\n }\n }\n\n /// @dev Allows to estimate a Safe transaction.\n /// This method is only meant for estimation purpose, therefore the call will always revert and encode the result in the revert data.\n /// Since the `estimateGas` function includes refunds, call this method to get an estimated of the costs that are deducted from the safe with `execTransaction`\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @return Estimate without refunds and overhead fees (base transaction and payload data gas costs).\n /// @notice Deprecated in favor of common/StorageAccessible.sol and will be removed in next version.\n function requiredTxGas(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation\n ) external returns (uint256) {\n uint256 startGas = gasleft();\n // We don't provide an error message here, as we use it to return the estimate\n require(execute(to, value, data, operation, gasleft()));\n uint256 requiredGas = startGas - gasleft();\n // Convert response to string and return via error message\n revert(string(abi.encodePacked(requiredGas)));\n }\n\n /**\n * @dev Marks a hash as approved. This can be used to validate a hash that is used by a signature.\n * @param hashToApprove The hash that should be marked as approved for signatures that are verified by this contract.\n */\n function approveHash(bytes32 hashToApprove) external {\n require(owners[msg.sender] != address(0), \"GS030\");\n approvedHashes[msg.sender][hashToApprove] = 1;\n emit ApproveHash(hashToApprove, msg.sender);\n }\n\n /// @dev Returns the chain id used by this contract.\n function getChainId() public view returns (uint256) {\n uint256 id;\n // solhint-disable-next-line no-inline-assembly\n assembly {\n id := chainid()\n }\n return id;\n }\n\n function domainSeparator() public view returns (bytes32) {\n return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, getChainId(), this));\n }\n\n /// @dev Returns the bytes that are hashed to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Gas that should be used for the safe transaction.\n /// @param baseGas Gas costs for that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash bytes.\n function encodeTransactionData(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes memory) {\n bytes32 safeTxHash =\n keccak256(\n abi.encode(\n SAFE_TX_TYPEHASH,\n to,\n value,\n keccak256(data),\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n _nonce\n )\n );\n return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), safeTxHash);\n }\n\n /// @dev Returns hash to be signed by owners.\n /// @param to Destination address.\n /// @param value Ether value.\n /// @param data Data payload.\n /// @param operation Operation type.\n /// @param safeTxGas Fas that should be used for the safe transaction.\n /// @param baseGas Gas costs for data used to trigger the safe transaction.\n /// @param gasPrice Maximum gas price that should be used for this transaction.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param _nonce Transaction nonce.\n /// @return Transaction hash.\n function getTransactionHash(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address refundReceiver,\n uint256 _nonce\n ) public view returns (bytes32) {\n return keccak256(encodeTransactionData(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, _nonce));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafe.sol\";\n\n/// @title Gnosis Safe - A multisignature wallet with support for confirmations using signed messages based on ERC191.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeL2 is GnosisSafe {\n event SafeMultiSigTransaction(\n address to,\n uint256 value,\n bytes data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes signatures,\n // We combine nonce, sender and threshold into one to avoid stack too deep\n // Dev note: additionalInfo should not contain `bytes`, as this complicates decoding\n bytes additionalInfo\n );\n\n event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);\n\n /// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.\n /// Note: The fees are always transferred, even if the user transaction fails.\n /// @param to Destination address of Safe transaction.\n /// @param value Ether value of Safe transaction.\n /// @param data Data payload of Safe transaction.\n /// @param operation Operation type of Safe transaction.\n /// @param safeTxGas Gas that should be used for the Safe transaction.\n /// @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund)\n /// @param gasPrice Gas price that should be used for the payment calculation.\n /// @param gasToken Token address (or 0 if ETH) that is used for the payment.\n /// @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin).\n /// @param signatures Packed signature data ({bytes32 r}{bytes32 s}{uint8 v})\n function execTransaction(\n address to,\n uint256 value,\n bytes calldata data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures\n ) public payable override returns (bool) {\n bytes memory additionalInfo;\n {\n additionalInfo = abi.encode(nonce, msg.sender, threshold);\n }\n emit SafeMultiSigTransaction(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n signatures,\n additionalInfo\n );\n return super.execTransaction(to, value, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, signatures);\n }\n\n /// @dev Allows a Module to execute a Safe transaction without any further confirmations.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) public override returns (bool success) {\n emit SafeModuleTransaction(msg.sender, to, value, data, operation);\n success = super.execTransactionFromModule(to, value, data, operation);\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/interfaces/ISignatureValidator.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\ncontract ISignatureValidatorConstants {\n // bytes4(keccak256(\"isValidSignature(bytes,bytes)\")\n bytes4 internal constant EIP1271_MAGIC_VALUE = 0x20c13b0b;\n}\n\nabstract contract ISignatureValidator is ISignatureValidatorConstants {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param _data Arbitrary length data signed on the behalf of address(this)\n * @param _signature Signature byte array associated with _data\n *\n * MUST return the bytes4 magic value 0x20c13b0b when function passes.\n * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)\n * MUST allow external calls\n */\n function isValidSignature(bytes memory _data, bytes memory _signature) public view virtual returns (bytes4);\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title Multi Send Call Only - Allows to batch multiple transactions into one, but only calls\n/// @author Stefan George - \n/// @author Richard Meissner - \n/// @notice The guard logic is not required here as this contract doesn't support nested delegate calls\ncontract MultiSendCallOnly {\n /// @dev Sends multiple transactions and reverts all if one fails.\n /// @param transactions Encoded transactions. Each transaction is encoded as a packed bytes of\n /// operation has to be uint8(0) in this version (=> 1 byte),\n /// to as a address (=> 20 bytes),\n /// value as a uint256 (=> 32 bytes),\n /// data length as a uint256 (=> 32 bytes),\n /// data as bytes.\n /// see abi.encodePacked for more information on packed encoding\n /// @notice The code is for most part the same as the normal MultiSend (to keep compatibility),\n /// but reverts if a transaction tries to use a delegatecall.\n /// @notice This method is payable as delegatecalls keep the msg.value from the previous call\n /// If the calling method (e.g. execTransaction) received ETH this would revert otherwise\n function multiSend(bytes memory transactions) public payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let length := mload(transactions)\n let i := 0x20\n for {\n // Pre block is not used in \"while mode\"\n } lt(i, length) {\n // Post block is not used in \"while mode\"\n } {\n // First byte of the data is the operation.\n // We shift by 248 bits (256 - 8 [operation byte]) it right since mload will always load 32 bytes (a word).\n // This will also zero out unused data.\n let operation := shr(0xf8, mload(add(transactions, i)))\n // We offset the load address by 1 byte (operation byte)\n // We shift it right by 96 bits (256 - 160 [20 address bytes]) to right-align the data and zero out unused data.\n let to := shr(0x60, mload(add(transactions, add(i, 0x01))))\n // We offset the load address by 21 byte (operation byte + 20 address bytes)\n let value := mload(add(transactions, add(i, 0x15)))\n // We offset the load address by 53 byte (operation byte + 20 address bytes + 32 value bytes)\n let dataLength := mload(add(transactions, add(i, 0x35)))\n // We offset the load address by 85 byte (operation byte + 20 address bytes + 32 value bytes + 32 data length bytes)\n let data := add(transactions, add(i, 0x55))\n let success := 0\n switch operation\n case 0 {\n success := call(gas(), to, value, data, dataLength, 0, 0)\n }\n // This version does not allow delegatecalls\n case 1 {\n revert(0, 0)\n }\n if eq(success, 0) {\n revert(0, 0)\n }\n // Next entry starts at 85 byte + data length\n i := add(i, add(0x55, dataLength))\n }\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\n/// @title IProxy - Helper interface to access masterCopy of the Proxy on-chain\n/// @author Richard Meissner - \ninterface IProxy {\n function masterCopy() external view returns (address);\n}\n\n/// @title GnosisSafeProxy - Generic proxy contract allows to execute all transactions applying the code of a master contract.\n/// @author Stefan George - \n/// @author Richard Meissner - \ncontract GnosisSafeProxy {\n // singleton always needs to be first declared variable, to ensure that it is at the same location in the contracts to which calls are delegated.\n // To reduce deployment costs this variable is internal and needs to be retrieved via `getStorageAt`\n address internal singleton;\n\n /// @dev Constructor function sets address of singleton contract.\n /// @param _singleton Singleton address.\n constructor(address _singleton) {\n require(_singleton != address(0), \"Invalid singleton address provided\");\n singleton = _singleton;\n }\n\n /// @dev Fallback function forwards all transactions and returns all received return data.\n fallback() external payable {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let _singleton := and(sload(0), 0xffffffffffffffffffffffffffffffffffffffff)\n // 0xa619486e == keccak(\"masterCopy()\"). The value is right padded to 32-bytes with 0s\n if eq(calldataload(0), 0xa619486e00000000000000000000000000000000000000000000000000000000) {\n mstore(0, _singleton)\n return(0, 0x20)\n }\n calldatacopy(0, 0, calldatasize())\n let success := delegatecall(gas(), _singleton, 0, calldatasize(), 0, 0)\n returndatacopy(0, 0, returndatasize())\n if eq(success, 0) {\n revert(0, returndatasize())\n }\n return(0, returndatasize())\n }\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"./GnosisSafeProxy.sol\";\nimport \"./IProxyCreationCallback.sol\";\n\n/// @title Proxy Factory - Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n/// @author Stefan George - \ncontract GnosisSafeProxyFactory {\n event ProxyCreation(GnosisSafeProxy proxy, address singleton);\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param singleton Address of singleton contract.\n /// @param data Payload for message call sent to new proxy contract.\n function createProxy(address singleton, bytes memory data) public returns (GnosisSafeProxy proxy) {\n proxy = new GnosisSafeProxy(singleton);\n if (data.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(data, 0x20), mload(data), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, singleton);\n }\n\n /// @dev Allows to retrieve the runtime code of a deployed Proxy. This can be used to check that the expected Proxy was deployed.\n function proxyRuntimeCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).runtimeCode;\n }\n\n /// @dev Allows to retrieve the creation code used for the Proxy deployment. With this it is easily possible to calculate predicted address.\n function proxyCreationCode() public pure returns (bytes memory) {\n return type(GnosisSafeProxy).creationCode;\n }\n\n /// @dev Allows to create new proxy contact using CREATE2 but it doesn't run the initializer.\n /// This method is only meant as an utility to be called from other methods\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function deployProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) internal returns (GnosisSafeProxy proxy) {\n // If the initializer changes the proxy address should change too. Hashing the initializer data is cheaper than just concatinating it\n bytes32 salt = keccak256(abi.encodePacked(keccak256(initializer), saltNonce));\n bytes memory deploymentData = abi.encodePacked(type(GnosisSafeProxy).creationCode, uint256(uint160(_singleton)));\n // solhint-disable-next-line no-inline-assembly\n assembly {\n proxy := create2(0x0, add(0x20, deploymentData), mload(deploymentData), salt)\n }\n require(address(proxy) != address(0), \"Create2 call failed\");\n }\n\n /// @dev Allows to create new proxy contact and execute a message call to the new proxy within one transaction.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function createProxyWithNonce(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n if (initializer.length > 0)\n // solhint-disable-next-line no-inline-assembly\n assembly {\n if eq(call(gas(), proxy, 0, add(initializer, 0x20), mload(initializer), 0, 0), 0) {\n revert(0, 0)\n }\n }\n emit ProxyCreation(proxy, _singleton);\n }\n\n /// @dev Allows to create new proxy contact, execute a message call to the new proxy and call a specified callback within one transaction\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n /// @param callback Callback that will be invoced after the new proxy contract has been successfully deployed and initialized.\n function createProxyWithCallback(\n address _singleton,\n bytes memory initializer,\n uint256 saltNonce,\n IProxyCreationCallback callback\n ) public returns (GnosisSafeProxy proxy) {\n uint256 saltNonceWithCallback = uint256(keccak256(abi.encodePacked(saltNonce, callback)));\n proxy = createProxyWithNonce(_singleton, initializer, saltNonceWithCallback);\n if (address(callback) != address(0)) callback.proxyCreated(proxy, _singleton, initializer, saltNonce);\n }\n\n /// @dev Allows to get the address for a new proxy contact created via `createProxyWithNonce`\n /// This method is only meant for address calculation purpose when you use an initializer that would revert,\n /// therefore the response is returned with a revert. When calling this method set `from` to the address of the proxy factory.\n /// @param _singleton Address of singleton contract.\n /// @param initializer Payload for message call sent to new proxy contract.\n /// @param saltNonce Nonce that will be used to generate the salt to calculate the address of the new proxy contract.\n function calculateCreateProxyWithNonceAddress(\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external returns (GnosisSafeProxy proxy) {\n proxy = deployProxyWithNonce(_singleton, initializer, saltNonce);\n revert(string(abi.encodePacked(proxy)));\n }\n}\n" + }, + "@gnosis.pm/safe-contracts/contracts/proxies/IProxyCreationCallback.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\nimport \"./GnosisSafeProxy.sol\";\n\ninterface IProxyCreationCallback {\n function proxyCreated(\n GnosisSafeProxy proxy,\n address _singleton,\n bytes calldata initializer,\n uint256 saltNonce\n ) external;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/core/Module.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Module Interface - A contract that can pass messages to a Module Manager contract if enabled by that contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"../interfaces/IAvatar.sol\";\nimport \"../factory/FactoryFriendly.sol\";\nimport \"../guard/Guardable.sol\";\n\nabstract contract Module is FactoryFriendly, Guardable {\n /// @dev Address that will ultimately execute function calls.\n address public avatar;\n /// @dev Address that this module will pass transactions to.\n address public target;\n\n /// @dev Emitted each time the avatar is set.\n event AvatarSet(address indexed previousAvatar, address indexed newAvatar);\n /// @dev Emitted each time the Target is set.\n event TargetSet(address indexed previousTarget, address indexed newTarget);\n\n /// @dev Sets the avatar to a new avatar (`newAvatar`).\n /// @notice Can only be called by the current owner.\n function setAvatar(address _avatar) public onlyOwner {\n address previousAvatar = avatar;\n avatar = _avatar;\n emit AvatarSet(previousAvatar, _avatar);\n }\n\n /// @dev Sets the target to a new target (`newTarget`).\n /// @notice Can only be called by the current owner.\n function setTarget(address _target) public onlyOwner {\n address previousTarget = target;\n target = _target;\n emit TargetSet(previousTarget, _target);\n }\n\n /// @dev Passes a transaction to be executed by the avatar.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function exec(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n success = IAvatar(target).execTransactionFromModule(\n to,\n value,\n data,\n operation\n );\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return success;\n }\n\n /// @dev Passes a transaction to be executed by the target and returns data.\n /// @notice Can only be called by this contract.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execAndReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) internal returns (bool success, bytes memory returnData) {\n /// Check if a transactioon guard is enabled.\n if (guard != address(0)) {\n IGuard(guard).checkTransaction(\n /// Transaction info used by module transactions.\n to,\n value,\n data,\n operation,\n /// Zero out the redundant transaction information only used for Safe multisig transctions.\n 0,\n 0,\n 0,\n address(0),\n payable(0),\n bytes(\"0x\"),\n msg.sender\n );\n }\n (success, returnData) = IAvatar(target)\n .execTransactionFromModuleReturnData(to, value, data, operation);\n if (guard != address(0)) {\n IGuard(guard).checkAfterExecution(bytes32(\"0x\"), success);\n }\n return (success, returnData);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac FactoryFriendly - A contract that allows other contracts to be initializable and pass bytes as arguments to define contract state\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\nabstract contract FactoryFriendly is OwnableUpgradeable {\n function setUp(bytes memory initializeParams) public virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.8.0;\n\ncontract ModuleProxyFactory {\n event ModuleProxyCreation(\n address indexed proxy,\n address indexed masterCopy\n );\n\n /// `target` can not be zero.\n error ZeroAddress(address target);\n\n /// `address_` is already taken.\n error TakenAddress(address address_);\n\n /// @notice Initialization failed.\n error FailedInitialization();\n\n function createProxy(address target, bytes32 salt)\n internal\n returns (address result)\n {\n if (address(target) == address(0)) revert ZeroAddress(target);\n bytes memory deployment = abi.encodePacked(\n hex\"602d8060093d393df3363d3d373d3d3d363d73\",\n target,\n hex\"5af43d82803e903d91602b57fd5bf3\"\n );\n // solhint-disable-next-line no-inline-assembly\n assembly {\n result := create2(0, add(deployment, 0x20), mload(deployment), salt)\n }\n if (result == address(0)) revert TakenAddress(result);\n }\n\n function deployModule(\n address masterCopy,\n bytes memory initializer,\n uint256 saltNonce\n ) public returns (address proxy) {\n proxy = createProxy(\n masterCopy,\n keccak256(abi.encodePacked(keccak256(initializer), saltNonce))\n );\n (bool success, ) = proxy.call(initializer);\n if (!success) revert FailedInitialization();\n\n emit ModuleProxyCreation(proxy, masterCopy);\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport \"../interfaces/IGuard.sol\";\n\nabstract contract BaseGuard is IERC165 {\n function supportsInterface(bytes4 interfaceId)\n external\n pure\n override\n returns (bool)\n {\n return\n interfaceId == type(IGuard).interfaceId || // 0xe6d7a83a\n interfaceId == type(IERC165).interfaceId; // 0x01ffc9a7\n }\n\n /// @dev Module transactions only use the first four parameters: to, value, data, and operation.\n /// Module.sol hardcodes the remaining parameters as 0 since they are not used for module transactions.\n /// @notice This interface is used to maintain compatibilty with Gnosis Safe transaction guards.\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external virtual;\n\n function checkAfterExecution(bytes32 txHash, bool success) external virtual;\n}\n" + }, + "@gnosis.pm/zodiac/contracts/guard/Guardable.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"./BaseGuard.sol\";\n\n/// @title Guardable - A contract that manages fallback calls made to this contract\ncontract Guardable is OwnableUpgradeable {\n address public guard;\n\n event ChangedGuard(address guard);\n\n /// `guard_` does not implement IERC165.\n error NotIERC165Compliant(address guard_);\n\n /// @dev Set a guard that checks transactions before execution.\n /// @param _guard The address of the guard to be used or the 0 address to disable the guard.\n function setGuard(address _guard) external onlyOwner {\n if (_guard != address(0)) {\n if (!BaseGuard(_guard).supportsInterface(type(IGuard).interfaceId))\n revert NotIERC165Compliant(_guard);\n }\n guard = _guard;\n emit ChangedGuard(guard);\n }\n\n function getGuard() external view returns (address _guard) {\n return guard;\n }\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\n\n/// @title Zodiac Avatar - A contract that manages modules that can execute transactions via this contract.\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IAvatar {\n event EnabledModule(address module);\n event DisabledModule(address module);\n event ExecutionFromModuleSuccess(address indexed module);\n event ExecutionFromModuleFailure(address indexed module);\n\n /// @dev Enables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Modules should be stored as a linked list.\n /// @notice Must emit EnabledModule(address module) if successful.\n /// @param module Module to be enabled.\n function enableModule(address module) external;\n\n /// @dev Disables a module on the avatar.\n /// @notice Can only be called by the avatar.\n /// @notice Must emit DisabledModule(address module) if successful.\n /// @param prevModule Address that pointed to the module to be removed in the linked list\n /// @param module Module to be removed.\n function disableModule(address prevModule, address module) external;\n\n /// @dev Allows a Module to execute a transaction.\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModule(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success);\n\n /// @dev Allows a Module to execute a transaction and return data\n /// @notice Can only be called by an enabled module.\n /// @notice Must emit ExecutionFromModuleSuccess(address module) if successful.\n /// @notice Must emit ExecutionFromModuleFailure(address module) if unsuccessful.\n /// @param to Destination address of module transaction.\n /// @param value Ether value of module transaction.\n /// @param data Data payload of module transaction.\n /// @param operation Operation type of module transaction: 0 == call, 1 == delegate call.\n function execTransactionFromModuleReturnData(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation\n ) external returns (bool success, bytes memory returnData);\n\n /// @dev Returns if an module is enabled\n /// @return True if the module is enabled\n function isModuleEnabled(address module) external view returns (bool);\n\n /// @dev Returns array of modules.\n /// @param start Start of the page.\n /// @param pageSize Maximum number of modules that should be returned.\n /// @return array Array of modules.\n /// @return next Start of the next page.\n function getModulesPaginated(address start, uint256 pageSize)\n external\n view\n returns (address[] memory array, address next);\n}\n" + }, + "@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity >=0.7.0 <0.9.0;\n\nimport \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\ninterface IGuard {\n function checkTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n address msgSender\n ) external;\n\n function checkAfterExecution(bytes32 txHash, bool success) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev 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 account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\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 OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\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() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC20Snapshot.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/ArraysUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This contract extends an ERC20 token with a snapshot mechanism. When a snapshot is created, the balances and\n * total supply at the time are recorded for later access.\n *\n * This can be used to safely create mechanisms based on token balances such as trustless dividends or weighted voting.\n * In naive implementations it's possible to perform a \"double spend\" attack by reusing the same balance from different\n * accounts. By using snapshots to calculate dividends or voting power, those attacks no longer apply. It can also be\n * used to create an efficient ERC20 forking mechanism.\n *\n * Snapshots are created by the internal {_snapshot} function, which will emit the {Snapshot} event and return a\n * snapshot id. To get the total supply at the time of a snapshot, call the function {totalSupplyAt} with the snapshot\n * id. To get the balance of an account at the time of a snapshot, call the {balanceOfAt} function with the snapshot id\n * and the account address.\n *\n * NOTE: Snapshot policy can be customized by overriding the {_getCurrentSnapshotId} method. For example, having it\n * return `block.number` will trigger the creation of snapshot at the beginning of each new block. When overriding this\n * function, be careful about the monotonicity of its result. Non-monotonic snapshot ids will break the contract.\n *\n * Implementing snapshots for every block using this method will incur significant gas costs. For a gas-efficient\n * alternative consider {ERC20Votes}.\n *\n * ==== Gas Costs\n *\n * Snapshots are efficient. Snapshot creation is _O(1)_. Retrieval of balances or total supply from a snapshot is _O(log\n * n)_ in the number of snapshots that have been created, although _n_ for a specific account will generally be much\n * smaller since identical balances in subsequent snapshots are stored as a single entry.\n *\n * There is a constant overhead for normal ERC20 transfers due to the additional snapshot bookkeeping. This overhead is\n * only significant for the first transfer that immediately follows a snapshot for a particular account. Subsequent\n * transfers will have normal cost until the next snapshot, and so on.\n */\n\nabstract contract ERC20SnapshotUpgradeable is Initializable, ERC20Upgradeable {\n function __ERC20Snapshot_init() internal onlyInitializing {\n }\n\n function __ERC20Snapshot_init_unchained() internal onlyInitializing {\n }\n // Inspired by Jordi Baylina's MiniMeToken to record historical balances:\n // https://github.com/Giveth/minime/blob/ea04d950eea153a04c51fa510b068b9dded390cb/contracts/MiniMeToken.sol\n\n using ArraysUpgradeable for uint256[];\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n // Snapshotted values have arrays of ids and the value corresponding to that id. These could be an array of a\n // Snapshot struct, but that would impede usage of functions that work on an array.\n struct Snapshots {\n uint256[] ids;\n uint256[] values;\n }\n\n mapping(address => Snapshots) private _accountBalanceSnapshots;\n Snapshots private _totalSupplySnapshots;\n\n // Snapshot ids increase monotonically, with the first value being 1. An id of 0 is invalid.\n CountersUpgradeable.Counter private _currentSnapshotId;\n\n /**\n * @dev Emitted by {_snapshot} when a snapshot identified by `id` is created.\n */\n event Snapshot(uint256 id);\n\n /**\n * @dev Creates a new snapshot and returns its snapshot id.\n *\n * Emits a {Snapshot} event that contains the same id.\n *\n * {_snapshot} is `internal` and you have to decide how to expose it externally. Its usage may be restricted to a\n * set of accounts, for example using {AccessControl}, or it may be open to the public.\n *\n * [WARNING]\n * ====\n * While an open way of calling {_snapshot} is required for certain trust minimization mechanisms such as forking,\n * you must consider that it can potentially be used by attackers in two ways.\n *\n * First, it can be used to increase the cost of retrieval of values from snapshots, although it will grow\n * logarithmically thus rendering this attack ineffective in the long term. Second, it can be used to target\n * specific accounts and increase the cost of ERC20 transfers for them, in the ways specified in the Gas Costs\n * section above.\n *\n * We haven't measured the actual numbers; if this is something you're interested in please reach out to us.\n * ====\n */\n function _snapshot() internal virtual returns (uint256) {\n _currentSnapshotId.increment();\n\n uint256 currentId = _getCurrentSnapshotId();\n emit Snapshot(currentId);\n return currentId;\n }\n\n /**\n * @dev Get the current snapshotId\n */\n function _getCurrentSnapshotId() internal view virtual returns (uint256) {\n return _currentSnapshotId.current();\n }\n\n /**\n * @dev Retrieves the balance of `account` at the time `snapshotId` was created.\n */\n function balanceOfAt(address account, uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _accountBalanceSnapshots[account]);\n\n return snapshotted ? value : balanceOf(account);\n }\n\n /**\n * @dev Retrieves the total supply at the time `snapshotId` was created.\n */\n function totalSupplyAt(uint256 snapshotId) public view virtual returns (uint256) {\n (bool snapshotted, uint256 value) = _valueAt(snapshotId, _totalSupplySnapshots);\n\n return snapshotted ? value : totalSupply();\n }\n\n // Update balance and/or total supply snapshots before the values are modified. This is implemented\n // in the _beforeTokenTransfer hook, which is executed for _mint, _burn, and _transfer operations.\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n if (from == address(0)) {\n // mint\n _updateAccountSnapshot(to);\n _updateTotalSupplySnapshot();\n } else if (to == address(0)) {\n // burn\n _updateAccountSnapshot(from);\n _updateTotalSupplySnapshot();\n } else {\n // transfer\n _updateAccountSnapshot(from);\n _updateAccountSnapshot(to);\n }\n }\n\n function _valueAt(uint256 snapshotId, Snapshots storage snapshots) private view returns (bool, uint256) {\n require(snapshotId > 0, \"ERC20Snapshot: id is 0\");\n require(snapshotId <= _getCurrentSnapshotId(), \"ERC20Snapshot: nonexistent id\");\n\n // When a valid snapshot is queried, there are three possibilities:\n // a) The queried value was not modified after the snapshot was taken. Therefore, a snapshot entry was never\n // created for this id, and all stored snapshot ids are smaller than the requested one. The value that corresponds\n // to this id is the current one.\n // b) The queried value was modified after the snapshot was taken. Therefore, there will be an entry with the\n // requested id, and its value is the one to return.\n // c) More snapshots were created after the requested one, and the queried value was later modified. There will be\n // no entry for the requested id: the value that corresponds to it is that of the smallest snapshot id that is\n // larger than the requested one.\n //\n // In summary, we need to find an element in an array, returning the index of the smallest value that is larger if\n // it is not found, unless said value doesn't exist (e.g. when all values are smaller). Arrays.findUpperBound does\n // exactly this.\n\n uint256 index = snapshots.ids.findUpperBound(snapshotId);\n\n if (index == snapshots.ids.length) {\n return (false, 0);\n } else {\n return (true, snapshots.values[index]);\n }\n }\n\n function _updateAccountSnapshot(address account) private {\n _updateSnapshot(_accountBalanceSnapshots[account], balanceOf(account));\n }\n\n function _updateTotalSupplySnapshot() private {\n _updateSnapshot(_totalSupplySnapshots, totalSupply());\n }\n\n function _updateSnapshot(Snapshots storage snapshots, uint256 currentValue) private {\n uint256 currentId = _getCurrentSnapshotId();\n if (_lastSnapshotId(snapshots.ids) < currentId) {\n snapshots.ids.push(currentId);\n snapshots.values.push(currentValue);\n }\n }\n\n function _lastSnapshotId(uint256[] storage ids) private view returns (uint256) {\n if (ids.length == 0) {\n return 0;\n } else {\n return ids[ids.length - 1];\n }\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Votes.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-ERC20PermitUpgradeable.sol\";\nimport \"../../../utils/math/MathUpgradeable.sol\";\nimport \"../../../governance/utils/IVotesUpgradeable.sol\";\nimport \"../../../utils/math/SafeCastUpgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's,\n * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1.\n *\n * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module.\n *\n * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either\n * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting\n * power can be queried through the public accessors {getVotes} and {getPastVotes}.\n *\n * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it\n * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked.\n *\n * _Available since v4.2._\n */\nabstract contract ERC20VotesUpgradeable is Initializable, IVotesUpgradeable, ERC20PermitUpgradeable {\n function __ERC20Votes_init() internal onlyInitializing {\n }\n\n function __ERC20Votes_init_unchained() internal onlyInitializing {\n }\n struct Checkpoint {\n uint32 fromBlock;\n uint224 votes;\n }\n\n bytes32 private constant _DELEGATION_TYPEHASH =\n keccak256(\"Delegation(address delegatee,uint256 nonce,uint256 expiry)\");\n\n mapping(address => address) private _delegates;\n mapping(address => Checkpoint[]) private _checkpoints;\n Checkpoint[] private _totalSupplyCheckpoints;\n\n /**\n * @dev Get the `pos`-th checkpoint for `account`.\n */\n function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) {\n return _checkpoints[account][pos];\n }\n\n /**\n * @dev Get number of checkpoints for `account`.\n */\n function numCheckpoints(address account) public view virtual returns (uint32) {\n return SafeCastUpgradeable.toUint32(_checkpoints[account].length);\n }\n\n /**\n * @dev Get the address `account` is currently delegating to.\n */\n function delegates(address account) public view virtual override returns (address) {\n return _delegates[account];\n }\n\n /**\n * @dev Gets the current votes balance for `account`\n */\n function getVotes(address account) public view virtual override returns (uint256) {\n uint256 pos = _checkpoints[account].length;\n return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes;\n }\n\n /**\n * @dev Retrieve the number of votes for `account` at the end of `blockNumber`.\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_checkpoints[account], blockNumber);\n }\n\n /**\n * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances.\n * It is but NOT the sum of all the delegated votes!\n *\n * Requirements:\n *\n * - `blockNumber` must have been already mined\n */\n function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) {\n require(blockNumber < block.number, \"ERC20Votes: block not yet mined\");\n return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber);\n }\n\n /**\n * @dev Lookup a value in a list of (sorted) checkpoints.\n */\n function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) {\n // We run a binary search to look for the earliest checkpoint taken after `blockNumber`.\n //\n // During the loop, the index of the wanted checkpoint remains in the range [low-1, high).\n // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant.\n // - If the middle checkpoint is after `blockNumber`, we look in [low, mid)\n // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high)\n // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not\n // out of bounds (in which case we're looking too far in the past and the result is 0).\n // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is\n // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out\n // the same.\n uint256 high = ckpts.length;\n uint256 low = 0;\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n if (ckpts[mid].fromBlock > blockNumber) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n return high == 0 ? 0 : ckpts[high - 1].votes;\n }\n\n /**\n * @dev Delegate votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) public virtual override {\n _delegate(_msgSender(), delegatee);\n }\n\n /**\n * @dev Delegates votes from signer to `delegatee`\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= expiry, \"ERC20Votes: signature expired\");\n address signer = ECDSAUpgradeable.recover(\n _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))),\n v,\n r,\n s\n );\n require(nonce == _useNonce(signer), \"ERC20Votes: invalid nonce\");\n _delegate(signer, delegatee);\n }\n\n /**\n * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1).\n */\n function _maxSupply() internal view virtual returns (uint224) {\n return type(uint224).max;\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been increased.\n */\n function _mint(address account, uint256 amount) internal virtual override {\n super._mint(account, amount);\n require(totalSupply() <= _maxSupply(), \"ERC20Votes: total supply risks overflowing votes\");\n\n _writeCheckpoint(_totalSupplyCheckpoints, _add, amount);\n }\n\n /**\n * @dev Snapshots the totalSupply after it has been decreased.\n */\n function _burn(address account, uint256 amount) internal virtual override {\n super._burn(account, amount);\n\n _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount);\n }\n\n /**\n * @dev Move voting power when tokens are transferred.\n *\n * Emits a {DelegateVotesChanged} event.\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._afterTokenTransfer(from, to, amount);\n\n _moveVotingPower(delegates(from), delegates(to), amount);\n }\n\n /**\n * @dev Change delegation for `delegator` to `delegatee`.\n *\n * Emits events {DelegateChanged} and {DelegateVotesChanged}.\n */\n function _delegate(address delegator, address delegatee) internal virtual {\n address currentDelegate = delegates(delegator);\n uint256 delegatorBalance = balanceOf(delegator);\n _delegates[delegator] = delegatee;\n\n emit DelegateChanged(delegator, currentDelegate, delegatee);\n\n _moveVotingPower(currentDelegate, delegatee, delegatorBalance);\n }\n\n function _moveVotingPower(\n address src,\n address dst,\n uint256 amount\n ) private {\n if (src != dst && amount > 0) {\n if (src != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount);\n emit DelegateVotesChanged(src, oldWeight, newWeight);\n }\n\n if (dst != address(0)) {\n (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount);\n emit DelegateVotesChanged(dst, oldWeight, newWeight);\n }\n }\n }\n\n function _writeCheckpoint(\n Checkpoint[] storage ckpts,\n function(uint256, uint256) view returns (uint256) op,\n uint256 delta\n ) private returns (uint256 oldWeight, uint256 newWeight) {\n uint256 pos = ckpts.length;\n oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes;\n newWeight = op(oldWeight, delta);\n\n if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) {\n ckpts[pos - 1].votes = SafeCastUpgradeable.toUint224(newWeight);\n } else {\n ckpts.push(Checkpoint({fromBlock: SafeCastUpgradeable.toUint32(block.number), votes: SafeCastUpgradeable.toUint224(newWeight)}));\n }\n }\n\n function _add(uint256 a, uint256 b) private pure returns (uint256) {\n return a + b;\n }\n\n function _subtract(uint256 a, uint256 b) private pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[47] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/ERC20Wrapper.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20Upgradeable.sol\";\nimport \"../utils/SafeERC20Upgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of the ERC20 token contract to support token wrapping.\n *\n * Users can deposit and withdraw \"underlying tokens\" and receive a matching number of \"wrapped tokens\". This is useful\n * in conjunction with other modules. For example, combining this wrapping mechanism with {ERC20Votes} will allow the\n * wrapping of an existing \"basic\" ERC20 into a governance token.\n *\n * _Available since v4.2._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20WrapperUpgradeable is Initializable, ERC20Upgradeable {\n IERC20Upgradeable public underlying;\n\n function __ERC20Wrapper_init(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n __ERC20Wrapper_init_unchained(underlyingToken);\n }\n\n function __ERC20Wrapper_init_unchained(IERC20Upgradeable underlyingToken) internal onlyInitializing {\n underlying = underlyingToken;\n }\n\n /**\n * @dev See {ERC20-decimals}.\n */\n function decimals() public view virtual override returns (uint8) {\n try IERC20MetadataUpgradeable(address(underlying)).decimals() returns (uint8 value) {\n return value;\n } catch {\n return super.decimals();\n }\n }\n\n /**\n * @dev Allow a user to deposit underlying tokens and mint the corresponding number of wrapped tokens.\n */\n function depositFor(address account, uint256 amount) public virtual returns (bool) {\n SafeERC20Upgradeable.safeTransferFrom(underlying, _msgSender(), address(this), amount);\n _mint(account, amount);\n return true;\n }\n\n /**\n * @dev Allow a user to burn a number of wrapped tokens and withdraw the corresponding number of underlying tokens.\n */\n function withdrawTo(address account, uint256 amount) public virtual returns (bool) {\n _burn(_msgSender(), amount);\n SafeERC20Upgradeable.safeTransfer(underlying, account, amount);\n return true;\n }\n\n /**\n * @dev Mint wrapped token to cover any underlyingTokens that would have been transferred by mistake. Internal\n * function that can be exposed with access control if desired.\n */\n function _recover(address account) internal virtual returns (uint256) {\n uint256 value = underlying.balanceOf(address(this)) - totalSupply();\n _mint(account, value);\n return value;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\nimport \"../extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"../../../utils/AddressUpgradeable.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20Upgradeable {\n using AddressUpgradeable for address;\n\n function safeTransfer(\n IERC20Upgradeable token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20Upgradeable token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20Upgradeable token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20PermitUpgradeable token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ArraysUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Arrays.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev Collection of functions related to array types.\n */\nlibrary ArraysUpgradeable {\n /**\n * @dev Searches a sorted `array` and returns the first index that contains\n * a value greater or equal to `element`. If no such index exists (i.e. all\n * values in the array are strictly less than `element`), the array length is\n * returned. Time complexity O(log n).\n *\n * `array` is expected to be sorted in ascending order, and to contain no\n * repeated elements.\n */\n function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {\n if (array.length == 0) {\n return 0;\n }\n\n uint256 low = 0;\n uint256 high = array.length;\n\n while (low < high) {\n uint256 mid = MathUpgradeable.average(low, high);\n\n // Note that mid will always be strictly less than high (i.e. it will be a valid array index)\n // because Math.average rounds down (it does integer division with truncation).\n if (array[mid] > element) {\n high = mid;\n } else {\n low = mid + 1;\n }\n }\n\n // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.\n if (low > 0 && array[low - 1] == element) {\n return low - 1;\n } else {\n return low;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/SafeCast.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCastUpgradeable {\n /**\n * @dev Returns the downcasted uint248 from uint256, reverting on\n * overflow (when the input is greater than largest uint248).\n *\n * Counterpart to Solidity's `uint248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toUint248(uint256 value) internal pure returns (uint248) {\n require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return uint248(value);\n }\n\n /**\n * @dev Returns the downcasted uint240 from uint256, reverting on\n * overflow (when the input is greater than largest uint240).\n *\n * Counterpart to Solidity's `uint240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toUint240(uint256 value) internal pure returns (uint240) {\n require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return uint240(value);\n }\n\n /**\n * @dev Returns the downcasted uint232 from uint256, reverting on\n * overflow (when the input is greater than largest uint232).\n *\n * Counterpart to Solidity's `uint232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toUint232(uint256 value) internal pure returns (uint232) {\n require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return uint232(value);\n }\n\n /**\n * @dev Returns the downcasted uint224 from uint256, reverting on\n * overflow (when the input is greater than largest uint224).\n *\n * Counterpart to Solidity's `uint224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.2._\n */\n function toUint224(uint256 value) internal pure returns (uint224) {\n require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return uint224(value);\n }\n\n /**\n * @dev Returns the downcasted uint216 from uint256, reverting on\n * overflow (when the input is greater than largest uint216).\n *\n * Counterpart to Solidity's `uint216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toUint216(uint256 value) internal pure returns (uint216) {\n require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return uint216(value);\n }\n\n /**\n * @dev Returns the downcasted uint208 from uint256, reverting on\n * overflow (when the input is greater than largest uint208).\n *\n * Counterpart to Solidity's `uint208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toUint208(uint256 value) internal pure returns (uint208) {\n require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return uint208(value);\n }\n\n /**\n * @dev Returns the downcasted uint200 from uint256, reverting on\n * overflow (when the input is greater than largest uint200).\n *\n * Counterpart to Solidity's `uint200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toUint200(uint256 value) internal pure returns (uint200) {\n require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return uint200(value);\n }\n\n /**\n * @dev Returns the downcasted uint192 from uint256, reverting on\n * overflow (when the input is greater than largest uint192).\n *\n * Counterpart to Solidity's `uint192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toUint192(uint256 value) internal pure returns (uint192) {\n require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return uint192(value);\n }\n\n /**\n * @dev Returns the downcasted uint184 from uint256, reverting on\n * overflow (when the input is greater than largest uint184).\n *\n * Counterpart to Solidity's `uint184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toUint184(uint256 value) internal pure returns (uint184) {\n require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return uint184(value);\n }\n\n /**\n * @dev Returns the downcasted uint176 from uint256, reverting on\n * overflow (when the input is greater than largest uint176).\n *\n * Counterpart to Solidity's `uint176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toUint176(uint256 value) internal pure returns (uint176) {\n require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return uint176(value);\n }\n\n /**\n * @dev Returns the downcasted uint168 from uint256, reverting on\n * overflow (when the input is greater than largest uint168).\n *\n * Counterpart to Solidity's `uint168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toUint168(uint256 value) internal pure returns (uint168) {\n require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return uint168(value);\n }\n\n /**\n * @dev Returns the downcasted uint160 from uint256, reverting on\n * overflow (when the input is greater than largest uint160).\n *\n * Counterpart to Solidity's `uint160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toUint160(uint256 value) internal pure returns (uint160) {\n require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return uint160(value);\n }\n\n /**\n * @dev Returns the downcasted uint152 from uint256, reverting on\n * overflow (when the input is greater than largest uint152).\n *\n * Counterpart to Solidity's `uint152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toUint152(uint256 value) internal pure returns (uint152) {\n require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return uint152(value);\n }\n\n /**\n * @dev Returns the downcasted uint144 from uint256, reverting on\n * overflow (when the input is greater than largest uint144).\n *\n * Counterpart to Solidity's `uint144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toUint144(uint256 value) internal pure returns (uint144) {\n require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return uint144(value);\n }\n\n /**\n * @dev Returns the downcasted uint136 from uint256, reverting on\n * overflow (when the input is greater than largest uint136).\n *\n * Counterpart to Solidity's `uint136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toUint136(uint256 value) internal pure returns (uint136) {\n require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return uint136(value);\n }\n\n /**\n * @dev Returns the downcasted uint128 from uint256, reverting on\n * overflow (when the input is greater than largest uint128).\n *\n * Counterpart to Solidity's `uint128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v2.5._\n */\n function toUint128(uint256 value) internal pure returns (uint128) {\n require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return uint128(value);\n }\n\n /**\n * @dev Returns the downcasted uint120 from uint256, reverting on\n * overflow (when the input is greater than largest uint120).\n *\n * Counterpart to Solidity's `uint120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toUint120(uint256 value) internal pure returns (uint120) {\n require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return uint120(value);\n }\n\n /**\n * @dev Returns the downcasted uint112 from uint256, reverting on\n * overflow (when the input is greater than largest uint112).\n *\n * Counterpart to Solidity's `uint112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toUint112(uint256 value) internal pure returns (uint112) {\n require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return uint112(value);\n }\n\n /**\n * @dev Returns the downcasted uint104 from uint256, reverting on\n * overflow (when the input is greater than largest uint104).\n *\n * Counterpart to Solidity's `uint104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toUint104(uint256 value) internal pure returns (uint104) {\n require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return uint104(value);\n }\n\n /**\n * @dev Returns the downcasted uint96 from uint256, reverting on\n * overflow (when the input is greater than largest uint96).\n *\n * Counterpart to Solidity's `uint96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.2._\n */\n function toUint96(uint256 value) internal pure returns (uint96) {\n require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return uint96(value);\n }\n\n /**\n * @dev Returns the downcasted uint88 from uint256, reverting on\n * overflow (when the input is greater than largest uint88).\n *\n * Counterpart to Solidity's `uint88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toUint88(uint256 value) internal pure returns (uint88) {\n require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return uint88(value);\n }\n\n /**\n * @dev Returns the downcasted uint80 from uint256, reverting on\n * overflow (when the input is greater than largest uint80).\n *\n * Counterpart to Solidity's `uint80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toUint80(uint256 value) internal pure returns (uint80) {\n require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return uint80(value);\n }\n\n /**\n * @dev Returns the downcasted uint72 from uint256, reverting on\n * overflow (when the input is greater than largest uint72).\n *\n * Counterpart to Solidity's `uint72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toUint72(uint256 value) internal pure returns (uint72) {\n require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return uint72(value);\n }\n\n /**\n * @dev Returns the downcasted uint64 from uint256, reverting on\n * overflow (when the input is greater than largest uint64).\n *\n * Counterpart to Solidity's `uint64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v2.5._\n */\n function toUint64(uint256 value) internal pure returns (uint64) {\n require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return uint64(value);\n }\n\n /**\n * @dev Returns the downcasted uint56 from uint256, reverting on\n * overflow (when the input is greater than largest uint56).\n *\n * Counterpart to Solidity's `uint56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toUint56(uint256 value) internal pure returns (uint56) {\n require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return uint56(value);\n }\n\n /**\n * @dev Returns the downcasted uint48 from uint256, reverting on\n * overflow (when the input is greater than largest uint48).\n *\n * Counterpart to Solidity's `uint48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toUint48(uint256 value) internal pure returns (uint48) {\n require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return uint48(value);\n }\n\n /**\n * @dev Returns the downcasted uint40 from uint256, reverting on\n * overflow (when the input is greater than largest uint40).\n *\n * Counterpart to Solidity's `uint40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toUint40(uint256 value) internal pure returns (uint40) {\n require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return uint40(value);\n }\n\n /**\n * @dev Returns the downcasted uint32 from uint256, reverting on\n * overflow (when the input is greater than largest uint32).\n *\n * Counterpart to Solidity's `uint32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v2.5._\n */\n function toUint32(uint256 value) internal pure returns (uint32) {\n require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return uint32(value);\n }\n\n /**\n * @dev Returns the downcasted uint24 from uint256, reverting on\n * overflow (when the input is greater than largest uint24).\n *\n * Counterpart to Solidity's `uint24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toUint24(uint256 value) internal pure returns (uint24) {\n require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return uint24(value);\n }\n\n /**\n * @dev Returns the downcasted uint16 from uint256, reverting on\n * overflow (when the input is greater than largest uint16).\n *\n * Counterpart to Solidity's `uint16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v2.5._\n */\n function toUint16(uint256 value) internal pure returns (uint16) {\n require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return uint16(value);\n }\n\n /**\n * @dev Returns the downcasted uint8 from uint256, reverting on\n * overflow (when the input is greater than largest uint8).\n *\n * Counterpart to Solidity's `uint8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v2.5._\n */\n function toUint8(uint256 value) internal pure returns (uint8) {\n require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return uint8(value);\n }\n\n /**\n * @dev Converts a signed int256 into an unsigned uint256.\n *\n * Requirements:\n *\n * - input must be greater than or equal to 0.\n *\n * _Available since v3.0._\n */\n function toUint256(int256 value) internal pure returns (uint256) {\n require(value >= 0, \"SafeCast: value must be positive\");\n return uint256(value);\n }\n\n /**\n * @dev Returns the downcasted int248 from int256, reverting on\n * overflow (when the input is less than smallest int248 or\n * greater than largest int248).\n *\n * Counterpart to Solidity's `int248` operator.\n *\n * Requirements:\n *\n * - input must fit into 248 bits\n *\n * _Available since v4.7._\n */\n function toInt248(int256 value) internal pure returns (int248) {\n require(value >= type(int248).min && value <= type(int248).max, \"SafeCast: value doesn't fit in 248 bits\");\n return int248(value);\n }\n\n /**\n * @dev Returns the downcasted int240 from int256, reverting on\n * overflow (when the input is less than smallest int240 or\n * greater than largest int240).\n *\n * Counterpart to Solidity's `int240` operator.\n *\n * Requirements:\n *\n * - input must fit into 240 bits\n *\n * _Available since v4.7._\n */\n function toInt240(int256 value) internal pure returns (int240) {\n require(value >= type(int240).min && value <= type(int240).max, \"SafeCast: value doesn't fit in 240 bits\");\n return int240(value);\n }\n\n /**\n * @dev Returns the downcasted int232 from int256, reverting on\n * overflow (when the input is less than smallest int232 or\n * greater than largest int232).\n *\n * Counterpart to Solidity's `int232` operator.\n *\n * Requirements:\n *\n * - input must fit into 232 bits\n *\n * _Available since v4.7._\n */\n function toInt232(int256 value) internal pure returns (int232) {\n require(value >= type(int232).min && value <= type(int232).max, \"SafeCast: value doesn't fit in 232 bits\");\n return int232(value);\n }\n\n /**\n * @dev Returns the downcasted int224 from int256, reverting on\n * overflow (when the input is less than smallest int224 or\n * greater than largest int224).\n *\n * Counterpart to Solidity's `int224` operator.\n *\n * Requirements:\n *\n * - input must fit into 224 bits\n *\n * _Available since v4.7._\n */\n function toInt224(int256 value) internal pure returns (int224) {\n require(value >= type(int224).min && value <= type(int224).max, \"SafeCast: value doesn't fit in 224 bits\");\n return int224(value);\n }\n\n /**\n * @dev Returns the downcasted int216 from int256, reverting on\n * overflow (when the input is less than smallest int216 or\n * greater than largest int216).\n *\n * Counterpart to Solidity's `int216` operator.\n *\n * Requirements:\n *\n * - input must fit into 216 bits\n *\n * _Available since v4.7._\n */\n function toInt216(int256 value) internal pure returns (int216) {\n require(value >= type(int216).min && value <= type(int216).max, \"SafeCast: value doesn't fit in 216 bits\");\n return int216(value);\n }\n\n /**\n * @dev Returns the downcasted int208 from int256, reverting on\n * overflow (when the input is less than smallest int208 or\n * greater than largest int208).\n *\n * Counterpart to Solidity's `int208` operator.\n *\n * Requirements:\n *\n * - input must fit into 208 bits\n *\n * _Available since v4.7._\n */\n function toInt208(int256 value) internal pure returns (int208) {\n require(value >= type(int208).min && value <= type(int208).max, \"SafeCast: value doesn't fit in 208 bits\");\n return int208(value);\n }\n\n /**\n * @dev Returns the downcasted int200 from int256, reverting on\n * overflow (when the input is less than smallest int200 or\n * greater than largest int200).\n *\n * Counterpart to Solidity's `int200` operator.\n *\n * Requirements:\n *\n * - input must fit into 200 bits\n *\n * _Available since v4.7._\n */\n function toInt200(int256 value) internal pure returns (int200) {\n require(value >= type(int200).min && value <= type(int200).max, \"SafeCast: value doesn't fit in 200 bits\");\n return int200(value);\n }\n\n /**\n * @dev Returns the downcasted int192 from int256, reverting on\n * overflow (when the input is less than smallest int192 or\n * greater than largest int192).\n *\n * Counterpart to Solidity's `int192` operator.\n *\n * Requirements:\n *\n * - input must fit into 192 bits\n *\n * _Available since v4.7._\n */\n function toInt192(int256 value) internal pure returns (int192) {\n require(value >= type(int192).min && value <= type(int192).max, \"SafeCast: value doesn't fit in 192 bits\");\n return int192(value);\n }\n\n /**\n * @dev Returns the downcasted int184 from int256, reverting on\n * overflow (when the input is less than smallest int184 or\n * greater than largest int184).\n *\n * Counterpart to Solidity's `int184` operator.\n *\n * Requirements:\n *\n * - input must fit into 184 bits\n *\n * _Available since v4.7._\n */\n function toInt184(int256 value) internal pure returns (int184) {\n require(value >= type(int184).min && value <= type(int184).max, \"SafeCast: value doesn't fit in 184 bits\");\n return int184(value);\n }\n\n /**\n * @dev Returns the downcasted int176 from int256, reverting on\n * overflow (when the input is less than smallest int176 or\n * greater than largest int176).\n *\n * Counterpart to Solidity's `int176` operator.\n *\n * Requirements:\n *\n * - input must fit into 176 bits\n *\n * _Available since v4.7._\n */\n function toInt176(int256 value) internal pure returns (int176) {\n require(value >= type(int176).min && value <= type(int176).max, \"SafeCast: value doesn't fit in 176 bits\");\n return int176(value);\n }\n\n /**\n * @dev Returns the downcasted int168 from int256, reverting on\n * overflow (when the input is less than smallest int168 or\n * greater than largest int168).\n *\n * Counterpart to Solidity's `int168` operator.\n *\n * Requirements:\n *\n * - input must fit into 168 bits\n *\n * _Available since v4.7._\n */\n function toInt168(int256 value) internal pure returns (int168) {\n require(value >= type(int168).min && value <= type(int168).max, \"SafeCast: value doesn't fit in 168 bits\");\n return int168(value);\n }\n\n /**\n * @dev Returns the downcasted int160 from int256, reverting on\n * overflow (when the input is less than smallest int160 or\n * greater than largest int160).\n *\n * Counterpart to Solidity's `int160` operator.\n *\n * Requirements:\n *\n * - input must fit into 160 bits\n *\n * _Available since v4.7._\n */\n function toInt160(int256 value) internal pure returns (int160) {\n require(value >= type(int160).min && value <= type(int160).max, \"SafeCast: value doesn't fit in 160 bits\");\n return int160(value);\n }\n\n /**\n * @dev Returns the downcasted int152 from int256, reverting on\n * overflow (when the input is less than smallest int152 or\n * greater than largest int152).\n *\n * Counterpart to Solidity's `int152` operator.\n *\n * Requirements:\n *\n * - input must fit into 152 bits\n *\n * _Available since v4.7._\n */\n function toInt152(int256 value) internal pure returns (int152) {\n require(value >= type(int152).min && value <= type(int152).max, \"SafeCast: value doesn't fit in 152 bits\");\n return int152(value);\n }\n\n /**\n * @dev Returns the downcasted int144 from int256, reverting on\n * overflow (when the input is less than smallest int144 or\n * greater than largest int144).\n *\n * Counterpart to Solidity's `int144` operator.\n *\n * Requirements:\n *\n * - input must fit into 144 bits\n *\n * _Available since v4.7._\n */\n function toInt144(int256 value) internal pure returns (int144) {\n require(value >= type(int144).min && value <= type(int144).max, \"SafeCast: value doesn't fit in 144 bits\");\n return int144(value);\n }\n\n /**\n * @dev Returns the downcasted int136 from int256, reverting on\n * overflow (when the input is less than smallest int136 or\n * greater than largest int136).\n *\n * Counterpart to Solidity's `int136` operator.\n *\n * Requirements:\n *\n * - input must fit into 136 bits\n *\n * _Available since v4.7._\n */\n function toInt136(int256 value) internal pure returns (int136) {\n require(value >= type(int136).min && value <= type(int136).max, \"SafeCast: value doesn't fit in 136 bits\");\n return int136(value);\n }\n\n /**\n * @dev Returns the downcasted int128 from int256, reverting on\n * overflow (when the input is less than smallest int128 or\n * greater than largest int128).\n *\n * Counterpart to Solidity's `int128` operator.\n *\n * Requirements:\n *\n * - input must fit into 128 bits\n *\n * _Available since v3.1._\n */\n function toInt128(int256 value) internal pure returns (int128) {\n require(value >= type(int128).min && value <= type(int128).max, \"SafeCast: value doesn't fit in 128 bits\");\n return int128(value);\n }\n\n /**\n * @dev Returns the downcasted int120 from int256, reverting on\n * overflow (when the input is less than smallest int120 or\n * greater than largest int120).\n *\n * Counterpart to Solidity's `int120` operator.\n *\n * Requirements:\n *\n * - input must fit into 120 bits\n *\n * _Available since v4.7._\n */\n function toInt120(int256 value) internal pure returns (int120) {\n require(value >= type(int120).min && value <= type(int120).max, \"SafeCast: value doesn't fit in 120 bits\");\n return int120(value);\n }\n\n /**\n * @dev Returns the downcasted int112 from int256, reverting on\n * overflow (when the input is less than smallest int112 or\n * greater than largest int112).\n *\n * Counterpart to Solidity's `int112` operator.\n *\n * Requirements:\n *\n * - input must fit into 112 bits\n *\n * _Available since v4.7._\n */\n function toInt112(int256 value) internal pure returns (int112) {\n require(value >= type(int112).min && value <= type(int112).max, \"SafeCast: value doesn't fit in 112 bits\");\n return int112(value);\n }\n\n /**\n * @dev Returns the downcasted int104 from int256, reverting on\n * overflow (when the input is less than smallest int104 or\n * greater than largest int104).\n *\n * Counterpart to Solidity's `int104` operator.\n *\n * Requirements:\n *\n * - input must fit into 104 bits\n *\n * _Available since v4.7._\n */\n function toInt104(int256 value) internal pure returns (int104) {\n require(value >= type(int104).min && value <= type(int104).max, \"SafeCast: value doesn't fit in 104 bits\");\n return int104(value);\n }\n\n /**\n * @dev Returns the downcasted int96 from int256, reverting on\n * overflow (when the input is less than smallest int96 or\n * greater than largest int96).\n *\n * Counterpart to Solidity's `int96` operator.\n *\n * Requirements:\n *\n * - input must fit into 96 bits\n *\n * _Available since v4.7._\n */\n function toInt96(int256 value) internal pure returns (int96) {\n require(value >= type(int96).min && value <= type(int96).max, \"SafeCast: value doesn't fit in 96 bits\");\n return int96(value);\n }\n\n /**\n * @dev Returns the downcasted int88 from int256, reverting on\n * overflow (when the input is less than smallest int88 or\n * greater than largest int88).\n *\n * Counterpart to Solidity's `int88` operator.\n *\n * Requirements:\n *\n * - input must fit into 88 bits\n *\n * _Available since v4.7._\n */\n function toInt88(int256 value) internal pure returns (int88) {\n require(value >= type(int88).min && value <= type(int88).max, \"SafeCast: value doesn't fit in 88 bits\");\n return int88(value);\n }\n\n /**\n * @dev Returns the downcasted int80 from int256, reverting on\n * overflow (when the input is less than smallest int80 or\n * greater than largest int80).\n *\n * Counterpart to Solidity's `int80` operator.\n *\n * Requirements:\n *\n * - input must fit into 80 bits\n *\n * _Available since v4.7._\n */\n function toInt80(int256 value) internal pure returns (int80) {\n require(value >= type(int80).min && value <= type(int80).max, \"SafeCast: value doesn't fit in 80 bits\");\n return int80(value);\n }\n\n /**\n * @dev Returns the downcasted int72 from int256, reverting on\n * overflow (when the input is less than smallest int72 or\n * greater than largest int72).\n *\n * Counterpart to Solidity's `int72` operator.\n *\n * Requirements:\n *\n * - input must fit into 72 bits\n *\n * _Available since v4.7._\n */\n function toInt72(int256 value) internal pure returns (int72) {\n require(value >= type(int72).min && value <= type(int72).max, \"SafeCast: value doesn't fit in 72 bits\");\n return int72(value);\n }\n\n /**\n * @dev Returns the downcasted int64 from int256, reverting on\n * overflow (when the input is less than smallest int64 or\n * greater than largest int64).\n *\n * Counterpart to Solidity's `int64` operator.\n *\n * Requirements:\n *\n * - input must fit into 64 bits\n *\n * _Available since v3.1._\n */\n function toInt64(int256 value) internal pure returns (int64) {\n require(value >= type(int64).min && value <= type(int64).max, \"SafeCast: value doesn't fit in 64 bits\");\n return int64(value);\n }\n\n /**\n * @dev Returns the downcasted int56 from int256, reverting on\n * overflow (when the input is less than smallest int56 or\n * greater than largest int56).\n *\n * Counterpart to Solidity's `int56` operator.\n *\n * Requirements:\n *\n * - input must fit into 56 bits\n *\n * _Available since v4.7._\n */\n function toInt56(int256 value) internal pure returns (int56) {\n require(value >= type(int56).min && value <= type(int56).max, \"SafeCast: value doesn't fit in 56 bits\");\n return int56(value);\n }\n\n /**\n * @dev Returns the downcasted int48 from int256, reverting on\n * overflow (when the input is less than smallest int48 or\n * greater than largest int48).\n *\n * Counterpart to Solidity's `int48` operator.\n *\n * Requirements:\n *\n * - input must fit into 48 bits\n *\n * _Available since v4.7._\n */\n function toInt48(int256 value) internal pure returns (int48) {\n require(value >= type(int48).min && value <= type(int48).max, \"SafeCast: value doesn't fit in 48 bits\");\n return int48(value);\n }\n\n /**\n * @dev Returns the downcasted int40 from int256, reverting on\n * overflow (when the input is less than smallest int40 or\n * greater than largest int40).\n *\n * Counterpart to Solidity's `int40` operator.\n *\n * Requirements:\n *\n * - input must fit into 40 bits\n *\n * _Available since v4.7._\n */\n function toInt40(int256 value) internal pure returns (int40) {\n require(value >= type(int40).min && value <= type(int40).max, \"SafeCast: value doesn't fit in 40 bits\");\n return int40(value);\n }\n\n /**\n * @dev Returns the downcasted int32 from int256, reverting on\n * overflow (when the input is less than smallest int32 or\n * greater than largest int32).\n *\n * Counterpart to Solidity's `int32` operator.\n *\n * Requirements:\n *\n * - input must fit into 32 bits\n *\n * _Available since v3.1._\n */\n function toInt32(int256 value) internal pure returns (int32) {\n require(value >= type(int32).min && value <= type(int32).max, \"SafeCast: value doesn't fit in 32 bits\");\n return int32(value);\n }\n\n /**\n * @dev Returns the downcasted int24 from int256, reverting on\n * overflow (when the input is less than smallest int24 or\n * greater than largest int24).\n *\n * Counterpart to Solidity's `int24` operator.\n *\n * Requirements:\n *\n * - input must fit into 24 bits\n *\n * _Available since v4.7._\n */\n function toInt24(int256 value) internal pure returns (int24) {\n require(value >= type(int24).min && value <= type(int24).max, \"SafeCast: value doesn't fit in 24 bits\");\n return int24(value);\n }\n\n /**\n * @dev Returns the downcasted int16 from int256, reverting on\n * overflow (when the input is less than smallest int16 or\n * greater than largest int16).\n *\n * Counterpart to Solidity's `int16` operator.\n *\n * Requirements:\n *\n * - input must fit into 16 bits\n *\n * _Available since v3.1._\n */\n function toInt16(int256 value) internal pure returns (int16) {\n require(value >= type(int16).min && value <= type(int16).max, \"SafeCast: value doesn't fit in 16 bits\");\n return int16(value);\n }\n\n /**\n * @dev Returns the downcasted int8 from int256, reverting on\n * overflow (when the input is less than smallest int8 or\n * greater than largest int8).\n *\n * Counterpart to Solidity's `int8` operator.\n *\n * Requirements:\n *\n * - input must fit into 8 bits\n *\n * _Available since v3.1._\n */\n function toInt8(int256 value) internal pure returns (int8) {\n require(value >= type(int8).min && value <= type(int8).max, \"SafeCast: value doesn't fit in 8 bits\");\n return int8(value);\n }\n\n /**\n * @dev Converts an unsigned uint256 into a signed int256.\n *\n * Requirements:\n *\n * - input must be less than or equal to maxInt256.\n *\n * _Available since v3.0._\n */\n function toInt256(uint256 value) internal pure returns (int256) {\n // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n return int256(value);\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/governance/utils/IVotes.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotes {\n /**\n * @dev Emitted when an account changes their delegate.\n */\n event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n /**\n * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n */\n event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n /**\n * @dev Returns the current amount of votes that `account` has.\n */\n function getVotes(address account) external view returns (uint256);\n\n /**\n * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n */\n function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n *\n * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n * vote.\n */\n function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n /**\n * @dev Returns the delegate that `account` has chosen.\n */\n function delegates(address account) external view returns (address);\n\n /**\n * @dev Delegates votes from the sender to `delegatee`.\n */\n function delegate(address delegatee) external;\n\n /**\n * @dev Delegates votes from signer to `delegatee`.\n */\n function delegateBySig(\n address delegatee,\n uint256 nonce,\n uint256 expiry,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/ERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"./extensions/IERC721Metadata.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/Context.sol\";\nimport \"../../utils/Strings.sol\";\nimport \"../../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721 is Context, ERC165, IERC721, IERC721Metadata {\n using Address for address;\n using Strings for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return\n interfaceId == type(IERC721).interfaceId ||\n interfaceId == type(IERC721Metadata).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _owners[tokenId];\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner nor approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner nor approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _owners[tokenId] != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId);\n\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId);\n\n // Clear approvals\n _approve(address(0), tokenId);\n\n _balances[owner] -= 1;\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId);\n\n // Clear approvals from the previous owner\n _approve(address(0), tokenId);\n\n _balances[from] -= 1;\n _balances[to] += 1;\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721Receiver.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting\n * and burning.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be\n * transferred to `to`.\n * - When `from` is zero, `tokenId` will be minted for `to`.\n * - When `to` is zero, ``from``'s `tokenId` will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721Metadata is IERC721 {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ERC165.sol\";\n\n/**\n * @dev Storage based implementation of the {IERC165} interface.\n *\n * Contracts may inherit from this and call {_registerInterface} to declare\n * their support of an interface.\n */\nabstract contract ERC165Storage is ERC165 {\n /**\n * @dev Mapping of interface ids to whether or not it's supported.\n */\n mapping(bytes4 => bool) private _supportedInterfaces;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];\n }\n\n /**\n * @dev Registers the contract as an implementer of the interface defined by\n * `interfaceId`. Support of the actual ERC165 interface is automatic and\n * registering its interface id is not required.\n *\n * See {IERC165-supportsInterface}.\n *\n * Requirements:\n *\n * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).\n */\n function _registerInterface(bytes4 interfaceId) internal virtual {\n require(interfaceId != 0xffffffff, \"ERC165: invalid interface id\");\n _supportedInterfaces[interfaceId] = true;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/azorius/Azorius.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { Module } from \"@gnosis.pm/zodiac/contracts/core/Module.sol\";\nimport { IBaseStrategy } from \"./interfaces/IBaseStrategy.sol\";\nimport { IAzorius, Enum } from \"./interfaces/IAzorius.sol\";\n\n/**\n * A Safe module which allows for composable governance.\n * Azorius conforms to the [Zodiac pattern](https://github.com/gnosis/zodiac) for Safe modules.\n *\n * The Azorius contract acts as a central manager of DAO Proposals, maintaining the specifications\n * of the transactions that comprise a Proposal, but notably not the state of voting.\n *\n * All voting details are delegated to [BaseStrategy](./BaseStrategy.md) implementations, of which an Azorius DAO can\n * have any number.\n */\ncontract Azorius is Module, IAzorius {\n\n /**\n * The sentinel node of the linked list of enabled [BaseStrategies](./BaseStrategy.md).\n *\n * See https://en.wikipedia.org/wiki/Sentinel_node.\n */\n address internal constant SENTINEL_STRATEGY = address(0x1);\n\n /**\n * ```\n * keccak256(\n * \"EIP712Domain(uint256 chainId,address verifyingContract)\"\n * );\n * ```\n *\n * A unique hash intended to prevent signature collisions.\n *\n * See https://eips.ethereum.org/EIPS/eip-712.\n */\n bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH =\n 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;\n\n /**\n * ```\n * keccak256(\n * \"Transaction(address to,uint256 value,bytes data,uint8 operation,uint256 nonce)\"\n * );\n * ```\n *\n * See https://eips.ethereum.org/EIPS/eip-712.\n */\n bytes32 public constant TRANSACTION_TYPEHASH =\n 0x72e9670a7ee00f5fbf1049b8c38e3f22fab7e9b85029e85cf9412f17fdd5c2ad;\n\n /** Total number of submitted Proposals. */\n uint32 public totalProposalCount;\n\n /** Delay (in blocks) between when a Proposal is passed and when it can be executed. */\n uint32 public timelockPeriod;\n\n /** Time (in blocks) between when timelock ends and the Proposal expires. */\n uint32 public executionPeriod;\n\n /** Proposals by `proposalId`. */\n mapping(uint256 => Proposal) internal proposals;\n\n /** A linked list of enabled [BaseStrategies](./BaseStrategy.md). */\n mapping(address => address) internal strategies;\n\n event AzoriusSetUp(\n address indexed creator,\n address indexed owner,\n address indexed avatar,\n address target\n );\n event ProposalCreated(\n address strategy,\n uint256 proposalId,\n address proposer,\n Transaction[] transactions,\n string metadata\n );\n event ProposalExecuted(uint32 proposalId, bytes32[] txHashes);\n event EnabledStrategy(address strategy);\n event DisabledStrategy(address strategy);\n event TimelockPeriodUpdated(uint32 timelockPeriod);\n event ExecutionPeriodUpdated(uint32 executionPeriod);\n\n error InvalidStrategy();\n error StrategyEnabled();\n error StrategyDisabled();\n error InvalidProposal();\n error InvalidProposer();\n error ProposalNotExecutable();\n error InvalidTxHash();\n error TxFailed();\n error InvalidTxs();\n error InvalidArrayLengths();\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initial setup of the Azorius instance.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`, \n * `address _avatar`, `address _target`, `address[] memory _strategies`,\n * `uint256 _timelockPeriod`, `uint256 _executionPeriod`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n address _avatar,\n address _target, \n address[] memory _strategies, // enabled BaseStrategies\n uint32 _timelockPeriod, // initial timelockPeriod\n uint32 _executionPeriod // initial executionPeriod\n ) = abi.decode(\n initializeParams,\n (address, address, address, address[], uint32, uint32)\n );\n __Ownable_init();\n avatar = _avatar;\n target = _target;\n _setUpStrategies(_strategies);\n transferOwnership(_owner);\n _updateTimelockPeriod(_timelockPeriod);\n _updateExecutionPeriod(_executionPeriod);\n\n emit AzoriusSetUp(msg.sender, _owner, _avatar, _target);\n }\n\n /** @inheritdoc IAzorius*/\n function updateTimelockPeriod(uint32 _timelockPeriod) external onlyOwner {\n _updateTimelockPeriod(_timelockPeriod);\n }\n\n /** @inheritdoc IAzorius*/\n function updateExecutionPeriod(uint32 _executionPeriod) external onlyOwner {\n _updateExecutionPeriod(_executionPeriod);\n }\n\n /** @inheritdoc IAzorius*/\n function submitProposal(\n address _strategy,\n bytes memory _data,\n Transaction[] calldata _transactions,\n string calldata _metadata\n ) external {\n if (!isStrategyEnabled(_strategy)) revert StrategyDisabled();\n if (!IBaseStrategy(_strategy).isProposer(msg.sender))\n revert InvalidProposer();\n\n bytes32[] memory txHashes = new bytes32[](_transactions.length);\n uint256 transactionsLength = _transactions.length;\n for (uint256 i; i < transactionsLength; ) {\n txHashes[i] = getTxHash(\n _transactions[i].to,\n _transactions[i].value,\n _transactions[i].data,\n _transactions[i].operation\n );\n unchecked {\n ++i;\n }\n }\n\n proposals[totalProposalCount].strategy = _strategy;\n proposals[totalProposalCount].txHashes = txHashes;\n proposals[totalProposalCount].timelockPeriod = timelockPeriod;\n proposals[totalProposalCount].executionPeriod = executionPeriod;\n\n // not all strategy contracts will necessarily use the txHashes and _data values\n // they are encoded to support any strategy contracts that may need them\n IBaseStrategy(_strategy).initializeProposal(\n abi.encode(totalProposalCount, txHashes, _data)\n );\n\n emit ProposalCreated(\n _strategy,\n totalProposalCount,\n msg.sender,\n _transactions,\n _metadata\n );\n\n totalProposalCount++;\n }\n\n /** @inheritdoc IAzorius*/\n function executeProposal(\n uint32 _proposalId,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _data,\n Enum.Operation[] memory _operations\n ) external {\n if (_targets.length == 0) revert InvalidTxs();\n if (\n _targets.length != _values.length ||\n _targets.length != _data.length ||\n _targets.length != _operations.length\n ) revert InvalidArrayLengths();\n if (\n proposals[_proposalId].executionCounter + _targets.length >\n proposals[_proposalId].txHashes.length\n ) revert InvalidTxs();\n uint256 targetsLength = _targets.length;\n bytes32[] memory txHashes = new bytes32[](targetsLength);\n for (uint256 i; i < targetsLength; ) {\n txHashes[i] = _executeProposalTx(\n _proposalId,\n _targets[i],\n _values[i],\n _data[i],\n _operations[i]\n );\n unchecked {\n ++i;\n }\n }\n emit ProposalExecuted(_proposalId, txHashes);\n }\n\n /** @inheritdoc IAzorius*/\n function getStrategies(\n address _startAddress,\n uint256 _count\n ) external view returns (address[] memory _strategies, address _next) {\n // init array with max page size\n _strategies = new address[](_count);\n\n // populate return array\n uint256 strategyCount = 0;\n address currentStrategy = strategies[_startAddress];\n while (\n currentStrategy != address(0x0) &&\n currentStrategy != SENTINEL_STRATEGY &&\n strategyCount < _count\n ) {\n _strategies[strategyCount] = currentStrategy;\n currentStrategy = strategies[currentStrategy];\n strategyCount++;\n }\n _next = currentStrategy;\n // set correct size of returned array\n assembly {\n mstore(_strategies, strategyCount)\n }\n }\n\n /** @inheritdoc IAzorius*/\n function getProposalTxHash(uint32 _proposalId, uint32 _txIndex) external view returns (bytes32) {\n return proposals[_proposalId].txHashes[_txIndex];\n }\n\n /** @inheritdoc IAzorius*/\n function getProposalTxHashes(uint32 _proposalId) external view returns (bytes32[] memory) {\n return proposals[_proposalId].txHashes;\n }\n\n /** @inheritdoc IAzorius*/\n function getProposal(uint32 _proposalId) external view\n returns (\n address _strategy,\n bytes32[] memory _txHashes,\n uint32 _timelockPeriod,\n uint32 _executionPeriod,\n uint32 _executionCounter\n )\n {\n _strategy = proposals[_proposalId].strategy;\n _txHashes = proposals[_proposalId].txHashes;\n _timelockPeriod = proposals[_proposalId].timelockPeriod;\n _executionPeriod = proposals[_proposalId].executionPeriod;\n _executionCounter = proposals[_proposalId].executionCounter;\n }\n\n /** @inheritdoc IAzorius*/\n function enableStrategy(address _strategy) public override onlyOwner {\n if (_strategy == address(0) || _strategy == SENTINEL_STRATEGY)\n revert InvalidStrategy();\n if (strategies[_strategy] != address(0)) revert StrategyEnabled();\n\n strategies[_strategy] = strategies[SENTINEL_STRATEGY];\n strategies[SENTINEL_STRATEGY] = _strategy;\n\n emit EnabledStrategy(_strategy);\n }\n\n /** @inheritdoc IAzorius*/\n function disableStrategy(address _prevStrategy, address _strategy) public onlyOwner {\n if (_strategy == address(0) || _strategy == SENTINEL_STRATEGY)\n revert InvalidStrategy();\n if (strategies[_prevStrategy] != _strategy) revert StrategyDisabled();\n\n strategies[_prevStrategy] = strategies[_strategy];\n strategies[_strategy] = address(0);\n\n emit DisabledStrategy(_strategy);\n }\n\n /** @inheritdoc IAzorius*/\n function isStrategyEnabled(address _strategy) public view returns (bool) {\n return\n SENTINEL_STRATEGY != _strategy &&\n strategies[_strategy] != address(0);\n }\n\n /** @inheritdoc IAzorius*/\n function proposalState(uint32 _proposalId) public view returns (ProposalState) {\n Proposal memory _proposal = proposals[_proposalId];\n\n if (_proposal.strategy == address(0)) revert InvalidProposal();\n\n IBaseStrategy _strategy = IBaseStrategy(_proposal.strategy);\n\n uint256 votingEndBlock = _strategy.votingEndBlock(_proposalId);\n\n if (block.number <= votingEndBlock) {\n return ProposalState.ACTIVE;\n } else if (!_strategy.isPassed(_proposalId)) {\n return ProposalState.FAILED;\n } else if (_proposal.executionCounter == _proposal.txHashes.length) {\n // a Proposal with 0 transactions goes straight to EXECUTED\n // this allows for the potential for on-chain voting for \n // \"off-chain\" executed decisions\n return ProposalState.EXECUTED;\n } else if (block.number <= votingEndBlock + _proposal.timelockPeriod) {\n return ProposalState.TIMELOCKED;\n } else if (\n block.number <=\n votingEndBlock +\n _proposal.timelockPeriod +\n _proposal.executionPeriod\n ) {\n return ProposalState.EXECUTABLE;\n } else {\n return ProposalState.EXPIRED;\n }\n }\n\n /** @inheritdoc IAzorius*/\n function generateTxHashData(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _nonce\n ) public view returns (bytes memory) {\n uint256 chainId = block.chainid;\n bytes32 domainSeparator = keccak256(\n abi.encode(DOMAIN_SEPARATOR_TYPEHASH, chainId, this)\n );\n bytes32 transactionHash = keccak256(\n abi.encode(\n TRANSACTION_TYPEHASH,\n _to,\n _value,\n keccak256(_data),\n _operation,\n _nonce\n )\n );\n return\n abi.encodePacked(\n bytes1(0x19),\n bytes1(0x01),\n domainSeparator,\n transactionHash\n );\n }\n\n /** @inheritdoc IAzorius*/\n function getTxHash(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation\n ) public view returns (bytes32) {\n return keccak256(generateTxHashData(_to, _value, _data, _operation, 0));\n }\n\n /**\n * Executes the specified transaction in a Proposal, by index.\n * Transactions in a Proposal must be called in order.\n *\n * @param _proposalId identifier of the proposal\n * @param _target contract to be called by the avatar\n * @param _value ETH value to pass with the call\n * @param _data data to be executed from the call\n * @param _operation Call or Delegatecall\n */\n function _executeProposalTx(\n uint32 _proposalId,\n address _target,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation\n ) internal returns (bytes32 txHash) {\n if (proposalState(_proposalId) != ProposalState.EXECUTABLE)\n revert ProposalNotExecutable();\n txHash = getTxHash(_target, _value, _data, _operation);\n if (\n proposals[_proposalId].txHashes[\n proposals[_proposalId].executionCounter\n ] != txHash\n ) revert InvalidTxHash();\n\n proposals[_proposalId].executionCounter++;\n \n if (!exec(_target, _value, _data, _operation)) revert TxFailed();\n }\n\n /**\n * Enables the specified array of [BaseStrategy](./BaseStrategy.md) contract addresses.\n *\n * @param _strategies array of `BaseStrategy` contract addresses to enable\n */\n function _setUpStrategies(address[] memory _strategies) internal {\n strategies[SENTINEL_STRATEGY] = SENTINEL_STRATEGY;\n uint256 strategiesLength = _strategies.length;\n for (uint256 i; i < strategiesLength; ) {\n enableStrategy(_strategies[i]);\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * Updates the `timelockPeriod` for future Proposals.\n *\n * @param _timelockPeriod new timelock period (in blocks)\n */\n function _updateTimelockPeriod(uint32 _timelockPeriod) internal {\n timelockPeriod = _timelockPeriod;\n emit TimelockPeriodUpdated(_timelockPeriod);\n }\n\n /**\n * Updates the `executionPeriod` for future Proposals.\n *\n * @param _executionPeriod new execution period (in blocks)\n */\n function _updateExecutionPeriod(uint32 _executionPeriod) internal {\n executionPeriod = _executionPeriod;\n emit ExecutionPeriodUpdated(_executionPeriod);\n }\n}\n" + }, + "contracts/azorius/BaseQuorumPercent.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\n/**\n * An Azorius extension contract that enables percent based quorums.\n * Intended to be implemented by [BaseStrategy](./BaseStrategy.md) implementations.\n */\nabstract contract BaseQuorumPercent is OwnableUpgradeable {\n \n /** The numerator to use when calculating quorum (adjustable). */\n uint256 public quorumNumerator;\n\n /** The denominator to use when calculating quorum (1,000,000). */\n uint256 public constant QUORUM_DENOMINATOR = 1_000_000;\n\n /** Ensures the numerator cannot be larger than the denominator. */\n error InvalidQuorumNumerator();\n\n event QuorumNumeratorUpdated(uint256 quorumNumerator);\n\n /** \n * Updates the quorum required for future Proposals.\n *\n * @param _quorumNumerator numerator to use when calculating quorum (over 1,000,000)\n */\n function updateQuorumNumerator(uint256 _quorumNumerator) public virtual onlyOwner {\n _updateQuorumNumerator(_quorumNumerator);\n }\n\n /** Internal implementation of `updateQuorumNumerator`. */\n function _updateQuorumNumerator(uint256 _quorumNumerator) internal virtual {\n if (_quorumNumerator > QUORUM_DENOMINATOR)\n revert InvalidQuorumNumerator();\n\n quorumNumerator = _quorumNumerator;\n\n emit QuorumNumeratorUpdated(_quorumNumerator);\n }\n\n /**\n * Calculates whether a vote meets quorum. This is calculated based on yes votes + abstain\n * votes.\n *\n * @param _totalSupply the total supply of tokens\n * @param _yesVotes number of votes in favor\n * @param _abstainVotes number of votes abstaining\n * @return bool whether the total number of yes votes + abstain meets the quorum\n */\n function meetsQuorum(uint256 _totalSupply, uint256 _yesVotes, uint256 _abstainVotes) public view returns (bool) {\n return _yesVotes + _abstainVotes >= (_totalSupply * quorumNumerator) / QUORUM_DENOMINATOR;\n }\n\n /**\n * Calculates the total number of votes required for a proposal to meet quorum.\n * \n * @param _proposalId The ID of the proposal to get quorum votes for\n * @return uint256 The quantity of votes required to meet quorum\n */\n function quorumVotes(uint32 _proposalId) public view virtual returns (uint256);\n}\n" + }, + "contracts/azorius/BaseStrategy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { IAzorius } from \"./interfaces/IAzorius.sol\";\nimport { IBaseStrategy } from \"./interfaces/IBaseStrategy.sol\";\nimport { FactoryFriendly } from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\n/**\n * The base abstract contract for all voting strategies in Azorius.\n */\nabstract contract BaseStrategy is OwnableUpgradeable, FactoryFriendly, IBaseStrategy {\n\n event AzoriusSet(address indexed azoriusModule);\n event StrategySetUp(address indexed azoriusModule, address indexed owner);\n\n error OnlyAzorius();\n\n IAzorius public azoriusModule;\n\n /**\n * Ensures that only the [Azorius](./Azorius.md) contract that pertains to this \n * [BaseStrategy](./BaseStrategy.md) can call functions on it.\n */\n modifier onlyAzorius() {\n if (msg.sender != address(azoriusModule)) revert OnlyAzorius();\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /** @inheritdoc IBaseStrategy*/\n function setAzorius(address _azoriusModule) external onlyOwner {\n azoriusModule = IAzorius(_azoriusModule);\n emit AzoriusSet(_azoriusModule);\n }\n\n /** @inheritdoc IBaseStrategy*/\n function initializeProposal(bytes memory _data) external virtual;\n\n /** @inheritdoc IBaseStrategy*/\n function isPassed(uint32 _proposalId) external view virtual returns (bool);\n\n /** @inheritdoc IBaseStrategy*/\n function isProposer(address _address) external view virtual returns (bool);\n\n /** @inheritdoc IBaseStrategy*/\n function votingEndBlock(uint32 _proposalId) external view virtual returns (uint32);\n\n /**\n * Sets the address of the [Azorius](Azorius.md) module contract.\n *\n * @param _azoriusModule address of the Azorius module\n */\n function _setAzorius(address _azoriusModule) internal {\n azoriusModule = IAzorius(_azoriusModule);\n emit AzoriusSet(_azoriusModule);\n }\n}\n" + }, + "contracts/azorius/BaseVotingBasisPercent.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { OwnableUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\n\n/**\n * An Azorius extension contract that enables percent based voting basis calculations.\n *\n * Intended to be implemented by BaseStrategy implementations, this allows for voting strategies\n * to dictate any basis strategy for passing a Proposal between >50% (simple majority) to 100%.\n *\n * See https://en.wikipedia.org/wiki/Voting#Voting_basis.\n * See https://en.wikipedia.org/wiki/Supermajority.\n */\nabstract contract BaseVotingBasisPercent is OwnableUpgradeable {\n \n /** The numerator to use when calculating basis (adjustable). */\n uint256 public basisNumerator;\n\n /** The denominator to use when calculating basis (1,000,000). */\n uint256 public constant BASIS_DENOMINATOR = 1_000_000;\n\n error InvalidBasisNumerator();\n\n event BasisNumeratorUpdated(uint256 basisNumerator);\n\n /**\n * Updates the `basisNumerator` for future Proposals.\n *\n * @param _basisNumerator numerator to use\n */\n function updateBasisNumerator(uint256 _basisNumerator) public virtual onlyOwner {\n _updateBasisNumerator(_basisNumerator);\n }\n\n /** Internal implementation of `updateBasisNumerator`. */\n function _updateBasisNumerator(uint256 _basisNumerator) internal virtual {\n if (_basisNumerator > BASIS_DENOMINATOR || _basisNumerator < BASIS_DENOMINATOR / 2)\n revert InvalidBasisNumerator();\n\n basisNumerator = _basisNumerator;\n\n emit BasisNumeratorUpdated(_basisNumerator);\n }\n\n /**\n * Calculates whether a vote meets its basis.\n *\n * @param _yesVotes number of votes in favor\n * @param _noVotes number of votes against\n * @return bool whether the yes votes meets the set basis\n */\n function meetsBasis(uint256 _yesVotes, uint256 _noVotes) public view returns (bool) {\n return _yesVotes > (_yesVotes + _noVotes) * basisNumerator / BASIS_DENOMINATOR;\n }\n}\n" + }, + "contracts/azorius/HatsProposalCreationWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport {OwnableUpgradeable} from \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport {IHats} from \"../interfaces/hats/full/IHats.sol\";\n\nabstract contract HatsProposalCreationWhitelist is OwnableUpgradeable {\n event HatWhitelisted(uint256 hatId);\n event HatRemovedFromWhitelist(uint256 hatId);\n\n IHats public hatsContract;\n\n /** Array to store whitelisted Hat IDs. */\n uint256[] public whitelistedHatIds;\n\n error InvalidHatsContract();\n error NoHatsWhitelisted();\n error HatAlreadyWhitelisted();\n error HatNotWhitelisted();\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters:\n * `address _hatsContract`, `uint256[] _initialWhitelistedHats`\n */\n function setUp(bytes memory initializeParams) public virtual {\n (address _hatsContract, uint256[] memory _initialWhitelistedHats) = abi\n .decode(initializeParams, (address, uint256[]));\n\n if (_hatsContract == address(0)) revert InvalidHatsContract();\n hatsContract = IHats(_hatsContract);\n\n if (_initialWhitelistedHats.length == 0) revert NoHatsWhitelisted();\n for (uint256 i = 0; i < _initialWhitelistedHats.length; i++) {\n _whitelistHat(_initialWhitelistedHats[i]);\n }\n }\n\n /**\n * Adds a Hat to the whitelist for proposal creation.\n * @param _hatId The ID of the Hat to whitelist\n */\n function whitelistHat(uint256 _hatId) external onlyOwner {\n _whitelistHat(_hatId);\n }\n\n /**\n * Internal function to add a Hat to the whitelist.\n * @param _hatId The ID of the Hat to whitelist\n */\n function _whitelistHat(uint256 _hatId) internal {\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\n if (whitelistedHatIds[i] == _hatId) revert HatAlreadyWhitelisted();\n }\n whitelistedHatIds.push(_hatId);\n emit HatWhitelisted(_hatId);\n }\n\n /**\n * Removes a Hat from the whitelist for proposal creation.\n * @param _hatId The ID of the Hat to remove from the whitelist\n */\n function removeHatFromWhitelist(uint256 _hatId) external onlyOwner {\n bool found = false;\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\n if (whitelistedHatIds[i] == _hatId) {\n whitelistedHatIds[i] = whitelistedHatIds[\n whitelistedHatIds.length - 1\n ];\n whitelistedHatIds.pop();\n found = true;\n break;\n }\n }\n if (!found) revert HatNotWhitelisted();\n\n emit HatRemovedFromWhitelist(_hatId);\n }\n\n /**\n * @dev Checks if an address is authorized to create proposals.\n * @param _address The address to check for proposal creation authorization.\n * @return bool Returns true if the address is wearing any of the whitelisted Hats, false otherwise.\n * @notice This function overrides the isProposer function from the parent contract.\n * It iterates through all whitelisted Hat IDs and checks if the given address\n * is wearing any of them using the Hats Protocol.\n */\n function isProposer(address _address) public view virtual returns (bool) {\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\n if (hatsContract.isWearerOfHat(_address, whitelistedHatIds[i])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the number of whitelisted hats.\n * @return The number of whitelisted hats\n */\n function getWhitelistedHatsCount() public view returns (uint256) {\n return whitelistedHatIds.length;\n }\n\n /**\n * Checks if a hat is whitelisted.\n * @param _hatId The ID of the Hat to check\n * @return True if the hat is whitelisted, false otherwise\n */\n function isHatWhitelisted(uint256 _hatId) public view returns (bool) {\n for (uint256 i = 0; i < whitelistedHatIds.length; i++) {\n if (whitelistedHatIds[i] == _hatId) {\n return true;\n }\n }\n return false;\n }\n}\n" + }, + "contracts/azorius/interfaces/IAzorius.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\n/**\n * The base interface for the Azorius governance Safe module.\n * Azorius conforms to the Zodiac pattern for Safe modules: https://github.com/gnosis/zodiac\n *\n * Azorius manages the state of Proposals submitted to a DAO, along with the associated strategies\n * ([BaseStrategy](../BaseStrategy.md)) for voting that are enabled on the DAO.\n *\n * Any given DAO can support multiple voting BaseStrategies, and these strategies are intended to be\n * as customizable as possible.\n *\n * Proposals begin in the `ACTIVE` state and will ultimately end in either\n * the `EXECUTED`, `EXPIRED`, or `FAILED` state.\n *\n * `ACTIVE` - a new proposal begins in this state, and stays in this state\n * for the duration of its voting period.\n *\n * `TIMELOCKED` - A proposal that passes enters the `TIMELOCKED` state, during which\n * it cannot yet be executed. This is to allow time for token holders\n * to potentially exit their position, as well as parent DAOs time to\n * initiate a freeze, if they choose to do so. A proposal stays timelocked\n * for the duration of its `timelockPeriod`.\n *\n * `EXECUTABLE` - Following the `TIMELOCKED` state, a passed proposal becomes `EXECUTABLE`,\n * and can then finally be executed on chain by anyone.\n *\n * `EXECUTED` - the final state for a passed proposal. The proposal has been executed\n * on the blockchain.\n *\n * `EXPIRED` - a passed proposal which is not executed before its `executionPeriod` has\n * elapsed will be `EXPIRED`, and can no longer be executed.\n *\n * `FAILED` - a failed proposal (as defined by its [BaseStrategy](../BaseStrategy.md) \n * `isPassed` function). For a basic strategy, this would mean it received more \n * NO votes than YES or did not achieve quorum. \n */\ninterface IAzorius {\n\n /** Represents a transaction to perform on the blockchain. */\n struct Transaction {\n address to; // destination address of the transaction\n uint256 value; // amount of ETH to transfer with the transaction\n bytes data; // encoded function call data of the transaction\n Enum.Operation operation; // Operation type, Call or DelegateCall\n }\n\n /** Holds details pertaining to a single proposal. */\n struct Proposal {\n uint32 executionCounter; // count of transactions that have been executed within the proposal\n uint32 timelockPeriod; // time (in blocks) this proposal will be timelocked for if it passes\n uint32 executionPeriod; // time (in blocks) this proposal has to be executed after timelock ends before it is expired\n address strategy; // BaseStrategy contract this proposal was created on\n bytes32[] txHashes; // hashes of the transactions that are being proposed\n }\n\n /** The list of states in which a Proposal can be in at any given time. */\n enum ProposalState {\n ACTIVE,\n TIMELOCKED,\n EXECUTABLE,\n EXECUTED,\n EXPIRED,\n FAILED\n }\n\n /**\n * Enables a [BaseStrategy](../BaseStrategy.md) implementation for newly created Proposals.\n *\n * Multiple strategies can be enabled, and new Proposals will be able to be\n * created using any of the currently enabled strategies.\n *\n * @param _strategy contract address of the BaseStrategy to be enabled\n */\n function enableStrategy(address _strategy) external;\n\n /**\n * Disables a previously enabled [BaseStrategy](../BaseStrategy.md) implementation for new proposals.\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\n *\n * @param _prevStrategy BaseStrategy address that pointed in the linked list to the strategy to be removed\n * @param _strategy address of the BaseStrategy to be removed\n */\n function disableStrategy(address _prevStrategy, address _strategy) external;\n\n /**\n * Updates the `timelockPeriod` for newly created Proposals.\n * This has no effect on existing Proposals, either `ACTIVE` or completed.\n *\n * @param _timelockPeriod timelockPeriod (in blocks) to be used for new Proposals\n */\n function updateTimelockPeriod(uint32 _timelockPeriod) external;\n\n /**\n * Updates the execution period for future Proposals.\n *\n * @param _executionPeriod new execution period (in blocks)\n */\n function updateExecutionPeriod(uint32 _executionPeriod) external;\n\n /**\n * Submits a new Proposal, using one of the enabled [BaseStrategies](../BaseStrategy.md).\n * New Proposals begin immediately in the `ACTIVE` state.\n *\n * @param _strategy address of the BaseStrategy implementation which the Proposal will use\n * @param _data arbitrary data passed to the BaseStrategy implementation. This may not be used by all strategies, \n * but is included in case future strategy contracts have a need for it\n * @param _transactions array of transactions to propose\n * @param _metadata additional data such as a title/description to submit with the proposal\n */\n function submitProposal(\n address _strategy,\n bytes memory _data,\n Transaction[] calldata _transactions,\n string calldata _metadata\n ) external;\n\n /**\n * Executes all transactions within a Proposal.\n * This will only be able to be called if the Proposal passed.\n *\n * @param _proposalId identifier of the Proposal\n * @param _targets target contracts for each transaction\n * @param _values ETH values to be sent with each transaction\n * @param _data transaction data to be executed\n * @param _operations Calls or Delegatecalls\n */\n function executeProposal(\n uint32 _proposalId,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _data,\n Enum.Operation[] memory _operations\n ) external;\n\n /**\n * Returns whether a [BaseStrategy](../BaseStrategy.md) implementation is enabled.\n *\n * @param _strategy contract address of the BaseStrategy to check\n * @return bool True if the strategy is enabled, otherwise False\n */\n function isStrategyEnabled(address _strategy) external view returns (bool);\n\n /**\n * Returns an array of enabled [BaseStrategy](../BaseStrategy.md) contract addresses.\n * Because the list of BaseStrategies is technically unbounded, this\n * requires the address of the first strategy you would like, along\n * with the total count of strategies to return, rather than\n * returning the whole list at once.\n *\n * @param _startAddress contract address of the BaseStrategy to start with\n * @param _count maximum number of BaseStrategies that should be returned\n * @return _strategies array of BaseStrategies\n * @return _next next BaseStrategy contract address in the linked list\n */\n function getStrategies(\n address _startAddress,\n uint256 _count\n ) external view returns (address[] memory _strategies, address _next);\n\n /**\n * Gets the state of a Proposal.\n *\n * @param _proposalId identifier of the Proposal\n * @return ProposalState uint256 ProposalState enum value representing the\n * current state of the proposal\n */\n function proposalState(uint32 _proposalId) external view returns (ProposalState);\n\n /**\n * Generates the data for the module transaction hash (required for signing).\n *\n * @param _to target address of the transaction\n * @param _value ETH value to send with the transaction\n * @param _data encoded function call data of the transaction\n * @param _operation Enum.Operation to use for the transaction\n * @param _nonce Safe nonce of the transaction\n * @return bytes hashed transaction data\n */\n function generateTxHashData(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _nonce\n ) external view returns (bytes memory);\n\n /**\n * Returns the `keccak256` hash of the specified transaction.\n *\n * @param _to target address of the transaction\n * @param _value ETH value to send with the transaction\n * @param _data encoded function call data of the transaction\n * @param _operation Enum.Operation to use for the transaction\n * @return bytes32 transaction hash\n */\n function getTxHash(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation\n ) external view returns (bytes32);\n\n /**\n * Returns the hash of a transaction in a Proposal.\n *\n * @param _proposalId identifier of the Proposal\n * @param _txIndex index of the transaction within the Proposal\n * @return bytes32 hash of the specified transaction\n */\n function getProposalTxHash(uint32 _proposalId, uint32 _txIndex) external view returns (bytes32);\n\n /**\n * Returns the transaction hashes associated with a given `proposalId`.\n *\n * @param _proposalId identifier of the Proposal to get transaction hashes for\n * @return bytes32[] array of transaction hashes\n */\n function getProposalTxHashes(uint32 _proposalId) external view returns (bytes32[] memory);\n\n /**\n * Returns details about the specified Proposal.\n *\n * @param _proposalId identifier of the Proposal\n * @return _strategy address of the BaseStrategy contract the Proposal is on\n * @return _txHashes hashes of the transactions the Proposal contains\n * @return _timelockPeriod time (in blocks) the Proposal is timelocked for\n * @return _executionPeriod time (in blocks) the Proposal must be executed within, after timelock ends\n * @return _executionCounter counter of how many of the Proposals transactions have been executed\n */\n function getProposal(uint32 _proposalId) external view\n returns (\n address _strategy,\n bytes32[] memory _txHashes,\n uint32 _timelockPeriod,\n uint32 _executionPeriod,\n uint32 _executionCounter\n );\n}\n" + }, + "contracts/azorius/interfaces/IBaseStrategy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\n/**\n * The specification for a voting strategy in Azorius.\n *\n * Each IBaseStrategy implementation need only implement the given functions here,\n * which allows for highly composable but simple or complex voting strategies.\n *\n * It should be noted that while many voting strategies make use of parameters such as\n * voting period or quorum, that is a detail of the individual strategy itself, and not\n * a requirement for the Azorius protocol.\n */\ninterface IBaseStrategy {\n\n /**\n * Sets the address of the [Azorius](../Azorius.md) contract this \n * [BaseStrategy](../BaseStrategy.md) is being used on.\n *\n * @param _azoriusModule address of the Azorius Safe module\n */\n function setAzorius(address _azoriusModule) external;\n\n /**\n * Called by the [Azorius](../Azorius.md) module. This notifies this \n * [BaseStrategy](../BaseStrategy.md) that a new Proposal has been created.\n *\n * @param _data arbitrary data to pass to this BaseStrategy\n */\n function initializeProposal(bytes memory _data) external;\n\n /**\n * Returns whether a Proposal has been passed.\n *\n * @param _proposalId proposalId to check\n * @return bool true if the proposal has passed, otherwise false\n */\n function isPassed(uint32 _proposalId) external view returns (bool);\n\n /**\n * Returns whether the specified address can submit a Proposal with\n * this [BaseStrategy](../BaseStrategy.md).\n *\n * This allows a BaseStrategy to place any limits it would like on\n * who can create new Proposals, such as requiring a minimum token\n * delegation.\n *\n * @param _address address to check\n * @return bool true if the address can submit a Proposal, otherwise false\n */\n function isProposer(address _address) external view returns (bool);\n\n /**\n * Returns the block number voting ends on a given Proposal.\n *\n * @param _proposalId proposalId to check\n * @return uint32 block number when voting ends on the Proposal\n */\n function votingEndBlock(uint32 _proposalId) external view returns (uint32);\n}\n" + }, + "contracts/azorius/interfaces/IERC721VotingStrategy.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\n/**\n * Interface of functions required for ERC-721 freeze voting associated with an ERC-721\n * voting strategy.\n */\ninterface IERC721VotingStrategy {\n\n /**\n * Returns the current token weight for the given ERC-721 token address.\n *\n * @param _tokenAddress the ERC-721 token address\n */\n function getTokenWeight(address _tokenAddress) external view returns (uint256);\n}\n" + }, + "contracts/azorius/LinearERC20Voting.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { IVotes } from \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport { BaseStrategy, IBaseStrategy } from \"./BaseStrategy.sol\";\nimport { BaseQuorumPercent } from \"./BaseQuorumPercent.sol\";\nimport { BaseVotingBasisPercent } from \"./BaseVotingBasisPercent.sol\";\n\n /**\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that \n * enables linear (i.e. 1 to 1) token voting. Each token delegated to a given address \n * in an `ERC20Votes` token equals 1 vote for a Proposal.\n */\ncontract LinearERC20Voting is BaseStrategy, BaseQuorumPercent, BaseVotingBasisPercent {\n\n /**\n * The voting options for a Proposal.\n */\n enum VoteType {\n NO, // disapproves of executing the Proposal\n YES, // approves of executing the Proposal\n ABSTAIN // neither YES nor NO, i.e. voting \"present\"\n }\n\n /**\n * Defines the current state of votes on a particular Proposal.\n */\n struct ProposalVotes {\n uint32 votingStartBlock; // block that voting starts at\n uint32 votingEndBlock; // block that voting ends\n uint256 noVotes; // current number of NO votes for the Proposal\n uint256 yesVotes; // current number of YES votes for the Proposal\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\n mapping(address => bool) hasVoted; // whether a given address has voted yet or not\n }\n\n IVotes public governanceToken;\n\n /** Number of blocks a new Proposal can be voted on. */\n uint32 public votingPeriod;\n\n /** Voting weight required to be able to submit Proposals. */\n uint256 public requiredProposerWeight;\n\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\n mapping(uint256 => ProposalVotes) internal proposalVotes;\n\n event VotingPeriodUpdated(uint32 votingPeriod);\n event RequiredProposerWeightUpdated(uint256 requiredProposerWeight);\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\n event Voted(address voter, uint32 proposalId, uint8 voteType, uint256 weight);\n\n error InvalidProposal();\n error VotingEnded();\n error AlreadyVoted();\n error InvalidVote();\n error InvalidTokenAddress();\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `ERC20Votes _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`,\n * `uint256 _quorumNumerator`, `uint256 _basisNumerator`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n IVotes _governanceToken,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _requiredProposerWeight,\n uint256 _quorumNumerator,\n uint256 _basisNumerator\n ) = abi.decode(\n initializeParams,\n (address, IVotes, address, uint32, uint256, uint256, uint256)\n );\n if (address(_governanceToken) == address(0))\n revert InvalidTokenAddress();\n\n governanceToken = _governanceToken;\n __Ownable_init();\n transferOwnership(_owner);\n _setAzorius(_azoriusModule);\n _updateQuorumNumerator(_quorumNumerator);\n _updateBasisNumerator(_basisNumerator);\n _updateVotingPeriod(_votingPeriod);\n _updateRequiredProposerWeight(_requiredProposerWeight);\n\n emit StrategySetUp(_azoriusModule, _owner);\n }\n\n /**\n * Updates the voting time period for new Proposals.\n *\n * @param _votingPeriod voting time period (in blocks)\n */\n function updateVotingPeriod(uint32 _votingPeriod) external onlyOwner {\n _updateVotingPeriod(_votingPeriod);\n }\n\n /**\n * Updates the voting weight required to submit new Proposals.\n *\n * @param _requiredProposerWeight required token voting weight\n */\n function updateRequiredProposerWeight(uint256 _requiredProposerWeight) external onlyOwner {\n _updateRequiredProposerWeight(_requiredProposerWeight);\n }\n\n /**\n * Casts votes for a Proposal, equal to the caller's token delegation.\n *\n * @param _proposalId id of the Proposal to vote on\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\n */\n function vote(uint32 _proposalId, uint8 _voteType) external {\n _vote(\n _proposalId,\n msg.sender,\n _voteType,\n getVotingWeight(msg.sender, _proposalId)\n );\n }\n\n /**\n * Returns the current state of the specified Proposal.\n *\n * @param _proposalId id of the Proposal\n * @return noVotes current count of \"NO\" votes\n * @return yesVotes current count of \"YES\" votes\n * @return abstainVotes current count of \"ABSTAIN\" votes\n * @return startBlock block number voting starts\n * @return endBlock block number voting ends\n */\n function getProposalVotes(uint32 _proposalId) external view\n returns (\n uint256 noVotes,\n uint256 yesVotes,\n uint256 abstainVotes,\n uint32 startBlock,\n uint32 endBlock,\n uint256 votingSupply\n )\n {\n noVotes = proposalVotes[_proposalId].noVotes;\n yesVotes = proposalVotes[_proposalId].yesVotes;\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\n startBlock = proposalVotes[_proposalId].votingStartBlock;\n endBlock = proposalVotes[_proposalId].votingEndBlock;\n votingSupply = getProposalVotingSupply(_proposalId);\n }\n\n /** @inheritdoc BaseStrategy*/\n function initializeProposal(bytes memory _data) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n \n /**\n * Returns whether an address has voted on the specified Proposal.\n *\n * @param _proposalId id of the Proposal to check\n * @param _address address to check\n * @return bool true if the address has voted on the Proposal, otherwise false\n */\n function hasVoted(uint32 _proposalId, address _address) public view returns (bool) {\n return proposalVotes[_proposalId].hasVoted[_address];\n }\n\n /** @inheritdoc BaseStrategy*/\n function isPassed(uint32 _proposalId) public view override returns (bool) {\n return (\n block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\n meetsQuorum(getProposalVotingSupply(_proposalId), proposalVotes[_proposalId].yesVotes, proposalVotes[_proposalId].abstainVotes) && // yes + abstain votes meets the quorum\n meetsBasis(proposalVotes[_proposalId].yesVotes, proposalVotes[_proposalId].noVotes) // yes votes meets the basis\n );\n }\n\n /**\n * Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change,\n * it is necessary to calculate quorum from the supply available at the time of the Proposal's creation,\n * not when it is being voted on passes / fails.\n *\n * @param _proposalId id of the Proposal\n * @return uint256 voting supply snapshot for the given _proposalId\n */\n function getProposalVotingSupply(uint32 _proposalId) public view virtual returns (uint256) {\n return governanceToken.getPastTotalSupply(proposalVotes[_proposalId].votingStartBlock);\n }\n\n /**\n * Calculates the voting weight an address has for a specific Proposal.\n *\n * @param _voter address of the voter\n * @param _proposalId id of the Proposal\n * @return uint256 the address' voting weight\n */\n function getVotingWeight(address _voter, uint32 _proposalId) public view returns (uint256) {\n return\n governanceToken.getPastVotes(\n _voter,\n proposalVotes[_proposalId].votingStartBlock\n );\n }\n\n /** @inheritdoc BaseStrategy*/\n function isProposer(address _address) public view override returns (bool) {\n return governanceToken.getPastVotes(\n _address,\n block.number - 1\n ) >= requiredProposerWeight;\n }\n\n /** @inheritdoc BaseStrategy*/\n function votingEndBlock(uint32 _proposalId) public view override returns (uint32) {\n return proposalVotes[_proposalId].votingEndBlock;\n }\n\n /** Internal implementation of `updateVotingPeriod`. */\n function _updateVotingPeriod(uint32 _votingPeriod) internal {\n votingPeriod = _votingPeriod;\n emit VotingPeriodUpdated(_votingPeriod);\n }\n\n /** Internal implementation of `updateRequiredProposerWeight`. */\n function _updateRequiredProposerWeight(uint256 _requiredProposerWeight) internal {\n requiredProposerWeight = _requiredProposerWeight;\n emit RequiredProposerWeightUpdated(_requiredProposerWeight);\n }\n\n /**\n * Internal function for casting a vote on a Proposal.\n *\n * @param _proposalId id of the Proposal\n * @param _voter address casting the vote\n * @param _voteType vote support, as defined in VoteType\n * @param _weight amount of voting weight cast, typically the\n * total number of tokens delegated\n */\n function _vote(uint32 _proposalId, address _voter, uint8 _voteType, uint256 _weight) internal {\n if (proposalVotes[_proposalId].votingEndBlock == 0)\n revert InvalidProposal();\n if (block.number > proposalVotes[_proposalId].votingEndBlock)\n revert VotingEnded();\n if (proposalVotes[_proposalId].hasVoted[_voter]) revert AlreadyVoted();\n\n proposalVotes[_proposalId].hasVoted[_voter] = true;\n\n if (_voteType == uint8(VoteType.NO)) {\n proposalVotes[_proposalId].noVotes += _weight;\n } else if (_voteType == uint8(VoteType.YES)) {\n proposalVotes[_proposalId].yesVotes += _weight;\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\n proposalVotes[_proposalId].abstainVotes += _weight;\n } else {\n revert InvalidVote();\n }\n\n emit Voted(_voter, _proposalId, _voteType, _weight);\n }\n\n /** @inheritdoc BaseQuorumPercent*/\n function quorumVotes(uint32 _proposalId) public view override returns (uint256) {\n return quorumNumerator * getProposalVotingSupply(_proposalId) / QUORUM_DENOMINATOR;\n }\n}\n" + }, + "contracts/azorius/LinearERC20VotingExtensible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport {IVotes} from \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport {BaseStrategy, IBaseStrategy} from \"./BaseStrategy.sol\";\nimport {BaseQuorumPercent} from \"./BaseQuorumPercent.sol\";\nimport {BaseVotingBasisPercent} from \"./BaseVotingBasisPercent.sol\";\n\n/**\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\n * enables linear (i.e. 1 to 1) token voting. Each token delegated to a given address\n * in an `ERC20Votes` token equals 1 vote for a Proposal.\n *\n * This contract is an extensible version of LinearERC20Voting, with all functions\n * marked as `virtual`. This allows other contracts to inherit from it and override\n * any part of its functionality. The existence of this contract enables the creation\n * of more specialized voting strategies that build upon the basic linear ERC20 voting\n * mechanism while allowing for customization of specific aspects as needed.\n */\nabstract contract LinearERC20VotingExtensible is\n BaseStrategy,\n BaseQuorumPercent,\n BaseVotingBasisPercent\n{\n /**\n * The voting options for a Proposal.\n */\n enum VoteType {\n NO, // disapproves of executing the Proposal\n YES, // approves of executing the Proposal\n ABSTAIN // neither YES nor NO, i.e. voting \"present\"\n }\n\n /**\n * Defines the current state of votes on a particular Proposal.\n */\n struct ProposalVotes {\n uint32 votingStartBlock; // block that voting starts at\n uint32 votingEndBlock; // block that voting ends\n uint256 noVotes; // current number of NO votes for the Proposal\n uint256 yesVotes; // current number of YES votes for the Proposal\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\n mapping(address => bool) hasVoted; // whether a given address has voted yet or not\n }\n\n IVotes public governanceToken;\n\n /** Number of blocks a new Proposal can be voted on. */\n uint32 public votingPeriod;\n\n /** Voting weight required to be able to submit Proposals. */\n uint256 public requiredProposerWeight;\n\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\n mapping(uint256 => ProposalVotes) internal proposalVotes;\n\n event VotingPeriodUpdated(uint32 votingPeriod);\n event RequiredProposerWeightUpdated(uint256 requiredProposerWeight);\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\n event Voted(\n address voter,\n uint32 proposalId,\n uint8 voteType,\n uint256 weight\n );\n\n error InvalidProposal();\n error VotingEnded();\n error AlreadyVoted();\n error InvalidVote();\n error InvalidTokenAddress();\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `IVotes _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`,\n * `uint256 _requiredProposerWeight`, `uint256 _quorumNumerator`,\n * `uint256 _basisNumerator`\n */\n function setUp(\n bytes memory initializeParams\n ) public virtual override initializer {\n (\n address _owner,\n IVotes _governanceToken,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _requiredProposerWeight,\n uint256 _quorumNumerator,\n uint256 _basisNumerator\n ) = abi.decode(\n initializeParams,\n (address, IVotes, address, uint32, uint256, uint256, uint256)\n );\n if (address(_governanceToken) == address(0))\n revert InvalidTokenAddress();\n\n governanceToken = _governanceToken;\n __Ownable_init();\n transferOwnership(_owner);\n _setAzorius(_azoriusModule);\n _updateQuorumNumerator(_quorumNumerator);\n _updateBasisNumerator(_basisNumerator);\n _updateVotingPeriod(_votingPeriod);\n _updateRequiredProposerWeight(_requiredProposerWeight);\n\n emit StrategySetUp(_azoriusModule, _owner);\n }\n\n /**\n * Updates the voting time period for new Proposals.\n *\n * @param _votingPeriod voting time period (in blocks)\n */\n function updateVotingPeriod(\n uint32 _votingPeriod\n ) external virtual onlyOwner {\n _updateVotingPeriod(_votingPeriod);\n }\n\n /**\n * Updates the voting weight required to submit new Proposals.\n *\n * @param _requiredProposerWeight required token voting weight\n */\n function updateRequiredProposerWeight(\n uint256 _requiredProposerWeight\n ) external virtual onlyOwner {\n _updateRequiredProposerWeight(_requiredProposerWeight);\n }\n\n /**\n * Casts votes for a Proposal, equal to the caller's token delegation.\n *\n * @param _proposalId id of the Proposal to vote on\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\n */\n function vote(uint32 _proposalId, uint8 _voteType) external virtual {\n _vote(\n _proposalId,\n msg.sender,\n _voteType,\n getVotingWeight(msg.sender, _proposalId)\n );\n }\n\n /**\n * Returns the current state of the specified Proposal.\n *\n * @param _proposalId id of the Proposal\n * @return noVotes current count of \"NO\" votes\n * @return yesVotes current count of \"YES\" votes\n * @return abstainVotes current count of \"ABSTAIN\" votes\n * @return startBlock block number voting starts\n * @return endBlock block number voting ends\n */\n function getProposalVotes(\n uint32 _proposalId\n )\n external\n view\n virtual\n returns (\n uint256 noVotes,\n uint256 yesVotes,\n uint256 abstainVotes,\n uint32 startBlock,\n uint32 endBlock,\n uint256 votingSupply\n )\n {\n noVotes = proposalVotes[_proposalId].noVotes;\n yesVotes = proposalVotes[_proposalId].yesVotes;\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\n startBlock = proposalVotes[_proposalId].votingStartBlock;\n endBlock = proposalVotes[_proposalId].votingEndBlock;\n votingSupply = getProposalVotingSupply(_proposalId);\n }\n\n /** @inheritdoc BaseStrategy*/\n function initializeProposal(\n bytes memory _data\n ) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n\n /**\n * Returns whether an address has voted on the specified Proposal.\n *\n * @param _proposalId id of the Proposal to check\n * @param _address address to check\n * @return bool true if the address has voted on the Proposal, otherwise false\n */\n function hasVoted(\n uint32 _proposalId,\n address _address\n ) public view virtual returns (bool) {\n return proposalVotes[_proposalId].hasVoted[_address];\n }\n\n /** @inheritdoc BaseStrategy*/\n function isPassed(\n uint32 _proposalId\n ) public view virtual override returns (bool) {\n return (block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\n meetsQuorum(\n getProposalVotingSupply(_proposalId),\n proposalVotes[_proposalId].yesVotes,\n proposalVotes[_proposalId].abstainVotes\n ) && // yes + abstain votes meets the quorum\n meetsBasis(\n proposalVotes[_proposalId].yesVotes,\n proposalVotes[_proposalId].noVotes\n )); // yes votes meets the basis\n }\n\n /**\n * Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change,\n * it is necessary to calculate quorum from the supply available at the time of the Proposal's creation,\n * not when it is being voted on passes / fails.\n *\n * @param _proposalId id of the Proposal\n * @return uint256 voting supply snapshot for the given _proposalId\n */\n function getProposalVotingSupply(\n uint32 _proposalId\n ) public view virtual returns (uint256) {\n return\n governanceToken.getPastTotalSupply(\n proposalVotes[_proposalId].votingStartBlock\n );\n }\n\n /**\n * Calculates the voting weight an address has for a specific Proposal.\n *\n * @param _voter address of the voter\n * @param _proposalId id of the Proposal\n * @return uint256 the address' voting weight\n */\n function getVotingWeight(\n address _voter,\n uint32 _proposalId\n ) public view virtual returns (uint256) {\n return\n governanceToken.getPastVotes(\n _voter,\n proposalVotes[_proposalId].votingStartBlock\n );\n }\n\n /** @inheritdoc BaseStrategy*/\n function isProposer(\n address _address\n ) public view virtual override returns (bool) {\n return\n governanceToken.getPastVotes(_address, block.number - 1) >=\n requiredProposerWeight;\n }\n\n /** @inheritdoc BaseStrategy*/\n function votingEndBlock(\n uint32 _proposalId\n ) public view virtual override returns (uint32) {\n return proposalVotes[_proposalId].votingEndBlock;\n }\n\n /** Internal implementation of `updateVotingPeriod`. */\n function _updateVotingPeriod(uint32 _votingPeriod) internal virtual {\n votingPeriod = _votingPeriod;\n emit VotingPeriodUpdated(_votingPeriod);\n }\n\n /** Internal implementation of `updateRequiredProposerWeight`. */\n function _updateRequiredProposerWeight(\n uint256 _requiredProposerWeight\n ) internal virtual {\n requiredProposerWeight = _requiredProposerWeight;\n emit RequiredProposerWeightUpdated(_requiredProposerWeight);\n }\n\n /**\n * Internal function for casting a vote on a Proposal.\n *\n * @param _proposalId id of the Proposal\n * @param _voter address casting the vote\n * @param _voteType vote support, as defined in VoteType\n * @param _weight amount of voting weight cast, typically the\n * total number of tokens delegated\n */\n function _vote(\n uint32 _proposalId,\n address _voter,\n uint8 _voteType,\n uint256 _weight\n ) internal virtual {\n if (proposalVotes[_proposalId].votingEndBlock == 0)\n revert InvalidProposal();\n if (block.number > proposalVotes[_proposalId].votingEndBlock)\n revert VotingEnded();\n if (proposalVotes[_proposalId].hasVoted[_voter]) revert AlreadyVoted();\n\n proposalVotes[_proposalId].hasVoted[_voter] = true;\n\n if (_voteType == uint8(VoteType.NO)) {\n proposalVotes[_proposalId].noVotes += _weight;\n } else if (_voteType == uint8(VoteType.YES)) {\n proposalVotes[_proposalId].yesVotes += _weight;\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\n proposalVotes[_proposalId].abstainVotes += _weight;\n } else {\n revert InvalidVote();\n }\n\n emit Voted(_voter, _proposalId, _voteType, _weight);\n }\n\n /** @inheritdoc BaseQuorumPercent*/\n function quorumVotes(\n uint32 _proposalId\n ) public view virtual override returns (uint256) {\n return\n (quorumNumerator * getProposalVotingSupply(_proposalId)) /\n QUORUM_DENOMINATOR;\n }\n}\n" + }, + "contracts/azorius/LinearERC20VotingOG.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { IVotes } from \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\nimport { BaseStrategy, IBaseStrategy } from \"./BaseStrategy.sol\";\nimport { BaseQuorumPercent } from \"./BaseQuorumPercent.sol\";\nimport { BaseVotingBasisPercent } from \"./BaseVotingBasisPercent.sol\";\n\n /**\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that \n * enables linear (i.e. 1 to 1) token voting. Each token delegated to a given address \n * in an `ERC20Votes` token equals 1 vote for a Proposal.\n */\ncontract LinearERC20VotingOG is BaseStrategy, BaseQuorumPercent, BaseVotingBasisPercent {\n\n /**\n * The voting options for a Proposal.\n */\n enum VoteType {\n NO, // disapproves of executing the Proposal\n YES, // approves of executing the Proposal\n ABSTAIN // neither YES nor NO, i.e. voting \"present\"\n }\n\n /**\n * Defines the current state of votes on a particular Proposal.\n */\n struct ProposalVotes {\n uint32 votingStartBlock; // block that voting starts at\n uint32 votingEndBlock; // block that voting ends\n uint256 noVotes; // current number of NO votes for the Proposal\n uint256 yesVotes; // current number of YES votes for the Proposal\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\n mapping(address => bool) hasVoted; // whether a given address has voted yet or not\n }\n\n IVotes public governanceToken;\n\n /** Number of blocks a new Proposal can be voted on. */\n uint32 public votingPeriod;\n\n /** Voting weight required to be able to submit Proposals. */\n uint256 public requiredProposerWeight;\n\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\n mapping(uint256 => ProposalVotes) internal proposalVotes;\n\n event VotingPeriodUpdated(uint32 votingPeriod);\n event RequiredProposerWeightUpdated(uint256 requiredProposerWeight);\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\n event Voted(address voter, uint32 proposalId, uint8 voteType, uint256 weight);\n\n error InvalidProposal();\n error VotingEnded();\n error AlreadyVoted();\n error InvalidVote();\n error InvalidTokenAddress();\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `ERC20Votes _governanceToken`, `address _azoriusModule`, `uint256 _votingPeriod`,\n * `uint256 _quorumNumerator`, `uint256 _basisNumerator`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n IVotes _governanceToken,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _requiredProposerWeight,\n uint256 _quorumNumerator,\n uint256 _basisNumerator\n ) = abi.decode(\n initializeParams,\n (address, IVotes, address, uint32, uint256, uint256, uint256)\n );\n if (address(_governanceToken) == address(0))\n revert InvalidTokenAddress();\n\n governanceToken = _governanceToken;\n __Ownable_init();\n transferOwnership(_owner);\n _setAzorius(_azoriusModule);\n _updateQuorumNumerator(_quorumNumerator);\n _updateBasisNumerator(_basisNumerator);\n _updateVotingPeriod(_votingPeriod);\n _updateRequiredProposerWeight(_requiredProposerWeight);\n\n emit StrategySetUp(_azoriusModule, _owner);\n }\n\n /**\n * Updates the voting time period for new Proposals.\n *\n * @param _votingPeriod voting time period (in blocks)\n */\n function updateVotingPeriod(uint32 _votingPeriod) external onlyOwner {\n _updateVotingPeriod(_votingPeriod);\n }\n\n /**\n * Updates the voting weight required to submit new Proposals.\n *\n * @param _requiredProposerWeight required token voting weight\n */\n function updateRequiredProposerWeight(uint256 _requiredProposerWeight) external onlyOwner {\n _updateRequiredProposerWeight(_requiredProposerWeight);\n }\n\n /**\n * Casts votes for a Proposal, equal to the caller's token delegation.\n *\n * @param _proposalId id of the Proposal to vote on\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\n */\n function vote(uint32 _proposalId, uint8 _voteType) external {\n _vote(\n _proposalId,\n msg.sender,\n _voteType,\n getVotingWeight(msg.sender, _proposalId)\n );\n }\n\n /**\n * Returns the current state of the specified Proposal.\n *\n * @param _proposalId id of the Proposal\n * @return noVotes current count of \"NO\" votes\n * @return yesVotes current count of \"YES\" votes\n * @return abstainVotes current count of \"ABSTAIN\" votes\n * @return startBlock block number voting starts\n * @return endBlock block number voting ends\n */\n function getProposalVotes(uint32 _proposalId) external view\n returns (\n uint256 noVotes,\n uint256 yesVotes,\n uint256 abstainVotes,\n uint32 startBlock,\n uint32 endBlock,\n uint256 votingSupply\n )\n {\n noVotes = proposalVotes[_proposalId].noVotes;\n yesVotes = proposalVotes[_proposalId].yesVotes;\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\n startBlock = proposalVotes[_proposalId].votingStartBlock;\n endBlock = proposalVotes[_proposalId].votingEndBlock;\n votingSupply = getProposalVotingSupply(_proposalId);\n }\n\n /** @inheritdoc BaseStrategy*/\n function initializeProposal(bytes memory _data) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n \n /**\n * Returns whether an address has voted on the specified Proposal.\n *\n * @param _proposalId id of the Proposal to check\n * @param _address address to check\n * @return bool true if the address has voted on the Proposal, otherwise false\n */\n function hasVoted(uint32 _proposalId, address _address) public view returns (bool) {\n return proposalVotes[_proposalId].hasVoted[_address];\n }\n\n /** @inheritdoc BaseStrategy*/\n function isPassed(uint32 _proposalId) public view override returns (bool) {\n return (\n block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\n meetsQuorum(getProposalVotingSupply(_proposalId), proposalVotes[_proposalId].yesVotes, proposalVotes[_proposalId].abstainVotes) && // yes + abstain votes meets the quorum\n meetsBasis(proposalVotes[_proposalId].yesVotes, proposalVotes[_proposalId].noVotes) // yes votes meets the basis\n );\n }\n\n /**\n * Returns a snapshot of total voting supply for a given Proposal. Because token supplies can change,\n * it is necessary to calculate quorum from the supply available at the time of the Proposal's creation,\n * not when it is being voted on passes / fails.\n *\n * @param _proposalId id of the Proposal\n * @return uint256 voting supply snapshot for the given _proposalId\n */\n function getProposalVotingSupply(uint32 _proposalId) public view virtual returns (uint256) {\n return governanceToken.getPastTotalSupply(proposalVotes[_proposalId].votingStartBlock);\n }\n\n /**\n * Calculates the voting weight an address has for a specific Proposal.\n *\n * @param _voter address of the voter\n * @param _proposalId id of the Proposal\n * @return uint256 the address' voting weight\n */\n function getVotingWeight(address _voter, uint32 _proposalId) public view returns (uint256) {\n return\n governanceToken.getPastVotes(\n _voter,\n proposalVotes[_proposalId].votingStartBlock\n );\n }\n\n /** @inheritdoc BaseStrategy*/\n function isProposer(address _address) public view override returns (bool) {\n return governanceToken.getPastVotes(\n _address,\n block.number - 1\n ) >= requiredProposerWeight;\n }\n\n /** @inheritdoc BaseStrategy*/\n function votingEndBlock(uint32 _proposalId) public view override returns (uint32) {\n return proposalVotes[_proposalId].votingEndBlock;\n }\n\n /** Internal implementation of `updateVotingPeriod`. */\n function _updateVotingPeriod(uint32 _votingPeriod) internal {\n votingPeriod = _votingPeriod;\n emit VotingPeriodUpdated(_votingPeriod);\n }\n\n /** Internal implementation of `updateRequiredProposerWeight`. */\n function _updateRequiredProposerWeight(uint256 _requiredProposerWeight) internal {\n requiredProposerWeight = _requiredProposerWeight;\n emit RequiredProposerWeightUpdated(_requiredProposerWeight);\n }\n\n /**\n * Internal function for casting a vote on a Proposal.\n *\n * @param _proposalId id of the Proposal\n * @param _voter address casting the vote\n * @param _voteType vote support, as defined in VoteType\n * @param _weight amount of voting weight cast, typically the\n * total number of tokens delegated\n */\n function _vote(uint32 _proposalId, address _voter, uint8 _voteType, uint256 _weight) internal {\n if (proposalVotes[_proposalId].votingEndBlock == 0)\n revert InvalidProposal();\n if (block.number > proposalVotes[_proposalId].votingEndBlock)\n revert VotingEnded();\n if (proposalVotes[_proposalId].hasVoted[_voter]) revert AlreadyVoted();\n\n proposalVotes[_proposalId].hasVoted[_voter] = true;\n\n if (_voteType == uint8(VoteType.NO)) {\n proposalVotes[_proposalId].noVotes += _weight;\n } else if (_voteType == uint8(VoteType.YES)) {\n proposalVotes[_proposalId].yesVotes += _weight;\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\n proposalVotes[_proposalId].abstainVotes += _weight;\n } else {\n revert InvalidVote();\n }\n\n emit Voted(_voter, _proposalId, _voteType, _weight);\n }\n\n /** @inheritdoc BaseQuorumPercent*/\n function quorumVotes(uint32 _proposalId) public view override returns (uint256) {\n return quorumNumerator * getProposalVotingSupply(_proposalId) / QUORUM_DENOMINATOR;\n }\n}\n" + }, + "contracts/azorius/LinearERC20VotingWithHatsProposalCreation.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport {LinearERC20VotingExtensible} from \"./LinearERC20VotingExtensible.sol\";\nimport {HatsProposalCreationWhitelist} from \"./HatsProposalCreationWhitelist.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\n\n/**\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\n * enables linear (i.e. 1 to 1) ERC21 based token voting, with proposal creation\n * restricted to users wearing whitelisted Hats.\n */\ncontract LinearERC20VotingWithHatsProposalCreation is\n HatsProposalCreationWhitelist,\n LinearERC20VotingExtensible\n{\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address _governanceToken`, `address _azoriusModule`, `uint32 _votingPeriod`,\n * `uint256 _quorumNumerator`, `uint256 _basisNumerator`, `address _hatsContract`,\n * `uint256[] _initialWhitelistedHats`\n */\n function setUp(\n bytes memory initializeParams\n )\n public\n override(HatsProposalCreationWhitelist, LinearERC20VotingExtensible)\n {\n (\n address _owner,\n address _governanceToken,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _quorumNumerator,\n uint256 _basisNumerator,\n address _hatsContract,\n uint256[] memory _initialWhitelistedHats\n ) = abi.decode(\n initializeParams,\n (\n address,\n address,\n address,\n uint32,\n uint256,\n uint256,\n address,\n uint256[]\n )\n );\n\n LinearERC20VotingExtensible.setUp(\n abi.encode(\n _owner,\n _governanceToken,\n _azoriusModule,\n _votingPeriod,\n 0, // requiredProposerWeight is zero because we only care about the hat check\n _quorumNumerator,\n _basisNumerator\n )\n );\n\n HatsProposalCreationWhitelist.setUp(\n abi.encode(_hatsContract, _initialWhitelistedHats)\n );\n }\n\n /** @inheritdoc HatsProposalCreationWhitelist*/\n function isProposer(\n address _address\n )\n public\n view\n override(HatsProposalCreationWhitelist, LinearERC20VotingExtensible)\n returns (bool)\n {\n return HatsProposalCreationWhitelist.isProposer(_address);\n }\n}\n" + }, + "contracts/azorius/LinearERC20WrappedVoting.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { LinearERC20Voting } from \"./LinearERC20Voting.sol\";\nimport { VotesERC20Wrapper } from \"../VotesERC20Wrapper.sol\";\n\n /**\n * An extension of [LinearERC20Voting](./azorius/LinearERC20Voting.md) that properly supports\n * [VotesERC20Wrapper](./VotesERC20Wrapper.md) token governance.\n *\n * This snapshots and uses the total supply of the underlying token for calculating quorum,\n * rather than the total supply of *wrapped* tokens, as would be the case without it.\n */\ncontract LinearERC20WrappedVoting is LinearERC20Voting {\n\n /** `proposalId` to \"past total supply\" of tokens. */\n mapping(uint256 => uint256) internal votingSupply;\n\n /** @inheritdoc LinearERC20Voting*/\n function initializeProposal(bytes memory _data) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n votingSupply[proposalId] = VotesERC20Wrapper(address(governanceToken)).underlying().totalSupply();\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n\n /** @inheritdoc LinearERC20Voting*/\n function getProposalVotingSupply(uint32 _proposalId) public view override returns (uint256) {\n return votingSupply[_proposalId];\n }\n}\n" + }, + "contracts/azorius/LinearERC721Voting.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { IERC721VotingStrategy } from \"./interfaces/IERC721VotingStrategy.sol\";\nimport { IERC721 } from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport { BaseVotingBasisPercent } from \"./BaseVotingBasisPercent.sol\";\nimport { IAzorius } from \"./interfaces/IAzorius.sol\";\nimport { BaseStrategy } from \"./BaseStrategy.sol\";\n\n/**\n * An Azorius strategy that allows multiple ERC721 tokens to be registered as governance tokens, \n * each with their own voting weight.\n *\n * This is slightly different from ERC-20 voting, since there is no way to snapshot ERC721 holdings.\n * Each ERC721 id can vote once, reguardless of what address held it when a proposal was created.\n *\n * Also, this uses \"quorumThreshold\" rather than LinearERC20Voting's quorumPercent, because the \n * total supply of NFTs is not knowable within the IERC721 interface. This is similar to a multisig \n * \"total signers\" required, rather than a percentage of the tokens.\n */\ncontract LinearERC721Voting is BaseStrategy, BaseVotingBasisPercent, IERC721VotingStrategy {\n\n /**\n * The voting options for a Proposal.\n */\n enum VoteType {\n NO, // disapproves of executing the Proposal\n YES, // approves of executing the Proposal\n ABSTAIN // neither YES nor NO, i.e. voting \"present\"\n }\n\n /**\n * Defines the current state of votes on a particular Proposal.\n */\n struct ProposalVotes {\n uint32 votingStartBlock; // block that voting starts at\n uint32 votingEndBlock; // block that voting ends\n uint256 noVotes; // current number of NO votes for the Proposal\n uint256 yesVotes; // current number of YES votes for the Proposal\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\n /**\n * ERC-721 contract address to individual NFT id to bool \n * of whether it has voted on this proposal.\n */\n mapping(address => mapping(uint256 => bool)) hasVoted;\n }\n\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\n mapping(uint256 => ProposalVotes) public proposalVotes;\n\n /** The list of ERC-721 tokens that can vote. */\n address[] public tokenAddresses;\n \n /** ERC-721 address to its voting weight per NFT id. */\n mapping(address => uint256) public tokenWeights;\n \n /** Number of blocks a new Proposal can be voted on. */\n uint32 public votingPeriod;\n\n /** \n * The total number of votes required to achieve quorum.\n * \"Quorum threshold\" is used instead of a quorum percent because IERC721 has no \n * totalSupply function, so the contract cannot determine this.\n */\n uint256 public quorumThreshold;\n\n /** \n * The minimum number of voting power required to create a new proposal.\n */\n uint256 public proposerThreshold; \n\n event VotingPeriodUpdated(uint32 votingPeriod);\n event QuorumThresholdUpdated(uint256 quorumThreshold);\n event ProposerThresholdUpdated(uint256 proposerThreshold);\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\n event Voted(address voter, uint32 proposalId, uint8 voteType, address[] tokenAddresses, uint256[] tokenIds);\n event GovernanceTokenAdded(address token, uint256 weight);\n event GovernanceTokenRemoved(address token);\n\n error InvalidParams();\n error InvalidProposal();\n error VotingEnded();\n error InvalidVote();\n error InvalidTokenAddress();\n error NoVotingWeight();\n error TokenAlreadySet();\n error TokenNotSet();\n error IdAlreadyVoted(uint256 tokenId);\n error IdNotOwned(uint256 tokenId);\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`, \n * `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _proposerThreshold`, \n * `uint256 _basisNumerator`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n address[] memory _tokens,\n uint256[] memory _weights,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _quorumThreshold,\n uint256 _proposerThreshold,\n uint256 _basisNumerator\n ) = abi.decode(\n initializeParams,\n (address, address[], uint256[], address, uint32, uint256, uint256, uint256)\n );\n\n if (_tokens.length != _weights.length) {\n revert InvalidParams();\n }\n\n for (uint i = 0; i < _tokens.length;) {\n _addGovernanceToken(_tokens[i], _weights[i]);\n unchecked { ++i; }\n }\n\n __Ownable_init();\n transferOwnership(_owner);\n _setAzorius(_azoriusModule);\n _updateQuorumThreshold(_quorumThreshold);\n _updateProposerThreshold(_proposerThreshold);\n _updateBasisNumerator(_basisNumerator);\n _updateVotingPeriod(_votingPeriod);\n\n emit StrategySetUp(_azoriusModule, _owner);\n }\n\n /**\n * Adds a new ERC-721 token as a governance token, along with its associated weight.\n *\n * @param _tokenAddress the address of the ERC-721 token\n * @param _weight the number of votes each NFT id is worth\n */\n function addGovernanceToken(address _tokenAddress, uint256 _weight) external onlyOwner {\n _addGovernanceToken(_tokenAddress, _weight);\n }\n\n /**\n * Updates the voting time period for new Proposals.\n *\n * @param _votingPeriod voting time period (in blocks)\n */\n function updateVotingPeriod(uint32 _votingPeriod) external onlyOwner {\n _updateVotingPeriod(_votingPeriod);\n }\n\n /** \n * Updates the quorum required for future Proposals.\n *\n * @param _quorumThreshold total voting weight required to achieve quorum\n */\n function updateQuorumThreshold(uint256 _quorumThreshold) external onlyOwner {\n _updateQuorumThreshold(_quorumThreshold);\n }\n\n /**\n * Updates the voting weight required to submit new Proposals.\n *\n * @param _proposerThreshold required voting weight\n */\n function updateProposerThreshold(uint256 _proposerThreshold) external onlyOwner {\n _updateProposerThreshold(_proposerThreshold);\n }\n /**\n * Returns whole list of governance tokens addresses\n */\n function getAllTokenAddresses() external view returns (address[] memory) {\n return tokenAddresses;\n }\n\n /**\n * Returns the current state of the specified Proposal.\n *\n * @param _proposalId id of the Proposal\n * @return noVotes current count of \"NO\" votes\n * @return yesVotes current count of \"YES\" votes\n * @return abstainVotes current count of \"ABSTAIN\" votes\n * @return startBlock block number voting starts\n * @return endBlock block number voting ends\n */\n function getProposalVotes(uint32 _proposalId) external view\n returns (\n uint256 noVotes,\n uint256 yesVotes,\n uint256 abstainVotes,\n uint32 startBlock,\n uint32 endBlock\n )\n {\n noVotes = proposalVotes[_proposalId].noVotes;\n yesVotes = proposalVotes[_proposalId].yesVotes;\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\n startBlock = proposalVotes[_proposalId].votingStartBlock;\n endBlock = proposalVotes[_proposalId].votingEndBlock;\n }\n\n /**\n * Submits a vote on an existing Proposal.\n *\n * @param _proposalId id of the Proposal to vote on\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\n */\n function vote(\n uint32 _proposalId, \n uint8 _voteType, \n address[] memory _tokenAddresses,\n uint256[] memory _tokenIds \n ) external {\n if (_tokenAddresses.length != _tokenIds.length) revert InvalidParams();\n _vote(_proposalId, msg.sender, _voteType, _tokenAddresses, _tokenIds);\n }\n\n /** @inheritdoc IERC721VotingStrategy*/\n function getTokenWeight(address _tokenAddress) external view override returns (uint256) {\n return tokenWeights[_tokenAddress];\n }\n\n /**\n * Returns whether an NFT id has already voted.\n *\n * @param _proposalId the id of the Proposal\n * @param _tokenAddress the ERC-721 contract address\n * @param _tokenId the unique id of the NFT\n */\n function hasVoted(uint32 _proposalId, address _tokenAddress, uint256 _tokenId) external view returns (bool) {\n return proposalVotes[_proposalId].hasVoted[_tokenAddress][_tokenId];\n }\n\n /** \n * Removes the given ERC-721 token address from the list of governance tokens.\n *\n * @param _tokenAddress the ERC-721 token to remove\n */\n function removeGovernanceToken(address _tokenAddress) external onlyOwner {\n if (tokenWeights[_tokenAddress] == 0) revert TokenNotSet();\n\n tokenWeights[_tokenAddress] = 0;\n\n uint256 length = tokenAddresses.length;\n for (uint256 i = 0; i < length;) {\n if (_tokenAddress == tokenAddresses[i]) {\n uint256 last = length - 1;\n tokenAddresses[i] = tokenAddresses[last]; // move the last token into the position to remove\n delete tokenAddresses[last]; // delete the last token\n break;\n }\n unchecked { ++i; }\n }\n \n emit GovernanceTokenRemoved(_tokenAddress);\n }\n\n /** @inheritdoc BaseStrategy*/\n function initializeProposal(bytes memory _data) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n\n /** @inheritdoc BaseStrategy*/\n function isPassed(uint32 _proposalId) public view override returns (bool) {\n return (\n block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\n quorumThreshold <= proposalVotes[_proposalId].yesVotes + proposalVotes[_proposalId].abstainVotes && // yes + abstain votes meets the quorum\n meetsBasis(proposalVotes[_proposalId].yesVotes, proposalVotes[_proposalId].noVotes) // yes votes meets the basis\n );\n }\n\n /** @inheritdoc BaseStrategy*/\n function isProposer(address _address) public view override returns (bool) {\n uint256 totalWeight = 0;\n for (uint i = 0; i < tokenAddresses.length;) {\n address tokenAddress = tokenAddresses[i];\n totalWeight += IERC721(tokenAddress).balanceOf(_address) * tokenWeights[tokenAddress];\n unchecked { ++i; }\n }\n return totalWeight >= proposerThreshold;\n }\n\n /** @inheritdoc BaseStrategy*/\n function votingEndBlock(uint32 _proposalId) public view override returns (uint32) {\n return proposalVotes[_proposalId].votingEndBlock;\n }\n\n /** Internal implementation of `addGovernanceToken` */\n function _addGovernanceToken(address _tokenAddress, uint256 _weight) internal {\n if (!IERC721(_tokenAddress).supportsInterface(0x80ac58cd))\n revert InvalidTokenAddress();\n \n if (_weight == 0)\n revert NoVotingWeight();\n\n if (tokenWeights[_tokenAddress] > 0)\n revert TokenAlreadySet();\n\n tokenAddresses.push(_tokenAddress);\n tokenWeights[_tokenAddress] = _weight;\n\n emit GovernanceTokenAdded(_tokenAddress, _weight);\n }\n\n /** Internal implementation of `updateVotingPeriod`. */\n function _updateVotingPeriod(uint32 _votingPeriod) internal {\n votingPeriod = _votingPeriod;\n emit VotingPeriodUpdated(_votingPeriod);\n }\n\n /** Internal implementation of `updateQuorumThreshold`. */\n function _updateQuorumThreshold(uint256 _quorumThreshold) internal {\n quorumThreshold = _quorumThreshold;\n emit QuorumThresholdUpdated(quorumThreshold);\n }\n\n /** Internal implementation of `updateProposerThreshold`. */\n function _updateProposerThreshold(uint256 _proposerThreshold) internal {\n proposerThreshold = _proposerThreshold;\n emit ProposerThresholdUpdated(_proposerThreshold);\n }\n\n /**\n * Internal function for casting a vote on a Proposal.\n *\n * @param _proposalId id of the Proposal\n * @param _voter address casting the vote\n * @param _voteType vote support, as defined in VoteType\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\n */\n function _vote(\n uint32 _proposalId,\n address _voter,\n uint8 _voteType,\n address[] memory _tokenAddresses,\n uint256[] memory _tokenIds\n ) internal {\n\n uint256 weight;\n\n // verifies the voter holds the NFTs and returns the total weight associated with their tokens\n // the frontend will need to determine whether an address can vote on a proposal, as it is possible\n // to vote twice if you get more weight later on\n for (uint256 i = 0; i < _tokenAddresses.length;) {\n\n address tokenAddress = _tokenAddresses[i];\n uint256 tokenId = _tokenIds[i];\n\n if (_voter != IERC721(tokenAddress).ownerOf(tokenId)) {\n revert IdNotOwned(tokenId);\n }\n\n if (proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] == true) {\n revert IdAlreadyVoted(tokenId);\n }\n \n weight += tokenWeights[tokenAddress];\n proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] = true;\n unchecked { ++i; }\n }\n\n if (weight == 0) revert NoVotingWeight();\n\n ProposalVotes storage proposal = proposalVotes[_proposalId];\n\n if (proposal.votingEndBlock == 0)\n revert InvalidProposal();\n\n if (block.number > proposal.votingEndBlock)\n revert VotingEnded();\n\n if (_voteType == uint8(VoteType.NO)) {\n proposal.noVotes += weight;\n } else if (_voteType == uint8(VoteType.YES)) {\n proposal.yesVotes += weight;\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\n proposal.abstainVotes += weight;\n } else {\n revert InvalidVote();\n }\n\n emit Voted(_voter, _proposalId, _voteType, _tokenAddresses, _tokenIds);\n }\n}\n" + }, + "contracts/azorius/LinearERC721VotingExtensible.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport {IERC721VotingStrategy} from \"./interfaces/IERC721VotingStrategy.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport {BaseVotingBasisPercent} from \"./BaseVotingBasisPercent.sol\";\nimport {IAzorius} from \"./interfaces/IAzorius.sol\";\nimport {BaseStrategy} from \"./BaseStrategy.sol\";\n\n/**\n * An Azorius strategy that allows multiple ERC721 tokens to be registered as governance tokens,\n * each with their own voting weight.\n *\n * This is slightly different from ERC-20 voting, since there is no way to snapshot ERC721 holdings.\n * Each ERC721 id can vote once, reguardless of what address held it when a proposal was created.\n *\n * Also, this uses \"quorumThreshold\" rather than LinearERC20Voting's quorumPercent, because the\n * total supply of NFTs is not knowable within the IERC721 interface. This is similar to a multisig\n * \"total signers\" required, rather than a percentage of the tokens.\n *\n * This contract is an extensible version of LinearERC721Voting, with all functions\n * marked as `virtual`. This allows other contracts to inherit from it and override\n * any part of its functionality. The existence of this contract enables the creation\n * of more specialized voting strategies that build upon the basic linear ERC721 voting\n * mechanism while allowing for customization of specific aspects as needed.\n */\nabstract contract LinearERC721VotingExtensible is\n BaseStrategy,\n BaseVotingBasisPercent,\n IERC721VotingStrategy\n{\n /**\n * The voting options for a Proposal.\n */\n enum VoteType {\n NO, // disapproves of executing the Proposal\n YES, // approves of executing the Proposal\n ABSTAIN // neither YES nor NO, i.e. voting \"present\"\n }\n\n /**\n * Defines the current state of votes on a particular Proposal.\n */\n struct ProposalVotes {\n uint32 votingStartBlock; // block that voting starts at\n uint32 votingEndBlock; // block that voting ends\n uint256 noVotes; // current number of NO votes for the Proposal\n uint256 yesVotes; // current number of YES votes for the Proposal\n uint256 abstainVotes; // current number of ABSTAIN votes for the Proposal\n /**\n * ERC-721 contract address to individual NFT id to bool\n * of whether it has voted on this proposal.\n */\n mapping(address => mapping(uint256 => bool)) hasVoted;\n }\n\n /** `proposalId` to `ProposalVotes`, the voting state of a Proposal. */\n mapping(uint256 => ProposalVotes) public proposalVotes;\n\n /** The list of ERC-721 tokens that can vote. */\n address[] public tokenAddresses;\n\n /** ERC-721 address to its voting weight per NFT id. */\n mapping(address => uint256) public tokenWeights;\n\n /** Number of blocks a new Proposal can be voted on. */\n uint32 public votingPeriod;\n\n /**\n * The total number of votes required to achieve quorum.\n * \"Quorum threshold\" is used instead of a quorum percent because IERC721 has no\n * totalSupply function, so the contract cannot determine this.\n */\n uint256 public quorumThreshold;\n\n /**\n * The minimum number of voting power required to create a new proposal.\n */\n uint256 public proposerThreshold;\n\n event VotingPeriodUpdated(uint32 votingPeriod);\n event QuorumThresholdUpdated(uint256 quorumThreshold);\n event ProposerThresholdUpdated(uint256 proposerThreshold);\n event ProposalInitialized(uint32 proposalId, uint32 votingEndBlock);\n event Voted(\n address voter,\n uint32 proposalId,\n uint8 voteType,\n address[] tokenAddresses,\n uint256[] tokenIds\n );\n event GovernanceTokenAdded(address token, uint256 weight);\n event GovernanceTokenRemoved(address token);\n\n error InvalidParams();\n error InvalidProposal();\n error VotingEnded();\n error InvalidVote();\n error InvalidTokenAddress();\n error NoVotingWeight();\n error TokenAlreadySet();\n error TokenNotSet();\n error IdAlreadyVoted(uint256 tokenId);\n error IdNotOwned(uint256 tokenId);\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`,\n * `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _proposerThreshold`,\n * `uint256 _basisNumerator`\n */\n function setUp(\n bytes memory initializeParams\n ) public virtual override initializer {\n (\n address _owner,\n address[] memory _tokens,\n uint256[] memory _weights,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _quorumThreshold,\n uint256 _proposerThreshold,\n uint256 _basisNumerator\n ) = abi.decode(\n initializeParams,\n (\n address,\n address[],\n uint256[],\n address,\n uint32,\n uint256,\n uint256,\n uint256\n )\n );\n\n if (_tokens.length != _weights.length) {\n revert InvalidParams();\n }\n\n for (uint i = 0; i < _tokens.length; ) {\n _addGovernanceToken(_tokens[i], _weights[i]);\n unchecked {\n ++i;\n }\n }\n\n __Ownable_init();\n transferOwnership(_owner);\n _setAzorius(_azoriusModule);\n _updateQuorumThreshold(_quorumThreshold);\n _updateProposerThreshold(_proposerThreshold);\n _updateBasisNumerator(_basisNumerator);\n _updateVotingPeriod(_votingPeriod);\n\n emit StrategySetUp(_azoriusModule, _owner);\n }\n\n /**\n * Adds a new ERC-721 token as a governance token, along with its associated weight.\n *\n * @param _tokenAddress the address of the ERC-721 token\n * @param _weight the number of votes each NFT id is worth\n */\n function addGovernanceToken(\n address _tokenAddress,\n uint256 _weight\n ) external virtual onlyOwner {\n _addGovernanceToken(_tokenAddress, _weight);\n }\n\n /**\n * Updates the voting time period for new Proposals.\n *\n * @param _votingPeriod voting time period (in blocks)\n */\n function updateVotingPeriod(\n uint32 _votingPeriod\n ) external virtual onlyOwner {\n _updateVotingPeriod(_votingPeriod);\n }\n\n /**\n * Updates the quorum required for future Proposals.\n *\n * @param _quorumThreshold total voting weight required to achieve quorum\n */\n function updateQuorumThreshold(\n uint256 _quorumThreshold\n ) external virtual onlyOwner {\n _updateQuorumThreshold(_quorumThreshold);\n }\n\n /**\n * Updates the voting weight required to submit new Proposals.\n *\n * @param _proposerThreshold required voting weight\n */\n function updateProposerThreshold(\n uint256 _proposerThreshold\n ) external virtual onlyOwner {\n _updateProposerThreshold(_proposerThreshold);\n }\n\n /**\n * Returns whole list of governance tokens addresses\n */\n function getAllTokenAddresses()\n external\n view\n virtual\n returns (address[] memory)\n {\n return tokenAddresses;\n }\n\n /**\n * Returns the current state of the specified Proposal.\n *\n * @param _proposalId id of the Proposal\n * @return noVotes current count of \"NO\" votes\n * @return yesVotes current count of \"YES\" votes\n * @return abstainVotes current count of \"ABSTAIN\" votes\n * @return startBlock block number voting starts\n * @return endBlock block number voting ends\n */\n function getProposalVotes(\n uint32 _proposalId\n )\n external\n view\n virtual\n returns (\n uint256 noVotes,\n uint256 yesVotes,\n uint256 abstainVotes,\n uint32 startBlock,\n uint32 endBlock\n )\n {\n noVotes = proposalVotes[_proposalId].noVotes;\n yesVotes = proposalVotes[_proposalId].yesVotes;\n abstainVotes = proposalVotes[_proposalId].abstainVotes;\n startBlock = proposalVotes[_proposalId].votingStartBlock;\n endBlock = proposalVotes[_proposalId].votingEndBlock;\n }\n\n /**\n * Submits a vote on an existing Proposal.\n *\n * @param _proposalId id of the Proposal to vote on\n * @param _voteType Proposal support as defined in VoteType (NO, YES, ABSTAIN)\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\n */\n function vote(\n uint32 _proposalId,\n uint8 _voteType,\n address[] memory _tokenAddresses,\n uint256[] memory _tokenIds\n ) external virtual {\n if (_tokenAddresses.length != _tokenIds.length) revert InvalidParams();\n _vote(_proposalId, msg.sender, _voteType, _tokenAddresses, _tokenIds);\n }\n\n /** @inheritdoc IERC721VotingStrategy*/\n function getTokenWeight(\n address _tokenAddress\n ) external view virtual override returns (uint256) {\n return tokenWeights[_tokenAddress];\n }\n\n /**\n * Returns whether an NFT id has already voted.\n *\n * @param _proposalId the id of the Proposal\n * @param _tokenAddress the ERC-721 contract address\n * @param _tokenId the unique id of the NFT\n */\n function hasVoted(\n uint32 _proposalId,\n address _tokenAddress,\n uint256 _tokenId\n ) external view virtual returns (bool) {\n return proposalVotes[_proposalId].hasVoted[_tokenAddress][_tokenId];\n }\n\n /**\n * Removes the given ERC-721 token address from the list of governance tokens.\n *\n * @param _tokenAddress the ERC-721 token to remove\n */\n function removeGovernanceToken(\n address _tokenAddress\n ) external virtual onlyOwner {\n if (tokenWeights[_tokenAddress] == 0) revert TokenNotSet();\n\n tokenWeights[_tokenAddress] = 0;\n\n uint256 length = tokenAddresses.length;\n for (uint256 i = 0; i < length; ) {\n if (_tokenAddress == tokenAddresses[i]) {\n uint256 last = length - 1;\n tokenAddresses[i] = tokenAddresses[last]; // move the last token into the position to remove\n delete tokenAddresses[last]; // delete the last token\n break;\n }\n unchecked {\n ++i;\n }\n }\n\n emit GovernanceTokenRemoved(_tokenAddress);\n }\n\n /** @inheritdoc BaseStrategy*/\n function initializeProposal(\n bytes memory _data\n ) public virtual override onlyAzorius {\n uint32 proposalId = abi.decode(_data, (uint32));\n uint32 _votingEndBlock = uint32(block.number) + votingPeriod;\n\n proposalVotes[proposalId].votingEndBlock = _votingEndBlock;\n proposalVotes[proposalId].votingStartBlock = uint32(block.number);\n\n emit ProposalInitialized(proposalId, _votingEndBlock);\n }\n\n /** @inheritdoc BaseStrategy*/\n function isPassed(\n uint32 _proposalId\n ) public view virtual override returns (bool) {\n return (block.number > proposalVotes[_proposalId].votingEndBlock && // voting period has ended\n quorumThreshold <=\n proposalVotes[_proposalId].yesVotes +\n proposalVotes[_proposalId].abstainVotes && // yes + abstain votes meets the quorum\n meetsBasis(\n proposalVotes[_proposalId].yesVotes,\n proposalVotes[_proposalId].noVotes\n )); // yes votes meets the basis\n }\n\n /** @inheritdoc BaseStrategy*/\n function isProposer(\n address _address\n ) public view virtual override returns (bool) {\n uint256 totalWeight = 0;\n for (uint i = 0; i < tokenAddresses.length; ) {\n address tokenAddress = tokenAddresses[i];\n totalWeight +=\n IERC721(tokenAddress).balanceOf(_address) *\n tokenWeights[tokenAddress];\n unchecked {\n ++i;\n }\n }\n return totalWeight >= proposerThreshold;\n }\n\n /** @inheritdoc BaseStrategy*/\n function votingEndBlock(\n uint32 _proposalId\n ) public view virtual override returns (uint32) {\n return proposalVotes[_proposalId].votingEndBlock;\n }\n\n /** Internal implementation of `addGovernanceToken` */\n function _addGovernanceToken(\n address _tokenAddress,\n uint256 _weight\n ) internal virtual {\n if (!IERC721(_tokenAddress).supportsInterface(0x80ac58cd))\n revert InvalidTokenAddress();\n\n if (_weight == 0) revert NoVotingWeight();\n\n if (tokenWeights[_tokenAddress] > 0) revert TokenAlreadySet();\n\n tokenAddresses.push(_tokenAddress);\n tokenWeights[_tokenAddress] = _weight;\n\n emit GovernanceTokenAdded(_tokenAddress, _weight);\n }\n\n /** Internal implementation of `updateVotingPeriod`. */\n function _updateVotingPeriod(uint32 _votingPeriod) internal virtual {\n votingPeriod = _votingPeriod;\n emit VotingPeriodUpdated(_votingPeriod);\n }\n\n /** Internal implementation of `updateQuorumThreshold`. */\n function _updateQuorumThreshold(uint256 _quorumThreshold) internal virtual {\n quorumThreshold = _quorumThreshold;\n emit QuorumThresholdUpdated(quorumThreshold);\n }\n\n /** Internal implementation of `updateProposerThreshold`. */\n function _updateProposerThreshold(\n uint256 _proposerThreshold\n ) internal virtual {\n proposerThreshold = _proposerThreshold;\n emit ProposerThresholdUpdated(_proposerThreshold);\n }\n\n /**\n * Internal function for casting a vote on a Proposal.\n *\n * @param _proposalId id of the Proposal\n * @param _voter address casting the vote\n * @param _voteType vote support, as defined in VoteType\n * @param _tokenAddresses list of ERC-721 addresses that correspond to ids in _tokenIds\n * @param _tokenIds list of unique token ids that correspond to their ERC-721 address in _tokenAddresses\n */\n function _vote(\n uint32 _proposalId,\n address _voter,\n uint8 _voteType,\n address[] memory _tokenAddresses,\n uint256[] memory _tokenIds\n ) internal virtual {\n uint256 weight;\n\n // verifies the voter holds the NFTs and returns the total weight associated with their tokens\n // the frontend will need to determine whether an address can vote on a proposal, as it is possible\n // to vote twice if you get more weight later on\n for (uint256 i = 0; i < _tokenAddresses.length; ) {\n address tokenAddress = _tokenAddresses[i];\n uint256 tokenId = _tokenIds[i];\n\n if (_voter != IERC721(tokenAddress).ownerOf(tokenId)) {\n revert IdNotOwned(tokenId);\n }\n\n if (\n proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] ==\n true\n ) {\n revert IdAlreadyVoted(tokenId);\n }\n\n weight += tokenWeights[tokenAddress];\n proposalVotes[_proposalId].hasVoted[tokenAddress][tokenId] = true;\n unchecked {\n ++i;\n }\n }\n\n if (weight == 0) revert NoVotingWeight();\n\n ProposalVotes storage proposal = proposalVotes[_proposalId];\n\n if (proposal.votingEndBlock == 0) revert InvalidProposal();\n\n if (block.number > proposal.votingEndBlock) revert VotingEnded();\n\n if (_voteType == uint8(VoteType.NO)) {\n proposal.noVotes += weight;\n } else if (_voteType == uint8(VoteType.YES)) {\n proposal.yesVotes += weight;\n } else if (_voteType == uint8(VoteType.ABSTAIN)) {\n proposal.abstainVotes += weight;\n } else {\n revert InvalidVote();\n }\n\n emit Voted(_voter, _proposalId, _voteType, _tokenAddresses, _tokenIds);\n }\n}\n" + }, + "contracts/azorius/LinearERC721VotingWithHatsProposalCreation.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport {LinearERC721VotingExtensible} from \"./LinearERC721VotingExtensible.sol\";\nimport {HatsProposalCreationWhitelist} from \"./HatsProposalCreationWhitelist.sol\";\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\n\n/**\n * An [Azorius](./Azorius.md) [BaseStrategy](./BaseStrategy.md) implementation that\n * enables linear (i.e. 1 to 1) ERC721 based token voting, with proposal creation\n * restricted to users wearing whitelisted Hats.\n */\ncontract LinearERC721VotingWithHatsProposalCreation is\n HatsProposalCreationWhitelist,\n LinearERC721VotingExtensible\n{\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address[] memory _tokens`, `uint256[] memory _weights`, `address _azoriusModule`,\n * `uint32 _votingPeriod`, `uint256 _quorumThreshold`, `uint256 _basisNumerator`,\n * `address _hatsContract`, `uint256[] _initialWhitelistedHats`\n */\n function setUp(\n bytes memory initializeParams\n )\n public\n override(HatsProposalCreationWhitelist, LinearERC721VotingExtensible)\n {\n (\n address _owner,\n address[] memory _tokens,\n uint256[] memory _weights,\n address _azoriusModule,\n uint32 _votingPeriod,\n uint256 _quorumThreshold,\n uint256 _basisNumerator,\n address _hatsContract,\n uint256[] memory _initialWhitelistedHats\n ) = abi.decode(\n initializeParams,\n (\n address,\n address[],\n uint256[],\n address,\n uint32,\n uint256,\n uint256,\n address,\n uint256[]\n )\n );\n\n LinearERC721VotingExtensible.setUp(\n abi.encode(\n _owner,\n _tokens,\n _weights,\n _azoriusModule,\n _votingPeriod,\n _quorumThreshold,\n 0, // _proposerThreshold is zero because we only care about the hat check\n _basisNumerator\n )\n );\n\n HatsProposalCreationWhitelist.setUp(\n abi.encode(_hatsContract, _initialWhitelistedHats)\n );\n }\n\n /** @inheritdoc HatsProposalCreationWhitelist*/\n function isProposer(\n address _address\n )\n public\n view\n override(HatsProposalCreationWhitelist, LinearERC721VotingExtensible)\n returns (bool)\n {\n return HatsProposalCreationWhitelist.isProposer(_address);\n }\n}\n" + }, + "contracts/AzoriusFreezeGuard.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { IBaseFreezeVoting } from \"./interfaces/IBaseFreezeVoting.sol\";\nimport { IGuard } from \"@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol\";\nimport { FactoryFriendly } from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport { BaseGuard } from \"@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol\";\n\n/**\n * A Safe Transaction Guard contract that prevents an [Azorius](./azorius/Azorius.md) \n * subDAO from executing transactions if it has been frozen by its parentDAO.\n *\n * See https://docs.safe.global/learn/safe-core/safe-core-protocol/guards.\n */\ncontract AzoriusFreezeGuard is FactoryFriendly, IGuard, BaseGuard {\n\n /**\n * A reference to the freeze voting contract, which manages the freeze\n * voting process and maintains the frozen / unfrozen state of the DAO.\n */\n IBaseFreezeVoting public freezeVoting;\n\n event AzoriusFreezeGuardSetUp(\n address indexed creator,\n address indexed owner,\n address indexed freezeVoting\n );\n\n error DAOFrozen();\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address _freezeVoting`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n __Ownable_init();\n (address _owner, address _freezeVoting) = abi.decode(\n initializeParams,\n (address, address)\n );\n\n transferOwnership(_owner);\n freezeVoting = IBaseFreezeVoting(_freezeVoting);\n\n emit AzoriusFreezeGuardSetUp(msg.sender, _owner, _freezeVoting);\n }\n\n /**\n * This function is called by the Safe to check if the transaction\n * is able to be executed and reverts if the guard conditions are\n * not met.\n *\n * In our implementation, this reverts if the DAO is frozen.\n */\n function checkTransaction(\n address,\n uint256,\n bytes memory,\n Enum.Operation,\n uint256,\n uint256,\n uint256,\n address,\n address payable,\n bytes memory,\n address\n ) external view override(BaseGuard, IGuard) {\n // if the DAO is currently frozen, revert\n // see BaseFreezeVoting for freeze voting details\n if(freezeVoting.isFrozen()) revert DAOFrozen();\n }\n\n /**\n * A callback performed after a transaction is executed on the Safe. This is a required\n * function of the `BaseGuard` and `IGuard` interfaces that we do not make use of.\n */\n function checkAfterExecution(bytes32, bool) external view override(BaseGuard, IGuard) {\n // not implementated\n }\n}\n" + }, + "contracts/BaseFreezeVoting.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { FactoryFriendly } from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport { IBaseFreezeVoting } from \"./interfaces/IBaseFreezeVoting.sol\";\n\n/**\n * The base abstract contract which holds the state of a vote to freeze a childDAO.\n *\n * The freeze feature gives a way for parentDAOs to have a limited measure of control\n * over their created subDAOs.\n *\n * Normally a subDAO operates independently, and can vote on or sign transactions, \n * however should the parent disagree with a decision made by the subDAO, any parent\n * token holder can initiate a vote to \"freeze\" it, making executing transactions impossible\n * for the time denoted by `freezePeriod`.\n *\n * This requires a number of votes equal to `freezeVotesThreshold`, within the `freezeProposalPeriod`\n * to be successful.\n *\n * Following a successful freeze vote, the childDAO will be unable to execute transactions, due to\n * a Safe Transaction Guard, until the `freezePeriod` has elapsed.\n */\nabstract contract BaseFreezeVoting is FactoryFriendly, IBaseFreezeVoting {\n\n /** Block number the freeze proposal was created at. */\n uint32 public freezeProposalCreatedBlock;\n\n /** Number of blocks a freeze proposal has to succeed. */\n uint32 public freezeProposalPeriod;\n\n /** Number of blocks a freeze lasts, from time of freeze proposal creation. */\n uint32 public freezePeriod;\n\n /** Number of freeze votes required to activate a freeze. */\n uint256 public freezeVotesThreshold;\n\n /** Number of accrued freeze votes. */\n uint256 public freezeProposalVoteCount;\n\n /**\n * Mapping of address to the block the freeze vote was started to \n * whether the address has voted yet on the freeze proposal.\n */\n mapping(address => mapping(uint256 => bool)) public userHasFreezeVoted;\n\n event FreezeVoteCast(address indexed voter, uint256 votesCast);\n event FreezeProposalCreated(address indexed creator);\n event FreezeVotesThresholdUpdated(uint256 freezeVotesThreshold);\n event FreezePeriodUpdated(uint32 freezePeriod);\n event FreezeProposalPeriodUpdated(uint32 freezeProposalPeriod);\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Casts a positive vote to freeze the subDAO. This function is intended to be called\n * by the individual token holders themselves directly, and will allot their token\n * holdings a \"yes\" votes towards freezing.\n *\n * Additionally, if a vote to freeze is not already running, calling this will initiate\n * a new vote to freeze it.\n */\n function castFreezeVote() external virtual;\n\n /**\n * Returns true if the DAO is currently frozen, false otherwise.\n * \n * @return bool whether the DAO is currently frozen\n */\n function isFrozen() external view returns (bool) {\n return freezeProposalVoteCount >= freezeVotesThreshold \n && block.number < freezeProposalCreatedBlock + freezePeriod;\n }\n\n /**\n * Unfreezes the DAO, only callable by the owner (parentDAO).\n */\n function unfreeze() external onlyOwner {\n freezeProposalCreatedBlock = 0;\n freezeProposalVoteCount = 0;\n }\n\n /**\n * Updates the freeze votes threshold, the number of votes required to enact a freeze.\n *\n * @param _freezeVotesThreshold number of freeze votes required to activate a freeze\n */\n function updateFreezeVotesThreshold(uint256 _freezeVotesThreshold) external onlyOwner {\n _updateFreezeVotesThreshold(_freezeVotesThreshold);\n }\n\n /**\n * Updates the freeze proposal period, the time that parent token holders have to cast votes\n * after a freeze vote has been initiated.\n *\n * @param _freezeProposalPeriod number of blocks a freeze vote has to succeed to enact a freeze\n */\n function updateFreezeProposalPeriod(uint32 _freezeProposalPeriod) external onlyOwner {\n _updateFreezeProposalPeriod(_freezeProposalPeriod);\n }\n\n /**\n * Updates the freeze period, the time the DAO will be unable to execute transactions for,\n * should a freeze vote pass.\n *\n * @param _freezePeriod number of blocks a freeze lasts, from time of freeze proposal creation\n */\n function updateFreezePeriod(uint32 _freezePeriod) external onlyOwner {\n _updateFreezePeriod(_freezePeriod);\n }\n\n /** Internal implementation of `updateFreezeVotesThreshold`. */\n function _updateFreezeVotesThreshold(uint256 _freezeVotesThreshold) internal {\n freezeVotesThreshold = _freezeVotesThreshold;\n emit FreezeVotesThresholdUpdated(_freezeVotesThreshold);\n }\n\n /** Internal implementation of `updateFreezeProposalPeriod`. */\n function _updateFreezeProposalPeriod(uint32 _freezeProposalPeriod) internal {\n freezeProposalPeriod = _freezeProposalPeriod;\n emit FreezeProposalPeriodUpdated(_freezeProposalPeriod);\n }\n\n /** Internal implementation of `updateFreezePeriod`. */\n function _updateFreezePeriod(uint32 _freezePeriod) internal {\n freezePeriod = _freezePeriod;\n emit FreezePeriodUpdated(_freezePeriod);\n }\n}\n" + }, + "contracts/DecentHats_0_1_0.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport {Enum} from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport {IAvatar} from \"@gnosis.pm/zodiac/contracts/interfaces/IAvatar.sol\";\nimport {Strings} from \"@openzeppelin/contracts/utils/Strings.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IERC6551Registry} from \"./interfaces/IERC6551Registry.sol\";\nimport {IHats} from \"./interfaces/hats/IHats.sol\";\nimport {ISablierV2LockupLinear} from \"./interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {LockupLinear} from \"./interfaces/sablier/LockupLinear.sol\";\n\ncontract DecentHats_0_1_0 {\n string public constant NAME = \"DecentHats_0_1_0\";\n\n struct SablierStreamParams {\n ISablierV2LockupLinear sablier;\n address sender;\n uint128 totalAmount;\n address asset;\n bool cancelable;\n bool transferable;\n LockupLinear.Timestamps timestamps;\n LockupLinear.Broker broker;\n }\n\n struct Hat {\n uint32 maxSupply;\n string details;\n string imageURI;\n bool isMutable;\n address wearer;\n SablierStreamParams[] sablierParams; // Optional Sablier stream parameters\n }\n\n struct CreateTreeParams {\n IHats hatsProtocol;\n address hatsAccountImplementation;\n IERC6551Registry registry;\n address keyValuePairs;\n string topHatDetails;\n string topHatImageURI;\n Hat adminHat;\n Hat[] hats;\n }\n\n function getSalt() internal view returns (bytes32 salt) {\n uint256 chainId;\n assembly {\n chainId := chainid()\n }\n\n bytes memory concatenatedSaltInput = abi.encodePacked(\n NAME,\n chainId,\n address(this)\n );\n\n salt = keccak256(concatenatedSaltInput);\n }\n\n function updateKeyValuePairs(\n address _keyValuePairs,\n uint256 topHatId\n ) internal {\n string[] memory keys = new string[](1);\n string[] memory values = new string[](1);\n keys[0] = \"topHatId\";\n values[0] = Strings.toString(topHatId);\n\n IAvatar(msg.sender).execTransactionFromModule(\n _keyValuePairs,\n 0,\n abi.encodeWithSignature(\n \"updateValues(string[],string[])\",\n keys,\n values\n ),\n Enum.Operation.Call\n );\n }\n\n function createHat(\n IHats _hatsProtocol,\n uint256 adminHatId,\n Hat memory _hat,\n address topHatAccount\n ) internal returns (uint256) {\n return\n _hatsProtocol.createHat(\n adminHatId,\n _hat.details,\n _hat.maxSupply,\n topHatAccount,\n topHatAccount,\n _hat.isMutable,\n _hat.imageURI\n );\n }\n\n function createAccount(\n IERC6551Registry _registry,\n address _hatsAccountImplementation,\n bytes32 salt,\n address protocolAddress,\n uint256 hatId\n ) internal returns (address) {\n return\n _registry.createAccount(\n _hatsAccountImplementation,\n salt,\n block.chainid,\n protocolAddress,\n hatId\n );\n }\n\n function createTopHatAndAccount(\n IHats _hatsProtocol,\n string memory _topHatDetails,\n string memory _topHatImageURI,\n IERC6551Registry _registry,\n address _hatsAccountImplementation,\n bytes32 salt\n ) internal returns (uint256 topHatId, address topHatAccount) {\n topHatId = _hatsProtocol.mintTopHat(\n address(this),\n _topHatDetails,\n _topHatImageURI\n );\n\n topHatAccount = createAccount(\n _registry,\n _hatsAccountImplementation,\n salt,\n address(_hatsProtocol),\n topHatId\n );\n }\n\n function createHatAndAccountAndMintAndStreams(\n IHats hatsProtocol,\n uint256 adminHatId,\n Hat calldata hat,\n address topHatAccount,\n IERC6551Registry registry,\n address hatsAccountImplementation,\n bytes32 salt\n ) internal returns (uint256 hatId, address accountAddress) {\n hatId = createHat(hatsProtocol, adminHatId, hat, topHatAccount);\n\n accountAddress = createAccount(\n registry,\n hatsAccountImplementation,\n salt,\n address(hatsProtocol),\n hatId\n );\n\n if (hat.wearer != address(0)) {\n hatsProtocol.mintHat(hatId, hat.wearer);\n }\n\n for (uint256 i = 0; i < hat.sablierParams.length; ) {\n SablierStreamParams memory sablierParams = hat.sablierParams[i];\n\n // Approve tokens for Sablier\n IAvatar(msg.sender).execTransactionFromModule(\n sablierParams.asset,\n 0,\n abi.encodeWithSignature(\n \"approve(address,uint256)\",\n address(sablierParams.sablier),\n sablierParams.totalAmount\n ),\n Enum.Operation.Call\n );\n\n LockupLinear.CreateWithTimestamps memory params = LockupLinear\n .CreateWithTimestamps({\n sender: sablierParams.sender,\n recipient: accountAddress,\n totalAmount: sablierParams.totalAmount,\n asset: IERC20(sablierParams.asset),\n cancelable: sablierParams.cancelable,\n transferable: sablierParams.transferable,\n timestamps: sablierParams.timestamps,\n broker: sablierParams.broker\n });\n\n // Proxy the Sablier call through IAvatar\n IAvatar(msg.sender).execTransactionFromModule(\n address(sablierParams.sablier),\n 0,\n abi.encodeWithSignature(\n \"createWithTimestamps((address,address,uint128,address,bool,bool,(uint40,uint40,uint40),(address,uint256)))\",\n params\n ),\n Enum.Operation.Call\n );\n\n unchecked {\n ++i;\n }\n }\n }\n\n function createAndDeclareTree(CreateTreeParams calldata params) public {\n bytes32 salt = getSalt();\n\n (uint256 topHatId, address topHatAccount) = createTopHatAndAccount(\n params.hatsProtocol,\n params.topHatDetails,\n params.topHatImageURI,\n params.registry,\n params.hatsAccountImplementation,\n salt\n );\n\n updateKeyValuePairs(params.keyValuePairs, topHatId);\n\n (uint256 adminHatId, ) = createHatAndAccountAndMintAndStreams(\n params.hatsProtocol,\n topHatId,\n params.adminHat,\n topHatAccount,\n params.registry,\n params.hatsAccountImplementation,\n salt\n );\n\n for (uint256 i = 0; i < params.hats.length; ) {\n createHatAndAccountAndMintAndStreams(\n params.hatsProtocol,\n adminHatId,\n params.hats[i],\n topHatAccount,\n params.registry,\n params.hatsAccountImplementation,\n salt\n );\n\n unchecked {\n ++i;\n }\n }\n\n params.hatsProtocol.transferHat(topHatId, address(this), msg.sender);\n }\n}\n" + }, + "contracts/ERC20Claim.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport {IERC20Claim} from \"./interfaces/IERC20Claim.sol\";\nimport {VotesERC20, FactoryFriendly} from \"./VotesERC20.sol\";\nimport {SafeERC20, IERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/**\n * A simple contract that allows for parent DAOs that have created a new ERC-20\n * token voting subDAO to allocate a certain amount of those tokens as claimable\n * by the parent DAO's token holders.\n */\ncontract ERC20Claim is FactoryFriendly, IERC20Claim {\n\n using SafeERC20 for IERC20;\n\n /** The deadline block to claim tokens by, or 0 for indefinite. */\n uint32 public deadlineBlock;\n\n /** The address of the initial holder of the claimable `childERC20` tokens. */\n address public funder;\n\n /** Child ERC20 token address, to calculate the percentage claimable. */\n address public childERC20;\n\n /** Parent ERC20 token address, for calculating a snapshot of holdings. */\n address public parentERC20;\n\n /** Id of a snapshot of token holdings for this claim (see [VotesERC20](./VotesERC20.md)). */\n uint256 public snapShotId;\n\n /** Total amount of `childERC20` tokens allocated for claiming by parent holders. */\n uint256 public parentAllocation;\n\n /** Mapping of address to bool of whether the address has claimed already. */\n mapping(address => bool) public claimed;\n\n event ERC20ClaimCreated(\n address parentToken,\n address childToken,\n uint256 parentAllocation,\n uint256 snapshotId,\n uint256 deadline\n );\n\n event ERC20Claimed(\n address indexed pToken,\n address indexed cToken,\n address indexed claimer,\n uint256 amount\n );\n\n error NoAllocation();\n error AllocationClaimed();\n error NotTheFunder();\n error NoDeadline();\n error DeadlinePending();\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _childTokenFunder`,\n * `uint256 _deadlineBlock`, `address _parentERC20`, `address _childERC20`,\n * `uint256 _parentAllocation`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n __Ownable_init();\n (\n uint32 _deadlineBlock,\n address _childTokenFunder,\n address _parentERC20,\n address _childERC20,\n uint256 _parentAllocation\n ) = abi.decode(\n initializeParams,\n (uint32, address, address, address, uint256)\n );\n\n funder = _childTokenFunder;\n deadlineBlock = _deadlineBlock;\n childERC20 = _childERC20;\n parentERC20 = _parentERC20;\n parentAllocation = _parentAllocation;\n\n snapShotId = VotesERC20(_parentERC20).captureSnapShot();\n\n IERC20(_childERC20).safeTransferFrom(\n _childTokenFunder,\n address(this),\n _parentAllocation\n );\n\n emit ERC20ClaimCreated(\n _parentERC20,\n _childERC20,\n _parentAllocation,\n snapShotId,\n _deadlineBlock\n );\n }\n\n /** @inheritdoc IERC20Claim*/\n function claimTokens(address claimer) external {\n uint256 amount = getClaimAmount(claimer); // get claimer balance\n\n if (amount == 0) revert NoAllocation(); // the claimer has not been allocated tokens to claim\n\n claimed[claimer] = true;\n\n IERC20(childERC20).safeTransfer(claimer, amount); // transfer claimer balance\n\n emit ERC20Claimed(parentERC20, childERC20, claimer, amount);\n }\n\n /** @inheritdoc IERC20Claim*/\n function reclaim() external {\n if (msg.sender != funder) revert NotTheFunder();\n if (deadlineBlock == 0) revert NoDeadline();\n if (block.number < deadlineBlock) revert DeadlinePending();\n IERC20 token = IERC20(childERC20);\n token.safeTransfer(funder, token.balanceOf(address(this)));\n }\n\n /** @inheritdoc IERC20Claim*/\n function getClaimAmount(address claimer) public view returns (uint256) {\n return\n claimed[claimer]\n ? 0\n : (VotesERC20(parentERC20).balanceOfAt(claimer, snapShotId) *\n parentAllocation) /\n VotesERC20(parentERC20).totalSupplyAt(snapShotId);\n }\n}\n" + }, + "contracts/ERC20FreezeVoting.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { BaseFreezeVoting, IBaseFreezeVoting } from \"./BaseFreezeVoting.sol\";\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport { IVotes } from \"@openzeppelin/contracts/governance/utils/IVotes.sol\";\n\n/**\n * A [BaseFreezeVoting](./BaseFreezeVoting.md) implementation which handles \n * freezes on ERC20 based token voting DAOs.\n */\ncontract ERC20FreezeVoting is BaseFreezeVoting {\n\n /** A reference to the ERC20 voting token of the subDAO. */\n IVotes public votesERC20;\n\n event ERC20FreezeVotingSetUp(\n address indexed owner,\n address indexed votesERC20\n );\n\n error NoVotes();\n error AlreadyVoted();\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `uint256 _freezeVotesThreshold`, `uint256 _freezeProposalPeriod`, `uint256 _freezePeriod`,\n * `address _votesERC20`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n uint256 _freezeVotesThreshold,\n uint32 _freezeProposalPeriod,\n uint32 _freezePeriod,\n address _votesERC20\n ) = abi.decode(\n initializeParams,\n (address, uint256, uint32, uint32, address)\n );\n\n __Ownable_init();\n _transferOwnership(_owner);\n _updateFreezeVotesThreshold(_freezeVotesThreshold);\n _updateFreezeProposalPeriod(_freezeProposalPeriod);\n _updateFreezePeriod(_freezePeriod);\n freezePeriod = _freezePeriod;\n votesERC20 = IVotes(_votesERC20);\n\n emit ERC20FreezeVotingSetUp(_owner, _votesERC20);\n }\n\n /** @inheritdoc BaseFreezeVoting*/\n function castFreezeVote() external override {\n uint256 userVotes;\n\n if (block.number > freezeProposalCreatedBlock + freezeProposalPeriod) {\n // create a new freeze proposal and set total votes to msg.sender's vote count\n\n freezeProposalCreatedBlock = uint32(block.number);\n\n userVotes = votesERC20.getPastVotes(\n msg.sender,\n freezeProposalCreatedBlock - 1\n );\n\n if (userVotes == 0) revert NoVotes();\n\n freezeProposalVoteCount = userVotes;\n\n emit FreezeProposalCreated(msg.sender);\n } else {\n // there is an existing freeze proposal, count user's votes toward it\n\n if (userHasFreezeVoted[msg.sender][freezeProposalCreatedBlock])\n revert AlreadyVoted();\n\n userVotes = votesERC20.getPastVotes(\n msg.sender,\n freezeProposalCreatedBlock - 1\n );\n\n if (userVotes == 0) revert NoVotes();\n\n freezeProposalVoteCount += userVotes;\n } \n\n userHasFreezeVoted[msg.sender][freezeProposalCreatedBlock] = true;\n\n emit FreezeVoteCast(msg.sender, userVotes);\n }\n}\n" + }, + "contracts/ERC721FreezeVoting.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { IERC721VotingStrategy } from \"./azorius/interfaces/IERC721VotingStrategy.sol\";\nimport { BaseFreezeVoting, IBaseFreezeVoting } from \"./BaseFreezeVoting.sol\";\nimport { IERC721 } from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * A [BaseFreezeVoting](./BaseFreezeVoting.md) implementation which handles \n * freezes on ERC721 based token voting DAOs.\n */\ncontract ERC721FreezeVoting is BaseFreezeVoting {\n\n /** A reference to the voting strategy of the parent DAO. */\n IERC721VotingStrategy public strategy;\n\n /**\n * Mapping of block the freeze vote was started on, to the token address, to token id,\n * to whether that token has been used to vote already.\n */\n mapping(uint256 => mapping(address => mapping(uint256 => bool))) public idHasFreezeVoted;\n\n event ERC721FreezeVotingSetUp(address indexed owner, address indexed strategy);\n\n error NoVotes();\n error NotSupported();\n error UnequalArrays();\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters.\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n uint256 _freezeVotesThreshold,\n uint32 _freezeProposalPeriod,\n uint32 _freezePeriod,\n address _strategy\n ) = abi.decode(\n initializeParams,\n (address, uint256, uint32, uint32, address)\n );\n\n __Ownable_init();\n _transferOwnership(_owner);\n _updateFreezeVotesThreshold(_freezeVotesThreshold);\n _updateFreezeProposalPeriod(_freezeProposalPeriod);\n _updateFreezePeriod(_freezePeriod);\n freezePeriod = _freezePeriod;\n strategy = IERC721VotingStrategy(_strategy);\n\n emit ERC721FreezeVotingSetUp(_owner, _strategy);\n }\n\n function castFreezeVote() external override pure { revert NotSupported(); }\n\n function castFreezeVote(address[] memory _tokenAddresses, uint256[] memory _tokenIds) external {\n if (_tokenAddresses.length != _tokenIds.length) revert UnequalArrays();\n\n if (block.number > freezeProposalCreatedBlock + freezeProposalPeriod) {\n // create a new freeze proposal\n freezeProposalCreatedBlock = uint32(block.number);\n freezeProposalVoteCount = 0;\n emit FreezeProposalCreated(msg.sender);\n }\n\n uint256 userVotes = _getVotesAndUpdateHasVoted(_tokenAddresses, _tokenIds, msg.sender);\n if (userVotes == 0) revert NoVotes();\n\n freezeProposalVoteCount += userVotes; \n\n emit FreezeVoteCast(msg.sender, userVotes);\n }\n\n function _getVotesAndUpdateHasVoted(\n address[] memory _tokenAddresses,\n uint256[] memory _tokenIds,\n address _voter\n ) internal returns (uint256) {\n\n uint256 votes = 0;\n\n for (uint256 i = 0; i < _tokenAddresses.length; i++) {\n\n address tokenAddress = _tokenAddresses[i];\n uint256 tokenId = _tokenIds[i];\n\n if (_voter != IERC721(tokenAddress).ownerOf(tokenId))\n continue;\n\n if (idHasFreezeVoted[freezeProposalCreatedBlock][tokenAddress][tokenId])\n continue;\n \n votes += strategy.getTokenWeight(tokenAddress);\n\n idHasFreezeVoted[freezeProposalCreatedBlock][tokenAddress][tokenId] = true;\n }\n\n return votes;\n }\n}\n" + }, + "contracts/FractalModule.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Module, Enum } from \"@gnosis.pm/zodiac/contracts/core/Module.sol\";\nimport { IFractalModule } from \"./interfaces/IFractalModule.sol\";\n\n /**\n * Implementation of [IFractalModule](./interfaces/IFractalModule.md).\n *\n * A Safe module contract that allows for a \"parent-child\" DAO relationship.\n *\n * Adding the module allows for a designated set of addresses to execute\n * transactions on the Safe, which in our implementation is the set of parent\n * DAOs.\n */\ncontract FractalModule is IFractalModule, Module {\n\n /** Mapping of whether an address is a controller (typically a parentDAO). */\n mapping(address => bool) public controllers;\n\n event ControllersAdded(address[] controllers);\n event ControllersRemoved(address[] controllers);\n\n error Unauthorized();\n error TxFailed();\n\n /** Allows only authorized controllers to execute transactions on the Safe. */\n modifier onlyAuthorized() {\n if (owner() != msg.sender && !controllers[msg.sender])\n revert Unauthorized();\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `address _avatar`, `address _target`, `address[] memory _controllers`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n __Ownable_init();\n (\n address _owner, // controlling DAO\n address _avatar,\n address _target,\n address[] memory _controllers // authorized controllers\n ) = abi.decode(\n initializeParams,\n (address, address, address, address[])\n );\n\n setAvatar(_avatar);\n setTarget(_target);\n addControllers(_controllers);\n transferOwnership(_owner);\n }\n\n /** @inheritdoc IFractalModule*/\n function removeControllers(address[] memory _controllers) external onlyOwner {\n uint256 controllersLength = _controllers.length;\n for (uint256 i; i < controllersLength; ) {\n controllers[_controllers[i]] = false;\n unchecked {\n ++i;\n }\n }\n emit ControllersRemoved(_controllers);\n }\n\n /** @inheritdoc IFractalModule*/\n function execTx(bytes memory execTxData) public onlyAuthorized {\n (\n address _target,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation\n ) = abi.decode(execTxData, (address, uint256, bytes, Enum.Operation));\n if(!exec(_target, _value, _data, _operation)) revert TxFailed();\n }\n\n /** @inheritdoc IFractalModule*/\n function addControllers(address[] memory _controllers) public onlyOwner {\n uint256 controllersLength = _controllers.length;\n for (uint256 i; i < controllersLength; ) {\n controllers[_controllers[i]] = true;\n unchecked {\n ++i;\n }\n }\n emit ControllersAdded(_controllers);\n }\n}\n" + }, + "contracts/FractalRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { IFractalRegistry } from \"./interfaces/IFractalRegistry.sol\";\n\n/**\n * Implementation of [IFractalRegistry](./interfaces/IFractalRegistry.md).\n */\ncontract FractalRegistry is IFractalRegistry {\n\n event FractalNameUpdated(address indexed daoAddress, string daoName);\n event FractalSubDAODeclared(address indexed parentDAOAddress, address indexed subDAOAddress);\n\n /** @inheritdoc IFractalRegistry*/\n function updateDAOName(string memory _name) external {\n emit FractalNameUpdated(msg.sender, _name);\n }\n\n /** @inheritdoc IFractalRegistry*/\n function declareSubDAO(address _subDAOAddress) external {\n emit FractalSubDAODeclared(msg.sender, _subDAOAddress);\n }\n}\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/GnosisSafeL2.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/libraries/MultiSendCallOnly.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/safe-contracts/contracts/proxies/GnosisSafeProxyFactory.sol';\n" + }, + "contracts/hardhat-dependency-compiler/@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@gnosis.pm/zodiac/contracts/factory/ModuleProxyFactory.sol';\n" + }, + "contracts/interfaces/hats/full/HatsErrors.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsErrors {\n /// @notice Emitted when `user` is attempting to perform an action on `hatId` but is not wearing one of `hatId`'s admin hats\n /// @dev Can be equivalent to `NotHatWearer(buildHatId(hatId))`, such as when emitted by `approveLinkTopHatToTree` or `relinkTopHatToTree`\n error NotAdmin(address user, uint256 hatId);\n\n /// @notice Emitted when attempting to perform an action as or for an account that is not a wearer of a given hat\n error NotHatWearer();\n\n /// @notice Emitted when attempting to perform an action that requires being either an admin or wearer of a given hat\n error NotAdminOrWearer();\n\n /// @notice Emitted when attempting to mint `hatId` but `hatId`'s maxSupply has been reached\n error AllHatsWorn(uint256 hatId);\n\n /// @notice Emitted when attempting to create a hat with a level 14 hat as its admin\n error MaxLevelsReached();\n\n /// @notice Emitted when an attempted hat id has empty intermediate level(s)\n error InvalidHatId();\n\n /// @notice Emitted when attempting to mint `hatId` to a `wearer` who is already wearing the hat\n error AlreadyWearingHat(address wearer, uint256 hatId);\n\n /// @notice Emitted when attempting to mint a non-existant hat\n error HatDoesNotExist(uint256 hatId);\n\n /// @notice Emmitted when attempting to mint or transfer a hat that is not active\n error HatNotActive();\n\n /// @notice Emitted when attempting to mint or transfer a hat to an ineligible wearer\n error NotEligible();\n\n /// @notice Emitted when attempting to check or set a hat's status from an account that is not that hat's toggle module\n error NotHatsToggle();\n\n /// @notice Emitted when attempting to check or set a hat wearer's status from an account that is not that hat's eligibility module\n error NotHatsEligibility();\n\n /// @notice Emitted when array arguments to a batch function have mismatching lengths\n error BatchArrayLengthMismatch();\n\n /// @notice Emitted when attempting to mutate or transfer an immutable hat\n error Immutable();\n\n /// @notice Emitted when attempting to change a hat's maxSupply to a value lower than its current supply\n error NewMaxSupplyTooLow();\n\n /// @notice Emitted when attempting to link a tophat to a new admin for which the tophat serves as an admin\n error CircularLinkage();\n\n /// @notice Emitted when attempting to link or relink a tophat to a separate tree\n error CrossTreeLinkage();\n\n /// @notice Emitted when attempting to link a tophat without a request\n error LinkageNotRequested();\n\n /// @notice Emitted when attempting to unlink a tophat that does not have a wearer\n /// @dev This ensures that unlinking never results in a bricked tophat\n error InvalidUnlink();\n\n /// @notice Emmited when attempting to change a hat's eligibility or toggle module to the zero address\n error ZeroAddress();\n\n /// @notice Emmitted when attempting to change a hat's details or imageURI to a string with over 7000 bytes (~characters)\n /// @dev This protects against a DOS attack where an admin iteratively extend's a hat's details or imageURI\n /// to be so long that reading it exceeds the block gas limit, breaking `uri()` and `viewHat()`\n error StringTooLong();\n}\n" + }, + "contracts/interfaces/hats/full/HatsEvents.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface HatsEvents {\n /// @notice Emitted when a new hat is created\n /// @param id The id for the new hat\n /// @param details A description of the Hat\n /// @param maxSupply The total instances of the Hat that can be worn at once\n /// @param eligibility The address that can report on the Hat wearer's status\n /// @param toggle The address that can deactivate the Hat\n /// @param mutable_ Whether the hat's properties are changeable after creation\n /// @param imageURI The image uri for this hat and the fallback for its\n event HatCreated(\n uint256 id,\n string details,\n uint32 maxSupply,\n address eligibility,\n address toggle,\n bool mutable_,\n string imageURI\n );\n\n /// @notice Emitted when a hat wearer's standing is updated\n /// @dev Eligibility is excluded since the source of truth for eligibility is the eligibility module and may change without a transaction\n /// @param hatId The id of the wearer's hat\n /// @param wearer The wearer's address\n /// @param wearerStanding Whether the wearer is in good standing for the hat\n event WearerStandingChanged(\n uint256 hatId,\n address wearer,\n bool wearerStanding\n );\n\n /// @notice Emitted when a hat's status is updated\n /// @param hatId The id of the hat\n /// @param newStatus Whether the hat is active\n event HatStatusChanged(uint256 hatId, bool newStatus);\n\n /// @notice Emitted when a hat's details are updated\n /// @param hatId The id of the hat\n /// @param newDetails The updated details\n event HatDetailsChanged(uint256 hatId, string newDetails);\n\n /// @notice Emitted when a hat's eligibility module is updated\n /// @param hatId The id of the hat\n /// @param newEligibility The updated eligibiliy module\n event HatEligibilityChanged(uint256 hatId, address newEligibility);\n\n /// @notice Emitted when a hat's toggle module is updated\n /// @param hatId The id of the hat\n /// @param newToggle The updated toggle module\n event HatToggleChanged(uint256 hatId, address newToggle);\n\n /// @notice Emitted when a hat's mutability is updated\n /// @param hatId The id of the hat\n event HatMutabilityChanged(uint256 hatId);\n\n /// @notice Emitted when a hat's maximum supply is updated\n /// @param hatId The id of the hat\n /// @param newMaxSupply The updated max supply\n event HatMaxSupplyChanged(uint256 hatId, uint32 newMaxSupply);\n\n /// @notice Emitted when a hat's image URI is updated\n /// @param hatId The id of the hat\n /// @param newImageURI The updated image URI\n event HatImageURIChanged(uint256 hatId, string newImageURI);\n\n /// @notice Emitted when a tophat linkage is requested by its admin\n /// @param domain The domain of the tree tophat to link\n /// @param newAdmin The tophat's would-be admin in the parent tree\n event TopHatLinkRequested(uint32 domain, uint256 newAdmin);\n\n /// @notice Emitted when a tophat is linked to a another tree\n /// @param domain The domain of the newly-linked tophat\n /// @param newAdmin The tophat's new admin in the parent tree\n event TopHatLinked(uint32 domain, uint256 newAdmin);\n}\n" + }, + "contracts/interfaces/hats/full/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\nimport \"./IHatsIdUtilities.sol\";\nimport \"./HatsErrors.sol\";\nimport \"./HatsEvents.sol\";\n\ninterface IHats is IHatsIdUtilities, HatsErrors, HatsEvents {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function batchCreateHats(\n uint256[] calldata _admins,\n string[] calldata _details,\n uint32[] calldata _maxSupplies,\n address[] memory _eligibilityModules,\n address[] memory _toggleModules,\n bool[] calldata _mutables,\n string[] calldata _imageURIs\n ) external returns (bool success);\n\n function getNextId(uint256 _admin) external view returns (uint256 nextId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function batchMintHats(\n uint256[] calldata _hatIds,\n address[] calldata _wearers\n ) external returns (bool success);\n\n function setHatStatus(\n uint256 _hatId,\n bool _newStatus\n ) external returns (bool toggled);\n\n function checkHatStatus(uint256 _hatId) external returns (bool toggled);\n\n function setHatWearerStatus(\n uint256 _hatId,\n address _wearer,\n bool _eligible,\n bool _standing\n ) external returns (bool updated);\n\n function checkHatWearerStatus(\n uint256 _hatId,\n address _wearer\n ) external returns (bool updated);\n\n function renounceHat(uint256 _hatId) external;\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n\n /*//////////////////////////////////////////////////////////////\n HATS ADMIN FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function makeHatImmutable(uint256 _hatId) external;\n\n function changeHatDetails(\n uint256 _hatId,\n string memory _newDetails\n ) external;\n\n function changeHatEligibility(\n uint256 _hatId,\n address _newEligibility\n ) external;\n\n function changeHatToggle(uint256 _hatId, address _newToggle) external;\n\n function changeHatImageURI(\n uint256 _hatId,\n string memory _newImageURI\n ) external;\n\n function changeHatMaxSupply(uint256 _hatId, uint32 _newMaxSupply) external;\n\n function requestLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat\n ) external;\n\n function approveLinkTopHatToTree(\n uint32 _topHatId,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n function unlinkTopHatFromTree(uint32 _topHatId, address _wearer) external;\n\n function relinkTopHatWithinTree(\n uint32 _topHatDomain,\n uint256 _newAdminHat,\n address _eligibility,\n address _toggle,\n string calldata _details,\n string calldata _imageURI\n ) external;\n\n /*//////////////////////////////////////////////////////////////\n VIEW FUNCTIONS\n //////////////////////////////////////////////////////////////*/\n\n function viewHat(\n uint256 _hatId\n )\n external\n view\n returns (\n string memory details,\n uint32 maxSupply,\n uint32 supply,\n address eligibility,\n address toggle,\n string memory imageURI,\n uint16 lastHatId,\n bool mutable_,\n bool active\n );\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isWearer);\n\n function isAdminOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool isAdmin);\n\n function isInGoodStanding(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool standing);\n\n function isEligible(\n address _wearer,\n uint256 _hatId\n ) external view returns (bool eligible);\n\n function getHatEligibilityModule(\n uint256 _hatId\n ) external view returns (address eligibility);\n\n function getHatToggleModule(\n uint256 _hatId\n ) external view returns (address toggle);\n\n function getHatMaxSupply(\n uint256 _hatId\n ) external view returns (uint32 maxSupply);\n\n function hatSupply(uint256 _hatId) external view returns (uint32 supply);\n\n function getImageURIForHat(\n uint256 _hatId\n ) external view returns (string memory _uri);\n\n function balanceOf(\n address wearer,\n uint256 hatId\n ) external view returns (uint256 balance);\n\n function balanceOfBatch(\n address[] calldata _wearers,\n uint256[] calldata _hatIds\n ) external view returns (uint256[] memory);\n\n function uri(uint256 id) external view returns (string memory _uri);\n}\n" + }, + "contracts/interfaces/hats/full/IHatsIdUtilities.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHatsIdUtilities {\n function buildHatId(\n uint256 _admin,\n uint16 _newHat\n ) external pure returns (uint256 id);\n\n function getHatLevel(uint256 _hatId) external view returns (uint32 level);\n\n function getLocalHatLevel(\n uint256 _hatId\n ) external pure returns (uint32 level);\n\n function isTopHat(uint256 _hatId) external view returns (bool _topHat);\n\n function isLocalTopHat(\n uint256 _hatId\n ) external pure returns (bool _localTopHat);\n\n function isValidHatId(\n uint256 _hatId\n ) external view returns (bool validHatId);\n\n function getAdminAtLevel(\n uint256 _hatId,\n uint32 _level\n ) external view returns (uint256 admin);\n\n function getAdminAtLocalLevel(\n uint256 _hatId,\n uint32 _level\n ) external pure returns (uint256 admin);\n\n function getTopHatDomain(\n uint256 _hatId\n ) external view returns (uint32 domain);\n\n function getTippyTopHatDomain(\n uint32 _topHatDomain\n ) external view returns (uint32 domain);\n\n function noCircularLinkage(\n uint32 _topHatDomain,\n uint256 _linkedAdmin\n ) external view returns (bool notCircular);\n\n function sameTippyTopHatDomain(\n uint32 _topHatDomain,\n uint256 _newAdminHat\n ) external view returns (bool sameDomain);\n}\n" + }, + "contracts/interfaces/hats/IHats.sol": { + "content": "// SPDX-License-Identifier: AGPL-3.0\n// Copyright (C) 2023 Haberdasher Labs\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see .\n\npragma solidity >=0.8.13;\n\ninterface IHats {\n function mintTopHat(\n address _target,\n string memory _details,\n string memory _imageURI\n ) external returns (uint256 topHatId);\n\n function createHat(\n uint256 _admin,\n string calldata _details,\n uint32 _maxSupply,\n address _eligibility,\n address _toggle,\n bool _mutable,\n string calldata _imageURI\n ) external returns (uint256 newHatId);\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success);\n\n function transferHat(uint256 _hatId, address _from, address _to) external;\n}\n" + }, + "contracts/interfaces/IBaseFreezeVoting.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\n/**\n * A specification for a contract which manages the ability to call for and cast a vote\n * to freeze a subDAO.\n *\n * The participants of this vote are parent token holders or signers. The DAO should be\n * able to operate as normal throughout the freeze voting process, however if the vote\n * passes, further transaction executions on the subDAO should be blocked via a Safe guard\n * module (see [MultisigFreezeGuard](../MultisigFreezeGuard.md) / [AzoriusFreezeGuard](../AzoriusFreezeGuard.md)).\n */\ninterface IBaseFreezeVoting {\n\n /**\n * Allows an address to cast a \"freeze vote\", which is a vote to freeze the DAO\n * from executing transactions, even if they've already passed via a Proposal.\n *\n * If a vote to freeze has not already been initiated, a call to this function will do\n * so.\n *\n * This function should be publicly callable by any DAO token holder or signer.\n */\n function castFreezeVote() external;\n\n /**\n * Unfreezes the DAO.\n */\n function unfreeze() external;\n\n /**\n * Updates the freeze votes threshold for future freeze votes. This is the number of token\n * votes necessary to begin a freeze on the subDAO.\n *\n * @param _freezeVotesThreshold number of freeze votes required to activate a freeze\n */\n function updateFreezeVotesThreshold(uint256 _freezeVotesThreshold) external;\n\n /**\n * Updates the freeze proposal period for future freeze votes. This is the length of time\n * (in blocks) that a freeze vote is conducted for.\n *\n * @param _freezeProposalPeriod number of blocks a freeze proposal has to succeed\n */\n function updateFreezeProposalPeriod(uint32 _freezeProposalPeriod) external;\n\n /**\n * Updates the freeze period. This is the length of time (in blocks) the subDAO is actually\n * frozen for if a freeze vote passes.\n *\n * This period can be overridden by a call to `unfreeze()`, which would require a passed Proposal\n * from the parentDAO.\n *\n * @param _freezePeriod number of blocks a freeze lasts, from time of freeze proposal creation\n */\n function updateFreezePeriod(uint32 _freezePeriod) external;\n\n /**\n * Returns true if the DAO is currently frozen, false otherwise.\n *\n * @return bool whether the DAO is currently frozen\n */\n function isFrozen() external view returns (bool);\n}\n" + }, + "contracts/interfaces/IERC20Claim.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\n/**\n * A simple specification for an ERC-20 claim contract, that allows for parent \n * DAOs that have created a new ERC-20 token voting subDAO to allocate a certain\n * amount of those tokens as claimable by the parent DAO token holders or signers.\n */\ninterface IERC20Claim {\n\n /**\n * Allows parent token holders to claim tokens allocated by a \n * subDAO during its creation.\n *\n * @param claimer address which is being claimed for, allowing any address to\n * process a claim for any other address\n */\n function claimTokens(address claimer) external;\n\n /**\n * Gets an address' token claim amount.\n *\n * @param claimer address to check the claim amount of\n * @return uint256 the given address' claim amount\n */\n function getClaimAmount(address claimer) external view returns (uint256);\n\n /**\n * Returns unclaimed tokens after the claim deadline to the funder.\n */\n function reclaim() external;\n}\n" + }, + "contracts/interfaces/IERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n}\n" + }, + "contracts/interfaces/IFractalModule.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * A specification for a Safe module contract that allows for a \"parent-child\"\n * DAO relationship.\n *\n * Adding the module should allow for a designated set of addresses to execute\n * transactions on the Safe, which in our implementation is the set of parent\n * DAOs.\n */\ninterface IFractalModule {\n\n /**\n * Allows an authorized address to execute arbitrary transactions on the Safe.\n *\n * @param execTxData data of the transaction to execute\n */\n function execTx(bytes memory execTxData) external;\n\n /**\n * Adds `_controllers` to the list of controllers, which are allowed\n * to execute transactions on the Safe.\n *\n * @param _controllers addresses to add to the contoller list\n */\n function addControllers(address[] memory _controllers) external;\n\n /**\n * Removes `_controllers` from the list of controllers.\n *\n * @param _controllers addresses to remove from the controller list\n */\n function removeControllers(address[] memory _controllers) external;\n}\n" + }, + "contracts/interfaces/IFractalRegistry.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\n/**\n * A utility contract which logs events pertaining to Fractal DAO metadata.\n */\ninterface IFractalRegistry {\n\n /**\n * Updates a DAO's registered \"name\". This is a simple string\n * with no restrictions or validation for uniqueness.\n *\n * @param _name new DAO name\n */\n function updateDAOName(string memory _name) external;\n\n /**\n * Declares an address as a subDAO of the caller's address.\n *\n * This declaration has no binding logic, and serves only\n * to allow us to find the list of \"potential\" subDAOs of any \n * given Safe address.\n *\n * Given the list of declaring events, we can then check each\n * Safe still has a [FractalModule](../FractalModule.md) attached.\n *\n * If no FractalModule is attached, we'll exclude it from the\n * DAO hierarchy.\n *\n * In the case of a Safe attaching a FractalModule without calling \n * to declare it, we would unfortunately not know to display it \n * as a subDAO.\n *\n * @param _subDAOAddress address of the subDAO to declare \n * as a child of the caller\n */\n function declareSubDAO(address _subDAOAddress) external;\n}\n" + }, + "contracts/interfaces/IKeyValuePairs.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\n/**\n * A utility contract to log key / value pair events for the calling address.\n */\ninterface IKeyValuePairs {\n\n /**\n * Logs the given key / value pairs, along with the caller's address.\n *\n * @param _keys the keys\n * @param _values the values\n */\n function updateValues(string[] memory _keys, string[] memory _values) external;\n}\n" + }, + "contracts/interfaces/IMultisigFreezeGuard.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\n/**\n * A specification for a Safe Guard contract which allows for multi-sig DAOs (Safes)\n * to operate in a fashion similar to [Azorius](../azorius/Azorius.md) token voting DAOs.\n *\n * This Guard is intended to add a timelock period and execution period to a Safe\n * multi-sig contract, allowing parent DAOs to have the ability to properly\n * freeze multi-sig subDAOs.\n *\n * Without a timelock period, a vote to freeze the Safe would not be possible\n * as the multi-sig child could immediately execute any transactions they would like\n * in response.\n *\n * An execution period is also required. This is to prevent executing the transaction after\n * a potential freeze period is enacted. Without it a subDAO could just wait for a freeze\n * period to elapse and then execute their desired transaction.\n *\n * See https://docs.safe.global/learn/safe-core/safe-core-protocol/guards.\n */\ninterface IMultisigFreezeGuard {\n\n /**\n * Allows the caller to begin the `timelock` of a transaction.\n *\n * Timelock is the period during which a proposed transaction must wait before being\n * executed, after it has passed. This period is intended to allow the parent DAO\n * sufficient time to potentially freeze the DAO, if they should vote to do so.\n *\n * The parameters for doing so are identical to [ISafe's](./ISafe.md) `execTransaction` function.\n *\n * @param _to destination address\n * @param _value ETH value\n * @param _data data payload\n * @param _operation Operation type, Call or DelegateCall\n * @param _safeTxGas gas that should be used for the safe transaction\n * @param _baseGas gas costs that are independent of the transaction execution\n * @param _gasPrice max gas price that should be used for this transaction\n * @param _gasToken token address (or 0 if ETH) that is used for the payment\n * @param _refundReceiver address of the receiver of gas payment (or 0 if tx.origin)\n * @param _signatures packed signature data\n * @param _nonce nonce to use for the safe transaction\n */\n function timelockTransaction(\n address _to,\n uint256 _value,\n bytes memory _data,\n Enum.Operation _operation,\n uint256 _safeTxGas,\n uint256 _baseGas,\n uint256 _gasPrice,\n address _gasToken,\n address payable _refundReceiver,\n bytes memory _signatures,\n uint256 _nonce\n ) external;\n\n /**\n * Sets the subDAO's timelock period.\n *\n * @param _timelockPeriod new timelock period for the subDAO (in blocks)\n */\n function updateTimelockPeriod(uint32 _timelockPeriod) external;\n\n /**\n * Updates the execution period.\n *\n * Execution period is the time period during which a subDAO's passed Proposals must be executed,\n * otherwise they will be expired.\n *\n * This period begins immediately after the timelock period has ended.\n *\n * @param _executionPeriod number of blocks a transaction has to be executed within\n */\n function updateExecutionPeriod(uint32 _executionPeriod) external;\n\n /**\n * Gets the block number that the given transaction was timelocked at.\n *\n * @param _signaturesHash hash of the transaction signatures\n * @return uint32 block number in which the transaction began its timelock period\n */\n function getTransactionTimelockedBlock(bytes32 _signaturesHash) external view returns (uint32);\n}\n" + }, + "contracts/interfaces/ISafe.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\n\n/**\n * The specification of methods available on a Safe contract wallet.\n * \n * This interface does not encompass every available function on a Safe,\n * only those which are used within the Azorius contracts.\n *\n * For the complete set of functions available on a Safe, see:\n * https://github.com/safe-global/safe-contracts/blob/main/contracts/Safe.sol\n */\ninterface ISafe {\n\n /**\n * Returns the current transaction nonce of the Safe.\n * Each transaction should has a different nonce to prevent replay attacks.\n *\n * @return uint256 current transaction nonce\n */\n function nonce() external view returns (uint256);\n\n /**\n * Set a guard contract that checks transactions before execution.\n * This can only be done via a Safe transaction.\n *\n * See https://docs.gnosis-safe.io/learn/safe-tools/guards.\n * See https://github.com/safe-global/safe-contracts/blob/main/contracts/base/GuardManager.sol.\n * \n * @param _guard address of the guard to be used or the 0 address to disable a guard\n */\n function setGuard(address _guard) external;\n\n /**\n * Executes an arbitrary transaction on the Safe.\n *\n * @param _to destination address\n * @param _value ETH value\n * @param _data data payload\n * @param _operation Operation type, Call or DelegateCall\n * @param _safeTxGas gas that should be used for the safe transaction\n * @param _baseGas gas costs that are independent of the transaction execution\n * @param _gasPrice max gas price that should be used for this transaction\n * @param _gasToken token address (or 0 if ETH) that is used for the payment\n * @param _refundReceiver address of the receiver of gas payment (or 0 if tx.origin)\n * @param _signatures packed signature data\n * @return success bool whether the transaction was successful or not\n */\n function execTransaction(\n address _to,\n uint256 _value,\n bytes calldata _data,\n Enum.Operation _operation,\n uint256 _safeTxGas,\n uint256 _baseGas,\n uint256 _gasPrice,\n address _gasToken,\n address payable _refundReceiver,\n bytes memory _signatures\n ) external payable returns (bool success);\n\n /**\n * Checks whether the signature provided is valid for the provided data and hash. Reverts otherwise.\n *\n * @param _dataHash Hash of the data (could be either a message hash or transaction hash)\n * @param _data That should be signed (this is passed to an external validator contract)\n * @param _signatures Signature data that should be verified. Can be packed ECDSA signature \n * ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash.\n */\n function checkSignatures(bytes32 _dataHash, bytes memory _data, bytes memory _signatures) external view;\n\n /**\n * Returns the pre-image of the transaction hash.\n *\n * @param _to destination address\n * @param _value ETH value\n * @param _data data payload\n * @param _operation Operation type, Call or DelegateCall\n * @param _safeTxGas gas that should be used for the safe transaction\n * @param _baseGas gas costs that are independent of the transaction execution\n * @param _gasPrice max gas price that should be used for this transaction\n * @param _gasToken token address (or 0 if ETH) that is used for the payment\n * @param _refundReceiver address of the receiver of gas payment (or 0 if tx.origin)\n * @param _nonce transaction nonce\n * @return bytes hash bytes\n */\n function encodeTransactionData(\n address _to,\n uint256 _value,\n bytes calldata _data,\n Enum.Operation _operation,\n uint256 _safeTxGas,\n uint256 _baseGas,\n uint256 _gasPrice,\n address _gasToken,\n address _refundReceiver,\n uint256 _nonce\n ) external view returns (bytes memory);\n\n /**\n * Returns if the given address is an owner of the Safe.\n *\n * See https://github.com/safe-global/safe-contracts/blob/main/contracts/base/OwnerManager.sol.\n *\n * @param _owner the address to check\n * @return bool whether _owner is an owner of the Safe\n */\n function isOwner(address _owner) external view returns (bool);\n}\n" + }, + "contracts/interfaces/sablier/ISablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {LockupLinear} from \"./LockupLinear.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface ISablierV2LockupLinear {\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external returns (uint256 streamId);\n}\n" + }, + "contracts/interfaces/sablier/LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\nlibrary LockupLinear {\n struct CreateWithTimestamps {\n address sender;\n address recipient;\n uint128 totalAmount;\n IERC20 asset;\n bool cancelable;\n bool transferable;\n Timestamps timestamps;\n Broker broker;\n }\n\n struct Timestamps {\n uint40 start;\n uint40 cliff;\n uint40 end;\n }\n\n struct Broker {\n address account;\n uint256 fee;\n }\n}\n" + }, + "contracts/KeyValuePairs.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { IKeyValuePairs } from \"./interfaces/IKeyValuePairs.sol\";\n\n/**\n * Implementation of [IKeyValuePairs](./interfaces/IKeyValuePairs.md), a utility \n * contract to log key / value pair events for the calling address.\n */\ncontract KeyValuePairs is IKeyValuePairs {\n\n event ValueUpdated(address indexed theAddress, string key, string value);\n\n error IncorrectValueCount();\n\n /** @inheritdoc IKeyValuePairs*/\n function updateValues(string[] memory _keys, string[] memory _values) external {\n\n uint256 keyCount = _keys.length;\n\n if (keyCount != _values.length)\n revert IncorrectValueCount();\n\n for (uint256 i; i < keyCount; ) {\n emit ValueUpdated(msg.sender, _keys[i], _values[i]);\n unchecked {\n ++i;\n }\n }\n }\n}\n" + }, + "contracts/mocks/ERC6551Registry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IERC6551Registry {\n /**\n * @dev The registry MUST emit the ERC6551AccountCreated event upon successful account creation.\n */\n event ERC6551AccountCreated(\n address account,\n address indexed implementation,\n bytes32 salt,\n uint256 chainId,\n address indexed tokenContract,\n uint256 indexed tokenId\n );\n\n /**\n * @dev The registry MUST revert with AccountCreationFailed error if the create2 operation fails.\n */\n error AccountCreationFailed();\n\n /**\n * @dev Creates a token bound account for a non-fungible token.\n *\n * If account has already been created, returns the account address without calling create2.\n *\n * Emits ERC6551AccountCreated event.\n *\n * @return account The address of the token bound account\n */\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address account);\n\n /**\n * @dev Returns the computed token bound account address for a non-fungible token.\n *\n * @return account The address of the token bound account\n */\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address account);\n}\n\ncontract ERC6551Registry is IERC6551Registry {\n function createAccount(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external returns (address) {\n assembly {\n // Memory Layout:\n // ----\n // 0x00 0xff (1 byte)\n // 0x01 registry (address) (20 bytes)\n // 0x15 salt (bytes32) (32 bytes)\n // 0x35 Bytecode Hash (bytes32) (32 bytes)\n // ----\n // 0x55 ERC-1167 Constructor + Header (20 bytes)\n // 0x69 implementation (address) (20 bytes)\n // 0x5D ERC-1167 Footer (15 bytes)\n // 0x8C salt (uint256) (32 bytes)\n // 0xAC chainId (uint256) (32 bytes)\n // 0xCC tokenContract (address) (32 bytes)\n // 0xEC tokenId (uint256) (32 bytes)\n\n // Silence unused variable warnings\n pop(chainId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Compute account address\n let computed := keccak256(0x00, 0x55)\n\n // If the account has not yet been deployed\n if iszero(extcodesize(computed)) {\n // Deploy account contract\n let deployed := create2(0, 0x55, 0xb7, salt)\n\n // Revert if the deployment fails\n if iszero(deployed) {\n mstore(0x00, 0x20188a59) // `AccountCreationFailed()`\n revert(0x1c, 0x04)\n }\n\n // Store account address in memory before salt and chainId\n mstore(0x6c, deployed)\n\n // Emit the ERC6551AccountCreated event\n log4(\n 0x6c,\n 0x60,\n // `ERC6551AccountCreated(address,address,bytes32,uint256,address,uint256)`\n 0x79f19b3655ee38b1ce526556b7731a20c8f218fbda4a3990b6cc4172fdf88722,\n implementation,\n tokenContract,\n tokenId\n )\n\n // Return the account address\n return(0x6c, 0x20)\n }\n\n // Otherwise, return the computed account address\n mstore(0x00, shr(96, shl(96, computed)))\n return(0x00, 0x20)\n }\n }\n\n function account(\n address implementation,\n bytes32 salt,\n uint256 chainId,\n address tokenContract,\n uint256 tokenId\n ) external view returns (address) {\n assembly {\n // Silence unused variable warnings\n pop(chainId)\n pop(tokenContract)\n pop(tokenId)\n\n // Copy bytecode + constant data to memory\n calldatacopy(0x8c, 0x24, 0x80) // salt, chainId, tokenContract, tokenId\n mstore(0x6c, 0x5af43d82803e903d91602b57fd5bf3) // ERC-1167 footer\n mstore(0x5d, implementation) // implementation\n mstore(0x49, 0x3d60ad80600a3d3981f3363d3d373d3d3d363d73) // ERC-1167 constructor + header\n\n // Copy create2 computation data to memory\n mstore8(0x00, 0xff) // 0xFF\n mstore(0x35, keccak256(0x55, 0xb7)) // keccak256(bytecode)\n mstore(0x01, shl(96, address())) // registry address\n mstore(0x15, salt) // salt\n\n // Store computed account address in memory\n mstore(0x00, shr(96, shl(96, keccak256(0x00, 0x55))))\n\n // Return computed account address\n return(0x00, 0x20)\n }\n }\n}\n" + }, + "contracts/mocks/MockContract.sol": { + "content": "//SPDX-License-Identifier: Unlicense\n\npragma solidity ^0.8.19;\n\n/**\n * Mock contract for testing\n */\ncontract MockContract {\n event DidSomething(string message);\n\n error Reverting();\n\n function doSomething() public {\n doSomethingWithParam(\"doSomething()\");\n }\n\n function doSomethingWithParam(string memory _message) public {\n emit DidSomething(_message);\n }\n\n function returnSomething(string memory _s)\n external\n pure\n returns (string memory)\n {\n return _s;\n }\n\n function revertSomething() external pure {\n revert Reverting();\n }\n}\n" + }, + "contracts/mocks/MockERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockERC20 is ERC20 {\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {}\n\n function mint(address to, uint256 amount) public {\n _mint(to, amount);\n }\n}\n" + }, + "contracts/mocks/MockERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { ERC721 } from \"@openzeppelin/contracts/token/ERC721/ERC721.sol\";\n\ncontract MockERC721 is ERC721 {\n\n uint256 private tokenIds = 0;\n\n constructor() ERC721(\"Mock NFT\", \"MNFT\") {}\n\n function mint(address _owner) external {\n _mint(_owner, tokenIds++);\n }\n}" + }, + "contracts/mocks/MockHats.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport {IHats} from \"../interfaces/hats/IHats.sol\";\n\ncontract MockHats is IHats {\n uint256 public count = 0;\n\n // Mapping to track which addresses wear which hats\n mapping(uint256 => mapping(address => bool)) private hatWearers;\n\n function mintTopHat(\n address _wearer,\n string memory,\n string memory\n ) external returns (uint256 topHatId) {\n topHatId = count;\n hatWearers[topHatId][_wearer] = true;\n count++;\n }\n\n function createHat(\n uint256,\n string calldata,\n uint32,\n address,\n address,\n bool,\n string calldata\n ) external returns (uint256 newHatId) {\n newHatId = count;\n count++;\n }\n\n function mintHat(\n uint256 _hatId,\n address _wearer\n ) external returns (bool success) {\n hatWearers[_hatId][_wearer] = true;\n success = true;\n }\n\n function transferHat(uint256 _hatId, address _from, address _to) external {\n hatWearers[_hatId][_from] = false;\n hatWearers[_hatId][_to] = true;\n }\n\n function isWearerOfHat(\n address _user,\n uint256 _hatId\n ) external view returns (bool) {\n return hatWearers[_hatId][_user];\n }\n}\n" + }, + "contracts/mocks/MockHatsAccount.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\ncontract MockHatsAccount {\n // see https://github.com/Hats-Protocol/hats-account/blob/00650b3de756352d303ca08e4b024376f1d1db98/src/HatsAccountBase.sol#L41\n // for my inspiration\n\n function tokenId() public view returns (uint256) {\n bytes memory footer = new bytes(0x20);\n assembly {\n // copy 0x20 bytes from final word of footer\n extcodecopy(address(), add(footer, 0x20), 0x8d, 0x20)\n }\n return abi.decode(footer, (uint256));\n }\n\n function tokenImplementation() public view returns (address) {\n bytes memory footer = new bytes(0x20);\n assembly {\n // copy 0x20 bytes from third word of footer\n extcodecopy(address(), add(footer, 0x20), 0x6d, 0x20)\n }\n return abi.decode(footer, (address));\n }\n}\n" + }, + "contracts/mocks/MockHatsProposalCreationWhitelist.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport \"../azorius/HatsProposalCreationWhitelist.sol\";\n\ncontract MockHatsProposalCreationWhitelist is HatsProposalCreationWhitelist {\n function setUp(bytes memory initializeParams) public override initializer {\n __Ownable_init();\n super.setUp(initializeParams);\n }\n}\n" + }, + "contracts/mocks/MockSablierV2LockupLinear.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../interfaces/sablier/ISablierV2LockupLinear.sol\";\nimport {LockupLinear} from \"../interfaces/sablier/LockupLinear.sol\";\n\ncontract MockSablierV2LockupLinear is ISablierV2LockupLinear {\n // Define the Stream struct here\n struct Stream {\n address sender;\n address recipient;\n uint128 totalAmount;\n address asset;\n bool cancelable;\n bool transferable;\n uint40 startTime;\n uint40 cliffTime;\n uint40 endTime;\n }\n\n mapping(uint256 => Stream) public streams;\n uint256 public nextStreamId = 1;\n\n // Add this event declaration at the contract level\n event StreamCreated(\n uint256 streamId,\n address indexed sender,\n address indexed recipient,\n uint128 totalAmount,\n address indexed asset,\n bool cancelable,\n bool transferable,\n uint40 startTime,\n uint40 cliffTime,\n uint40 endTime\n );\n\n function createWithTimestamps(\n LockupLinear.CreateWithTimestamps calldata params\n ) external override returns (uint256 streamId) {\n require(\n params.asset.transferFrom(\n msg.sender,\n address(this),\n params.totalAmount\n ),\n \"Token transfer failed\"\n );\n\n streamId = nextStreamId++;\n streams[streamId] = Stream({\n sender: params.sender,\n recipient: params.recipient,\n totalAmount: params.totalAmount,\n asset: address(params.asset),\n cancelable: params.cancelable,\n transferable: params.transferable,\n startTime: params.timestamps.start,\n cliffTime: params.timestamps.cliff,\n endTime: params.timestamps.end\n });\n\n // Emit the StreamCreated event\n emit StreamCreated(\n streamId,\n params.sender,\n params.recipient,\n params.totalAmount,\n address(params.asset),\n params.cancelable,\n params.transferable,\n params.timestamps.start,\n params.timestamps.cliff,\n params.timestamps.end\n );\n\n return streamId;\n }\n\n function getStream(uint256 streamId) external view returns (Stream memory) {\n return streams[streamId];\n }\n\n function withdrawableAmountOf(\n uint256 streamId\n ) public view returns (uint128) {\n Stream memory stream = streams[streamId];\n if (block.timestamp <= stream.startTime) {\n return 0;\n }\n if (block.timestamp >= stream.endTime) {\n return stream.totalAmount;\n }\n return\n uint128(\n (stream.totalAmount * (block.timestamp - stream.startTime)) /\n (stream.endTime - stream.startTime)\n );\n }\n\n function withdraw(uint256 streamId, uint128 amount) external {\n Stream storage stream = streams[streamId];\n require(msg.sender == stream.recipient, \"Only recipient can withdraw\");\n require(\n amount <= withdrawableAmountOf(streamId),\n \"Insufficient withdrawable amount\"\n );\n\n stream.totalAmount -= amount;\n IERC20(stream.asset).transfer(stream.recipient, amount);\n }\n\n function cancel(uint256 streamId) external {\n Stream memory stream = streams[streamId];\n require(stream.cancelable, \"Stream is not cancelable\");\n require(msg.sender == stream.sender, \"Only sender can cancel\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n delete streams[streamId];\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function renounce(uint256 streamId) external {\n Stream memory stream = streams[streamId];\n require(msg.sender == stream.recipient, \"Only recipient can renounce\");\n\n uint128 withdrawableAmount = withdrawableAmountOf(streamId);\n uint128 refundAmount = stream.totalAmount - withdrawableAmount;\n\n delete streams[streamId];\n\n if (withdrawableAmount > 0) {\n IERC20(stream.asset).transfer(stream.recipient, withdrawableAmount);\n }\n if (refundAmount > 0) {\n IERC20(stream.asset).transfer(stream.sender, refundAmount);\n }\n }\n\n function transferFrom(uint256 streamId, address recipient) external {\n Stream storage stream = streams[streamId];\n require(stream.transferable, \"Stream is not transferable\");\n require(\n msg.sender == stream.recipient,\n \"Only current recipient can transfer\"\n );\n\n stream.recipient = recipient;\n }\n}\n" + }, + "contracts/mocks/MockVotingStrategy.sol": { + "content": "// SPDX-License-Identifier: LGPL-3.0-only\npragma solidity =0.8.19;\n\nimport { BaseStrategy, IBaseStrategy } from \"../azorius/BaseStrategy.sol\";\n\n/**\n * A mock [BaseStrategy](../BaseStrategy.md) used only for testing purposes.\n * Not intended for actual on-chain use.\n */\ncontract MockVotingStrategy is BaseStrategy {\n address public proposer;\n\n /**\n * Sets up the contract with its initial parameters.\n *\n * @param initializeParams encoded initialization parameters\n */\n function setUp(bytes memory initializeParams) public override initializer {\n address _proposer = abi.decode(initializeParams, (address));\n proposer = _proposer;\n }\n\n /** @inheritdoc IBaseStrategy*/\n function initializeProposal(bytes memory _data) external override {}\n\n /** @inheritdoc IBaseStrategy*/\n function isPassed(uint32) external pure override returns (bool) {\n return false;\n }\n\n /** @inheritdoc IBaseStrategy*/\n function isProposer(address _proposer) external view override returns (bool) {\n return _proposer == proposer;\n }\n\n /** @inheritdoc IBaseStrategy*/\n function votingEndBlock(uint32) external pure override returns (uint32) {\n return 0;\n }\n}\n" + }, + "contracts/MultisigFreezeGuard.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { IMultisigFreezeGuard } from \"./interfaces/IMultisigFreezeGuard.sol\";\nimport { IBaseFreezeVoting } from \"./interfaces/IBaseFreezeVoting.sol\";\nimport { ISafe } from \"./interfaces/ISafe.sol\";\nimport { IGuard } from \"@gnosis.pm/zodiac/contracts/interfaces/IGuard.sol\";\nimport { FactoryFriendly } from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport { Enum } from \"@gnosis.pm/safe-contracts/contracts/common/Enum.sol\";\nimport { BaseGuard } from \"@gnosis.pm/zodiac/contracts/guard/BaseGuard.sol\";\n\n/**\n * Implementation of [IMultisigFreezeGuard](./interfaces/IMultisigFreezeGuard.md).\n */\ncontract MultisigFreezeGuard is FactoryFriendly, IGuard, IMultisigFreezeGuard, BaseGuard {\n\n /** Timelock period (in blocks). */\n uint32 public timelockPeriod;\n\n /** Execution period (in blocks). */\n uint32 public executionPeriod;\n\n /**\n * Reference to the [IBaseFreezeVoting](./interfaces/IBaseFreezeVoting.md)\n * implementation that determines whether the Safe is frozen.\n */\n IBaseFreezeVoting public freezeVoting;\n\n /** Reference to the Safe that can be frozen. */\n ISafe public childGnosisSafe;\n\n /** Mapping of signatures hash to the block during which it was timelocked. */\n mapping(bytes32 => uint32) internal transactionTimelockedBlock;\n\n event MultisigFreezeGuardSetup(\n address creator,\n address indexed owner,\n address indexed freezeVoting,\n address indexed childGnosisSafe\n );\n event TransactionTimelocked(\n address indexed timelocker,\n bytes32 indexed transactionHash,\n bytes indexed signatures\n );\n event TimelockPeriodUpdated(uint32 timelockPeriod);\n event ExecutionPeriodUpdated(uint32 executionPeriod);\n\n error AlreadyTimelocked();\n error NotTimelocked();\n error Timelocked();\n error Expired();\n error DAOFrozen();\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `uint256 _timelockPeriod`,\n * `uint256 _executionPeriod`, `address _owner`, `address _freezeVoting`, `address _childGnosisSafe`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n __Ownable_init();\n (\n uint32 _timelockPeriod,\n uint32 _executionPeriod,\n address _owner,\n address _freezeVoting,\n address _childGnosisSafe\n ) = abi.decode(\n initializeParams,\n (uint32, uint32, address, address, address)\n );\n\n _updateTimelockPeriod(_timelockPeriod);\n _updateExecutionPeriod(_executionPeriod);\n transferOwnership(_owner);\n freezeVoting = IBaseFreezeVoting(_freezeVoting);\n childGnosisSafe = ISafe(_childGnosisSafe);\n\n emit MultisigFreezeGuardSetup(\n msg.sender,\n _owner,\n _freezeVoting,\n _childGnosisSafe\n );\n }\n\n /** @inheritdoc IMultisigFreezeGuard*/\n function timelockTransaction(\n address to,\n uint256 value,\n bytes memory data,\n Enum.Operation operation,\n uint256 safeTxGas,\n uint256 baseGas,\n uint256 gasPrice,\n address gasToken,\n address payable refundReceiver,\n bytes memory signatures,\n uint256 nonce\n ) external {\n bytes32 signaturesHash = keccak256(signatures);\n\n if (transactionTimelockedBlock[signaturesHash] != 0)\n revert AlreadyTimelocked();\n\n bytes memory transactionHashData = childGnosisSafe\n .encodeTransactionData(\n to,\n value,\n data,\n operation,\n safeTxGas,\n baseGas,\n gasPrice,\n gasToken,\n refundReceiver,\n nonce\n );\n\n bytes32 transactionHash = keccak256(transactionHashData);\n\n // if signatures are not valid, this will revert\n childGnosisSafe.checkSignatures(\n transactionHash,\n transactionHashData,\n signatures\n );\n\n transactionTimelockedBlock[signaturesHash] = uint32(block.number);\n\n emit TransactionTimelocked(msg.sender, transactionHash, signatures);\n }\n\n /** @inheritdoc IMultisigFreezeGuard*/\n function updateTimelockPeriod(uint32 _timelockPeriod) external onlyOwner {\n _updateTimelockPeriod(_timelockPeriod);\n }\n\n /** @inheritdoc IMultisigFreezeGuard*/\n function updateExecutionPeriod(uint32 _executionPeriod) external onlyOwner {\n executionPeriod = _executionPeriod;\n }\n\n /**\n * Called by the Safe to check if the transaction is able to be executed and reverts\n * if the guard conditions are not met.\n */\n function checkTransaction(\n address,\n uint256,\n bytes memory,\n Enum.Operation,\n uint256,\n uint256,\n uint256,\n address,\n address payable,\n bytes memory signatures,\n address\n ) external view override(BaseGuard, IGuard) {\n bytes32 signaturesHash = keccak256(signatures);\n\n if (transactionTimelockedBlock[signaturesHash] == 0)\n revert NotTimelocked();\n\n if (\n block.number <\n transactionTimelockedBlock[signaturesHash] + timelockPeriod\n ) revert Timelocked();\n\n if (\n block.number >\n transactionTimelockedBlock[signaturesHash] +\n timelockPeriod +\n executionPeriod\n ) revert Expired();\n\n if (freezeVoting.isFrozen()) revert DAOFrozen();\n }\n\n /**\n * A callback performed after a transaction is executed on the Safe. This is a required\n * function of the `BaseGuard` and `IGuard` interfaces that we do not make use of.\n */\n function checkAfterExecution(bytes32, bool) external view override(BaseGuard, IGuard) {\n // not implementated\n }\n\n /** @inheritdoc IMultisigFreezeGuard*/\n function getTransactionTimelockedBlock(bytes32 _signaturesHash) public view returns (uint32) {\n return transactionTimelockedBlock[_signaturesHash];\n }\n\n /** Internal implementation of `updateTimelockPeriod` */\n function _updateTimelockPeriod(uint32 _timelockPeriod) internal {\n timelockPeriod = _timelockPeriod;\n emit TimelockPeriodUpdated(_timelockPeriod);\n }\n\n /** Internal implementation of `updateExecutionPeriod` */\n function _updateExecutionPeriod(uint32 _executionPeriod) internal {\n executionPeriod = _executionPeriod;\n emit ExecutionPeriodUpdated(_executionPeriod);\n }\n}\n" + }, + "contracts/MultisigFreezeVoting.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { BaseFreezeVoting, IBaseFreezeVoting } from \"./BaseFreezeVoting.sol\";\nimport { ISafe } from \"./interfaces/ISafe.sol\";\n\n/**\n * A BaseFreezeVoting implementation which handles freezes on multi-sig (Safe) based DAOs.\n */\ncontract MultisigFreezeVoting is BaseFreezeVoting {\n ISafe public parentGnosisSafe;\n\n event MultisigFreezeVotingSetup(\n address indexed owner,\n address indexed parentGnosisSafe\n );\n\n error NotOwner();\n error AlreadyVoted();\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _owner`,\n * `uint256 _freezeVotesThreshold`, `uint256 _freezeProposalPeriod`, `uint256 _freezePeriod`,\n * `address _parentGnosisSafe`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (\n address _owner,\n uint256 _freezeVotesThreshold,\n uint32 _freezeProposalPeriod,\n uint32 _freezePeriod,\n address _parentGnosisSafe\n ) = abi.decode(\n initializeParams,\n (address, uint256, uint32, uint32, address)\n );\n\n __Ownable_init();\n _transferOwnership(_owner);\n _updateFreezeVotesThreshold(_freezeVotesThreshold);\n _updateFreezeProposalPeriod(_freezeProposalPeriod);\n _updateFreezePeriod(_freezePeriod);\n parentGnosisSafe = ISafe(_parentGnosisSafe);\n\n emit MultisigFreezeVotingSetup(_owner, _parentGnosisSafe);\n }\n\n /** @inheritdoc IBaseFreezeVoting*/\n function castFreezeVote() external override {\n if (!parentGnosisSafe.isOwner(msg.sender)) revert NotOwner();\n\n if (block.number > freezeProposalCreatedBlock + freezeProposalPeriod) {\n // create a new freeze proposal and count the caller's vote\n\n freezeProposalCreatedBlock = uint32(block.number);\n\n freezeProposalVoteCount = 1;\n\n emit FreezeProposalCreated(msg.sender);\n } else {\n // there is an existing freeze proposal, count the caller's vote\n\n if (userHasFreezeVoted[msg.sender][freezeProposalCreatedBlock])\n revert AlreadyVoted();\n\n freezeProposalVoteCount++;\n }\n\n userHasFreezeVoted[msg.sender][freezeProposalCreatedBlock] = true;\n\n emit FreezeVoteCast(msg.sender, 1);\n }\n}\n" + }, + "contracts/VotesERC20.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { FactoryFriendly } from \"@gnosis.pm/zodiac/contracts/factory/FactoryFriendly.sol\";\nimport { ERC165Storage } from \"@openzeppelin/contracts/utils/introspection/ERC165Storage.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20VotesUpgradeable, ERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\";\nimport { ERC20SnapshotUpgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20SnapshotUpgradeable.sol\";\n\n/**\n * An implementation of the Open Zeppelin `IVotes` voting token standard.\n */\ncontract VotesERC20 is\n IERC20Upgradeable,\n ERC20SnapshotUpgradeable,\n ERC20VotesUpgradeable,\n ERC165Storage,\n FactoryFriendly\n{\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `string memory _name`,\n * `string memory _symbol`, `address[] memory _allocationAddresses`, \n * `uint256[] memory _allocationAmounts`\n */\n function setUp(bytes memory initializeParams) public virtual override initializer {\n (\n string memory _name, // token name\n string memory _symbol, // token symbol\n address[] memory _allocationAddresses, // addresses of initial allocations\n uint256[] memory _allocationAmounts // amounts of initial allocations\n ) = abi.decode(\n initializeParams,\n (string, string, address[], uint256[])\n );\n\n __ERC20_init(_name, _symbol);\n __ERC20Permit_init(_name);\n _registerInterface(type(IERC20Upgradeable).interfaceId);\n\n uint256 holderCount = _allocationAddresses.length;\n for (uint256 i; i < holderCount; ) {\n _mint(_allocationAddresses[i], _allocationAmounts[i]);\n unchecked {\n ++i;\n }\n }\n }\n\n /**\n * See `ERC20SnapshotUpgradeable._snapshot()`.\n */\n function captureSnapShot() external returns (uint256 snapId) {\n snapId = _snapshot();\n }\n\n // -- The functions below are overrides required by extended contracts. --\n\n /** Overridden without modification. */\n function _mint(\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, ERC20VotesUpgradeable) {\n super._mint(to, amount);\n }\n\n /** Overridden without modification. */\n function _burn(\n address account,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, ERC20VotesUpgradeable) {\n super._burn(account, amount);\n }\n\n /** Overridden without modification. */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, ERC20SnapshotUpgradeable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n\n /** Overridden without modification. */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, ERC20VotesUpgradeable) {\n super._afterTokenTransfer(from, to, amount);\n }\n}\n" + }, + "contracts/VotesERC20Wrapper.sol": { + "content": "//SPDX-License-Identifier: MIT\npragma solidity =0.8.19;\n\nimport { ERC20VotesUpgradeable, ERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol\";\nimport { ERC20WrapperUpgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20WrapperUpgradeable.sol\";\nimport { IERC20Upgradeable } from \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\nimport { ERC20 } from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\nimport { VotesERC20 } from \"./VotesERC20.sol\";\n\n/**\n * An extension of `VotesERC20` which supports wrapping / unwrapping an existing ERC20 token,\n * to allow for importing an existing token into the Azorius governance framework.\n */\ncontract VotesERC20Wrapper is VotesERC20, ERC20WrapperUpgradeable {\n \n constructor() {\n _disableInitializers();\n }\n\n /**\n * Initialize function, will be triggered when a new instance is deployed.\n *\n * @param initializeParams encoded initialization parameters: `address _underlyingTokenAddress`\n */\n function setUp(bytes memory initializeParams) public override initializer {\n (address _underlyingTokenAddress) = abi.decode(initializeParams, (address));\n\n // not necessarily upgradeable, but required to pass into __ERC20Wrapper_init\n ERC20Upgradeable token = ERC20Upgradeable(_underlyingTokenAddress);\n\n __ERC20Wrapper_init(token);\n\n string memory name = string.concat(\"Wrapped \", token.name());\n __ERC20_init(name, string.concat(\"W\", token.symbol()));\n __ERC20Permit_init(name);\n _registerInterface(type(IERC20Upgradeable).interfaceId);\n }\n\n // -- The functions below are overrides required by extended contracts. --\n\n /** Overridden without modification. */\n function _mint(\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, VotesERC20) {\n super._mint(to, amount);\n }\n\n /** Overridden without modification. */\n function _burn(\n address account,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, VotesERC20) {\n super._burn(account, amount);\n }\n\n /** Overridden without modification. */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, VotesERC20) {\n super._beforeTokenTransfer(from, to, amount);\n }\n\n /** Overridden without modification. */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20Upgradeable, VotesERC20) {\n super._afterTokenTransfer(from, to, amount);\n }\n\n /** Overridden without modification. */\n function decimals() public view virtual override(ERC20Upgradeable, ERC20WrapperUpgradeable) returns (uint8) {\n return super.decimals();\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file